if (channel_ind >= total_channels)
return;
+ // we have to lock an audio mutex to prevent crashes if an audio mixer
+ // thread is currently mixing this channel
+ // the SndSys_LockRenderBuffer function uses such a mutex in
+ // threaded sound backends
+ if (lockmutex)
+ SndSys_LockRenderBuffer();
+
ch = &channels[channel_ind];
if (ch->sfx != NULL)
{
sfx_t *sfx = ch->sfx;
- // we have to lock an audio mutex to prevent crashes if an audio mixer
- // thread is currently mixing this channel
- // the SndSys_LockRenderBuffer function uses such a mutex in
- // threaded sound backends
- if (lockmutex)
- SndSys_LockRenderBuffer();
if (sfx->fetcher != NULL)
{
snd_fetcher_endsb_t fetcher_endsb = sfx->fetcher->endsb;
ch->fetcher_data = NULL;
ch->sfx = NULL;
- if (lockmutex)
- SndSys_UnlockRenderBuffer();
}
+ if (lockmutex)
+ SndSys_UnlockRenderBuffer();
}