svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r22704:22717
[blender.git] / intern / audaspace / SRC / AUD_SRCResampleFactory.cpp
1 /*
2  * $Id$
3  *
4  * ***** BEGIN LGPL LICENSE BLOCK *****
5  *
6  * Copyright 2009 Jörg Hermann Müller
7  *
8  * This file is part of AudaSpace.
9  *
10  * AudaSpace is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU Lesser General Public License as published by
12  * the Free Software Foundation, either version 3 of the License, or
13  * (at your option) any later version.
14  *
15  * AudaSpace is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public License
21  * along with AudaSpace.  If not, see <http://www.gnu.org/licenses/>.
22  *
23  * ***** END LGPL LICENSE BLOCK *****
24  */
25
26 #include "AUD_SRCResampleFactory.h"
27 #include "AUD_SRCResampleReader.h"
28
29 AUD_SRCResampleFactory::AUD_SRCResampleFactory(AUD_IReader* reader,
30                                                                                            AUD_Specs specs) :
31                 AUD_ResampleFactory(reader, specs) {}
32
33 AUD_SRCResampleFactory::AUD_SRCResampleFactory(AUD_IFactory* factory,
34                                                                                            AUD_Specs specs) :
35                 AUD_ResampleFactory(factory, specs) {}
36
37 AUD_SRCResampleFactory::AUD_SRCResampleFactory(AUD_Specs specs) :
38                 AUD_ResampleFactory(specs) {}
39
40 AUD_IReader* AUD_SRCResampleFactory::createReader()
41 {
42         AUD_IReader* reader = getReader();
43
44         if(reader != 0)
45         {
46                 if(reader->getSpecs().rate != m_specs.rate)
47                 {
48                         reader = new AUD_SRCResampleReader(reader, m_specs);
49                         AUD_NEW("reader")
50                 }
51         }
52         return reader;
53 }