]> git.tdb.fi Git - libs/al.git/blob - source/sounddecoder.cpp
77e3b408da40737cb7854af1a8283e489ae7ae99
[libs/al.git] / source / sounddecoder.cpp
1 #include <msp/core/refptr.h>
2 #include <msp/io/file.h>
3 #include "oggdecoder.h"
4 #include "sounddecoder.h"
5
6 using namespace std;
7
8 namespace Msp {
9 namespace AL {
10
11 SoundDecoder::SoundDecoder():
12         source(0),
13         freq(0),
14         size(0),
15         format(MONO8),
16         eof_flag(false)
17 { }
18
19 SoundDecoder::~SoundDecoder()
20 {
21         delete source;
22 }
23
24 SoundDecoder *SoundDecoder::open_file(const string &fn)
25 {
26         RefPtr<IO::BufferedFile> file = new IO::BufferedFile(fn);
27         SoundDecoder *decoder = new OggDecoder(*file);
28         decoder->source = file.release();
29         return decoder;
30 }
31
32 SoundDecoder *SoundDecoder::open_io(IO::Seekable &io)
33 {
34         return new OggDecoder(io);
35 }
36
37 } // namespace AL
38 } // namespace Msp