aboutsummaryrefslogtreecommitdiff
path: root/backends/mixer/sdl/sdl-mixer.h
diff options
context:
space:
mode:
Diffstat (limited to 'backends/mixer/sdl/sdl-mixer.h')
-rw-r--r--backends/mixer/sdl/sdl-mixer.h49
1 files changed, 11 insertions, 38 deletions
diff --git a/backends/mixer/sdl/sdl-mixer.h b/backends/mixer/sdl/sdl-mixer.h
index a21dcfd188..2b1272fa92 100644
--- a/backends/mixer/sdl/sdl-mixer.h
+++ b/backends/mixer/sdl/sdl-mixer.h
@@ -34,51 +34,24 @@
#include "sound/mixer_intern.h"
-#if defined(MACOSX)
-// On Mac OS X, we need to double buffer the audio buffer, else anything
-// which produces sampled data with high latency (like the MT-32 emulator)
-// will sound terribly.
-// This could be enabled for more / most ports in the future, but needs some
-// testing.
-#define MIXER_DOUBLE_BUFFERING 1
-#endif
-
-class SdlMixerImpl : public Audio::MixerImpl {
+class SdlMixerManager {
public:
+ SdlMixerManager();
+ ~SdlMixerManager();
+
+ virtual void init();
- SdlMixerImpl(OSystem *system);
- ~SdlMixerImpl();
+ Audio::Mixer *getMixer() { return (Audio::Mixer *)_mixer; }
protected:
+ Audio::MixerImpl *_mixer;
SDL_AudioSpec _obtainedRate;
- bool _openAudio;
-
- uint getSamplesPerSec();
-
- static void mixSdlCallback(void *s, byte *samples, int len);
-#ifdef MIXER_DOUBLE_BUFFERING
- SDL_mutex *_soundMutex;
- SDL_cond *_soundCond;
- SDL_Thread *_soundThread;
- bool _soundThreadIsRunning;
- bool _soundThreadShouldQuit;
+ virtual SDL_AudioSpec getAudioSpec();
+ virtual void startAudio();
- byte _activeSoundBuf;
- uint _soundBufSize;
- byte *_soundBuffers[2];
-
- void mixerProducerThread();
- static int SDLCALL mixerProducerThreadEntry(void *arg);
- void initThreadedMixer(uint bufSize);
- void deinitThreadedMixer();
-
-public:
- SDL_mutex *getSoundMutex() { return _soundMutex; }
- SDL_cond *getSoundCond() { return _soundCond; }
- uint getSoundBufSize() { return _soundBufSize; }
- byte *getActiveSoundBuf() { return _soundBuffers[_activeSoundBuf]; }
-#endif
+ virtual void callbackHandler(byte *samples, int len);
+ static void sdlCallback(void *this_, byte *samples, int len);
};
#endif