/* This software is the propery of 'SaraCraft' - developed by Allanis. * Only members directly assosiated with the SaraCraft project may view/change * this code. * * This class streams music from disk so that * all the music doesn't need to be in memory. */ #ifndef _SOUNDSTREAM_H_ #define _SOUNDSTREAM_H_ #include #include using namespace std; #include #include #include #include #include #define BUFFER_SIZE (4096 * 8) class SoundStream { public: void open(string path); // Obtain a handle to the file void release(); // Release the file handle void display(); // display some info on the Ogg bool playback(); // Play the Ogg stream bool playing(); // Check if the source is playing bool update(); // Update the stream if needed void reload(); // Starts the file from beginning protected: bool stream(ALuint buffer); // Reload a buffer void empty(); // Empties the queue void check(); // checks OpenAL error state string errorString(int code); // stringify an error code private: FILE* oggFile; // file handle OggVorbis_File oggStream; // stream handle vorbis_info* vorbisInfo; // some formatting data vorbis_comment* vorbisComment; // user comments ALuint buffers[2]; // Front and back buffers ALuint source; // audio source ALuint format; // Internal format string file; // Used to store where the file is }; #endif