/*! * @file ogg_player.h * Ogg-Player definition */ #ifndef _OGG_PLAYER_H #define _OGG_PLAYER_H using namespace std; #include "base_object.h" #include "alincl.h" #include #include struct File; #define BUFFER_SIZE (8096 * 16) // the definition of a Ogg-Player class OggPlayer : public BaseObject { public: OggPlayer(const std::string& fileName = ""); virtual ~OggPlayer(); bool open(const std::string& fileName); void release(); void debug(); bool playback(); bool playing(); bool update(); void printState(); protected: bool stream(ALuint buffer); void empty(); const char* errorString(int code); public: typedef enum { None = 0x000, FileOpened = 0x100, SourceAllocated = 0x200, BuffersAllocated = 0x400, Stopped = 0x010, Playing = 0x020, Paused = 0x040, Error = 0x001, } State; private: FILE* oggFile; //!< general file-handler, to open the sound-file OggVorbis_File oggStream; //!< The stream this Ogg-player is playing back vorbis_info* vorbisInfo; //!< The information held in the opened ogg-file vorbis_comment* vorbisComment; //!< Comments about the ogg-file ALuint buffers[2]; //!< buffers that handle sequentially buffering of the audio ALuint source; //!< The source we play back on ALenum format; //!< The format we play back unsigned int state; //bool trackLoaded; //!< If a Track has been loaded. }; #endif /* _OGG_PLAYER_H */