Added MixerThread() to RageSound_Linux to imitate that of RageSoundDriver_WaveOut

This commit is contained in:
Tim Hentenaar
2003-02-20 23:21:55 +00:00
parent 3683d70c0f
commit 62ed523253
2 changed files with 12 additions and 4 deletions
@@ -244,26 +244,33 @@ float RageSound_Linux::GetPlayLatency() const {
RageSound_Linux::RageSound_Linux() {
last_pos = 0;
shutdown = false;
MixerThreadPtr = SDL_CreateThread(MixerThread_start,this);
}
RageSound_Linux::~RageSound_Linux() {
LOG->Trace("RageSoundDriver_Linux::~RageSoundDriver_Linux(): Shutting down mixer thread ...");
shutdown = true;
SDL_WaitThread(MixerThreadPtr, NULL);
LOG->Trace("Mixer thread shut down.");
CloseAudio();
}
void RageSound_Linux::MixerThread() {
;
}
int RageSound_Linux::MixerThread_start(void *p) {
((RageSound_Linux *) p)->MixerThread();
return 0;
}
void RageSound_Linux::MixerThread() {
/* SOUNDMAN will be set once RageSoundManager's ctor returns and
* assigns it; we might get here before that happens, though. */
while(!SOUNDMAN && !shutdown) sleep(10);
while(!shutdown) { while (GetData()); }
}
@@ -35,6 +35,7 @@ class RageSound_Linux : public RageSoundDriver {
Sint16 *chunks[8]; /* chunks of sound buffer */
snd_pcm_t *playback_handle; /* Handle for PCM device */
int last_pos;
bool shutdown;
void RecoverState(long state); /* Recover from various states */