SDL_n3dsaudio.c: separate mixer locks from audio device locks

This commit is contained in:
ds-sloth 2023-10-24 19:06:49 -04:00 committed by Sam Lantinga
parent d47c286b12
commit 62266dbd4f

View file

@ -38,6 +38,7 @@ static SDL_AudioDevice *audio_device;
static void FreePrivateData(_THIS);
static int FindAudioFormat(_THIS);
/* fully local functions related to the wavebufs / DSP, not the same as the SDL-wide mixer lock */
static SDL_INLINE void contextLock(_THIS)
{
LightLock_Lock(&this->hidden->lock);
@ -48,16 +49,6 @@ static SDL_INLINE void contextUnlock(_THIS)
LightLock_Unlock(&this->hidden->lock);
}
static void N3DSAUD_LockAudio(_THIS)
{
contextLock(this);
}
static void N3DSAUD_UnlockAudio(_THIS)
{
contextUnlock(this);
}
static void N3DSAUD_DspHook(DSP_HookType hook)
{
if (hook == DSPHOOK_ONCANCEL) {
@ -195,6 +186,7 @@ static void N3DSAUDIO_PlayDevice(_THIS)
{
size_t nextbuf;
size_t sampleLen;
contextLock(this);
nextbuf = this->hidden->nextbuf;
@ -271,8 +263,6 @@ static SDL_bool N3DSAUDIO_Init(SDL_AudioDriverImpl *impl)
impl->GetDeviceBuf = N3DSAUDIO_GetDeviceBuf;
impl->CloseDevice = N3DSAUDIO_CloseDevice;
impl->ThreadInit = N3DSAUDIO_ThreadInit;
impl->LockDevice = N3DSAUD_LockAudio;
impl->UnlockDevice = N3DSAUD_UnlockAudio;
impl->OnlyHasDefaultOutputDevice = SDL_TRUE;
/* Should be possible, but micInit would fail */