]> git.tdb.fi Git - libs/al.git/blobdiff - source/sounddecoder.h
Make SoundDecoder a base class and split off Ogg decoding
[libs/al.git] / source / sounddecoder.h
index c9566592f38870198e84bc8a263cf65d5b177522..7a08644117317623d629b88559788036b5f16e8b 100644 (file)
@@ -1,8 +1,7 @@
-#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"
 
@@ -16,25 +15,22 @@ supported.
 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; }