mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-12 11:10:39 +00:00
Change audiolib's SDL driver's mutex stuff to use our implementation
git-svn-id: https://svn.eduke32.com/eduke32@7926 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
1413c7fd5c
commit
128510a6d9
1 changed files with 10 additions and 10 deletions
|
@ -23,10 +23,12 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define NEED_SDL_MIXER
|
#define NEED_SDL_MIXER
|
||||||
#include "compat.h"
|
|
||||||
#include "sdl_inc.h"
|
|
||||||
#include "driver_sdl.h"
|
#include "driver_sdl.h"
|
||||||
|
|
||||||
|
#include "compat.h"
|
||||||
#include "multivoc.h"
|
#include "multivoc.h"
|
||||||
|
#include "mutex.h"
|
||||||
|
#include "sdl_inc.h"
|
||||||
|
|
||||||
#ifdef __ANDROID__
|
#ifdef __ANDROID__
|
||||||
#include "duke3d.h"
|
#include "duke3d.h"
|
||||||
|
@ -57,7 +59,7 @@ static void ( *MixCallBack )( void ) = 0;
|
||||||
static Mix_Chunk *DummyChunk = NULL;
|
static Mix_Chunk *DummyChunk = NULL;
|
||||||
static uint8_t *DummyBuffer = NULL;
|
static uint8_t *DummyBuffer = NULL;
|
||||||
static int32_t InterruptsDisabled = 0;
|
static int32_t InterruptsDisabled = 0;
|
||||||
static SDL_mutex *EffectFence;
|
static mutex_t EffectFence;
|
||||||
|
|
||||||
static void fillData(int chan, void *ptr, int remaining, void *udata)
|
static void fillData(int chan, void *ptr, int remaining, void *udata)
|
||||||
{
|
{
|
||||||
|
@ -70,7 +72,7 @@ static void fillData(int chan, void *ptr, int remaining, void *udata)
|
||||||
if (!MixBuffer || !MixCallBack)
|
if (!MixBuffer || !MixCallBack)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SDL_LockMutex(EffectFence);
|
mutex_lock(&EffectFence);
|
||||||
|
|
||||||
while (remaining > 0) {
|
while (remaining > 0) {
|
||||||
if (MixBufferUsed == MixBufferSize) {
|
if (MixBufferUsed == MixBufferSize) {
|
||||||
|
@ -99,7 +101,7 @@ static void fillData(int chan, void *ptr, int remaining, void *udata)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_UnlockMutex(EffectFence);
|
mutex_unlock(&EffectFence);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -203,7 +205,7 @@ int32_t SDLDrv_PCM_Init(int32_t *mixrate, int32_t *numchannels, void * initdata)
|
||||||
|
|
||||||
//Mix_SetPostMix(fillData, NULL);
|
//Mix_SetPostMix(fillData, NULL);
|
||||||
|
|
||||||
EffectFence = SDL_CreateMutex();
|
mutex_init(&EffectFence);
|
||||||
|
|
||||||
// channel 0 and 1 are actual sounds
|
// channel 0 and 1 are actual sounds
|
||||||
// dummy channel 2 runs our fillData() callback as an effect
|
// dummy channel 2 runs our fillData() callback as an effect
|
||||||
|
@ -236,8 +238,6 @@ void SDLDrv_PCM_Shutdown(void)
|
||||||
|
|
||||||
Mix_CloseAudio();
|
Mix_CloseAudio();
|
||||||
|
|
||||||
SDL_DestroyMutex(EffectFence);
|
|
||||||
|
|
||||||
if (StartedSDL > 0) {
|
if (StartedSDL > 0) {
|
||||||
SDL_QuitSubSystem(SDL_INIT_AUDIO);
|
SDL_QuitSubSystem(SDL_INIT_AUDIO);
|
||||||
} else if (StartedSDL == 0) {
|
} else if (StartedSDL == 0) {
|
||||||
|
@ -293,7 +293,7 @@ void SDLDrv_PCM_Lock(void)
|
||||||
if (InterruptsDisabled++)
|
if (InterruptsDisabled++)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SDL_LockMutex(EffectFence);
|
mutex_lock(&EffectFence);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SDLDrv_PCM_Unlock(void)
|
void SDLDrv_PCM_Unlock(void)
|
||||||
|
@ -301,5 +301,5 @@ void SDLDrv_PCM_Unlock(void)
|
||||||
if (--InterruptsDisabled)
|
if (--InterruptsDisabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SDL_UnlockMutex(EffectFence);
|
mutex_unlock(&EffectFence);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue