/// @file /// @version 2.0 /// /// @section LICENSE /// /// This program is free software; you can redistribute it and/or modify it under /// the terms of the BSD license: http://opensource.org/licenses/BSD-3-Clause /// /// @section DESCRIPTION /// /// Defines an audio interface for OpenAL. #ifndef THEORAPLAYER_DEMOS_OPENAL_AUDIO_INTERFACE_H #define THEORAPLAYER_DEMOS_OPENAL_AUDIO_INTERFACE_H #ifndef __APPLE__ #include #include #else #include #include #endif #include #include #include #include #include class OpenAL_AudioInterface : public theoraplayer::AudioInterface, theoraplayer::Timer { public: OpenAL_AudioInterface(theoraplayer::VideoClip* clip, int channelsCount, int frequency); ~OpenAL_AudioInterface(); //! queued audio buffers, expressed in seconds float getQueuedAudioSize(); void insertData(float* data, int samplesCount); void update(float timeDelta); void pause(); void play(); void seek(float time); private: int sourceNumChannels; int maxBuffSize; int buffSize; short* tempBuffer; float currentTimer; struct OpenAL_Buffer { ALuint id; int samplesCount; }; std::queue bufferQueue; ALuint source; int numProcessedSamples; int numPlayedSamples; }; class OpenAL_AudioInterfaceFactory : public theoraplayer::AudioInterfaceFactory { public: OpenAL_AudioInterfaceFactory(); ~OpenAL_AudioInterfaceFactory(); OpenAL_AudioInterface* createInstance(theoraplayer::VideoClip* clip, int channelsCount, int frequency); }; #endif