4 * ***** BEGIN LGPL LICENSE BLOCK *****
6 * Copyright 2009 Jörg Hermann Müller
8 * This file is part of AudaSpace.
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.
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.
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/>.
23 * ***** END LGPL LICENSE BLOCK *****
26 #include "AUD_SndFileFactory.h"
27 #include "AUD_SndFileReader.h"
28 #include "AUD_Buffer.h"
32 AUD_SndFileFactory::AUD_SndFileFactory(const char* filename)
36 m_filename = new char[strlen(filename)+1]; AUD_NEW("string")
37 strcpy(m_filename, filename);
43 AUD_SndFileFactory::AUD_SndFileFactory(unsigned char* buffer, int size)
46 m_buffer = AUD_Reference<AUD_Buffer>(new AUD_Buffer(size));
47 memcpy(m_buffer.get()->getBuffer(), buffer, size);
50 AUD_SndFileFactory::~AUD_SndFileFactory()
54 delete[] m_filename; AUD_DELETE("string")
58 AUD_IReader* AUD_SndFileFactory::createReader()
62 reader = new AUD_SndFileReader(m_filename);
64 reader = new AUD_SndFileReader(m_buffer);