X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fsounddecoder.h;fp=source%2Fsounddecoder.h;h=ad56646b30dc149c9bfe48ef3fb243f3d811121f;hb=6cc0f1735a00e8f9eb80ff0c9468fb67205f6d20;hp=0000000000000000000000000000000000000000;hpb=17948408eafd48ea529acd0a70cc45fc5973cb10;p=libs%2Fal.git diff --git a/source/sounddecoder.h b/source/sounddecoder.h new file mode 100644 index 0000000..ad56646 --- /dev/null +++ b/source/sounddecoder.h @@ -0,0 +1,46 @@ +#ifndef MSP_AL_SOUND_H_ +#define MSP_AL_SOUND_H_ + +#include +#include +#include "format.h" + +namespace Msp { +namespace AL { + +/** +This class facilitates loading sound files. Currently only Ogg Vorbis is +supported. +*/ +class SoundDecoder +{ +private: + OggVorbis_File ovfile; + unsigned freq; + unsigned size; + Format format; + bool eof_flag; + +public: + SoundDecoder(); + ~SoundDecoder(); + + void open_file(const std::string &); + void open_memory(const void *, unsigned); +private: + void open_common(); +public: + void close(); + void rewind(); + unsigned read(char *, unsigned); + bool eof() const { return eof_flag; } + + Format get_format() const { return format; } + unsigned get_frequency() const { return freq; } + unsigned get_size() const { return size; } +}; + +} // namespace AL +} // namespace Msp + +#endif