-#ifndef MSP_AL_SOUND_H_
-#define MSP_AL_SOUND_H_
+#ifndef MSP_AL_SOUNDDECODER_H_
+#define MSP_AL_SOUNDDECODER_H_
#include <string>
-#include <vorbis/vorbisfile.h>
#include <msp/io/seekable.h>
#include "format.h"
class SoundDecoder
{
private:
- OggVorbis_File ovfile;
IO::Seekable *source;
+protected:
unsigned freq;
unsigned size;
Format format;
bool eof_flag;
-public:
SoundDecoder();
- ~SoundDecoder();
-
- void open_file(const std::string &);
- void open_io(IO::Seekable &);
-private:
- void open_common();
public:
- void close();
- void rewind();
- unsigned read(char *, unsigned);
+ virtual ~SoundDecoder();
+
+ static SoundDecoder *open_file(const std::string &);
+ static SoundDecoder *open_io(IO::Seekable &);
+
+ virtual void rewind() = 0;
+ virtual unsigned read(char *, unsigned) = 0;
bool eof() const { return eof_flag; }
Format get_format() const { return format; }