X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fsound.h;h=60bdf456319d4cf3298d74176c879aa62adb13fe;hb=17948408eafd48ea529acd0a70cc45fc5973cb10;hp=0e15a40dc3fdccfc13b671af18660d778f7cd4a2;hpb=35ea5cc8d1eb8c806885d27441548f630e7b1266;p=libs%2Fal.git diff --git a/source/sound.h b/source/sound.h index 0e15a40..60bdf45 100644 --- a/source/sound.h +++ b/source/sound.h @@ -1,19 +1,17 @@ -/* $Id$ - -This file is part of libmspal -Copyright © 2008 Mikko Rasa, Mikkosoft Productions -Diestributed under the LGPL -*/ - #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 Sound { private: @@ -22,19 +20,30 @@ private: unsigned size; char *data; Format format; + unsigned read_pos; + bool eof_flag; public: Sound(); ~Sound(); - void open(const std::string &); + void open_file(const std::string &); + void open_memory(const void *, unsigned); +private: + void open_common(); +public: void load_data(); - void load(const std::string &); + void load_file(const std::string &); + void load_memory(const void *, unsigned); + 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; } const char *get_data() const; - unsigned read(char *, unsigned); }; } // namespace AL