diff options
author | Alejandro Marzini | 2010-07-03 00:13:45 +0000 |
---|---|---|
committer | Alejandro Marzini | 2010-07-03 00:13:45 +0000 |
commit | fda9416cc8b64fa7371b7a9989def9cc318efc7e (patch) | |
tree | 2cdb4c6714e0cb8bbcd6ea03c5b467b6ade50e4b /backends/mixer | |
parent | f9c3a4547cbf1b1942402d618fa403a7fb1cb656 (diff) | |
download | scummvm-rg350-fda9416cc8b64fa7371b7a9989def9cc318efc7e.tar.gz scummvm-rg350-fda9416cc8b64fa7371b7a9989def9cc318efc7e.tar.bz2 scummvm-rg350-fda9416cc8b64fa7371b7a9989def9cc318efc7e.zip |
Cleanup and documentation.
svn-id: r50609
Diffstat (limited to 'backends/mixer')
-rw-r--r-- | backends/mixer/doublebuffersdl/doublebuffersdl-mixer.h | 16 | ||||
-rw-r--r-- | backends/mixer/sdl/sdl-mixer.h | 43 | ||||
-rw-r--r-- | backends/mixer/symbiansdl/symbiansdl-mixer.h | 9 |
3 files changed, 64 insertions, 4 deletions
diff --git a/backends/mixer/doublebuffersdl/doublebuffersdl-mixer.h b/backends/mixer/doublebuffersdl/doublebuffersdl-mixer.h index b71a3ed381..6304c287df 100644 --- a/backends/mixer/doublebuffersdl/doublebuffersdl-mixer.h +++ b/backends/mixer/doublebuffersdl/doublebuffersdl-mixer.h @@ -28,10 +28,13 @@ #include "backends/mixer/sdl/sdl-mixer.h" +/** + * SDL mixer manager with double buffering support. + */ class DoubleBufferSDLMixerManager : public SdlMixerManager { public: DoubleBufferSDLMixerManager(); - ~DoubleBufferSDLMixerManager(); + virtual ~DoubleBufferSDLMixerManager(); protected: SDL_mutex *_soundMutex; @@ -44,8 +47,19 @@ protected: uint _soundBufSize; byte *_soundBuffers[2]; + /** + * Handles and swap the sound buffers + */ void mixerProducerThread(); + + /** + * Finish the mixer manager + */ void deinitThreadedMixer(); + + /** + * Callback entry point for the sound thread + */ static int SDLCALL mixerProducerThreadEntry(void *arg); virtual void startAudio(); diff --git a/backends/mixer/sdl/sdl-mixer.h b/backends/mixer/sdl/sdl-mixer.h index f58260fef2..1b3a3543dc 100644 --- a/backends/mixer/sdl/sdl-mixer.h +++ b/backends/mixer/sdl/sdl-mixer.h @@ -34,28 +34,71 @@ #include "sound/mixer_intern.h" +/** + * SDL mixer manager. It wraps the actual implementation + * of the Audio:Mixer used by the engine, and setups + * the SDL audio subsystem and the callback for the + * audio mixer implementation. + */ class SdlMixerManager { public: SdlMixerManager(); virtual ~SdlMixerManager(); + /** + * Initialize and setups the mixer + */ virtual void init(); + /** + * Get the audio mixer implementation + */ Audio::Mixer *getMixer() { return (Audio::Mixer *)_mixer; } // Used by LinuxMoto Port + + /** + * Pauses the audio system + */ virtual void suspendAudio(); + + /** + * Resumes the audio system + */ virtual int resumeAudio(); protected: + /** The mixer implementation */ Audio::MixerImpl *_mixer; + + /** + * The obtained audio specification after opening the + * audio system. + */ SDL_AudioSpec _obtainedRate; + + /** State of the audio system */ bool _audioSuspended; + /** + * Returns the desired audio specification + */ virtual SDL_AudioSpec getAudioSpec(); + + /** + * Starts SDL audio + */ virtual void startAudio(); + /** + * Handles the audio callback + */ virtual void callbackHandler(byte *samples, int len); + + /** + * The mixer callback entry point. Static functions can't be overrided + * by subclasses, so it invokes the non-static function callbackHandler() + */ static void sdlCallback(void *this_, byte *samples, int len); }; diff --git a/backends/mixer/symbiansdl/symbiansdl-mixer.h b/backends/mixer/symbiansdl/symbiansdl-mixer.h index e809bd4cd0..6a0d281b1a 100644 --- a/backends/mixer/symbiansdl/symbiansdl-mixer.h +++ b/backends/mixer/symbiansdl/symbiansdl-mixer.h @@ -28,18 +28,21 @@ #include "backends/mixer/sdl/sdl-mixer.h" +/** + * SDL mixer manager for Symbian + */ class SymbianSdlMixerManager : public SdlMixerManager { public: SymbianSdlMixerManager(); - ~SymbianSdlMixerManager(); + virtual ~SymbianSdlMixerManager(); - void init(); + virtual void init(); protected: int _channels; byte *_stereo_mix_buffer; - void callbackHandler(byte *samples, int len); + virtual void callbackHandler(byte *samples, int len); }; #endif |