Commit d54194b6 authored by Richard Gobeille's avatar Richard Gobeille
Browse files

audiolib: add useCallBack parameter to FX_StopSound() and FX_StopAllSounds()...

audiolib: add useCallBack parameter to FX_StopSound() and FX_StopAllSounds() (and, by extension, MV_Kill() and MV_KillAllVoices())
parent 7721f0c0
......@@ -135,8 +135,8 @@ static FORCE_INLINE int FX_Pan3D(int handle, int angle, int distance)
static FORCE_INLINE int FX_SoundActive(int handle) { return MV_VoicePlaying(handle); }
static FORCE_INLINE int FX_SoundValidAndActive(int handle) { return handle > 0 && MV_VoicePlaying(handle); }
static FORCE_INLINE int FX_SoundsPlaying(void) { return MV_VoicesPlaying(); }
static FORCE_INLINE int FX_StopSound(int handle) { return FX_CheckMVErr(MV_Kill(handle)); }
static FORCE_INLINE int FX_StopAllSounds(void) { return FX_CheckMVErr(MV_KillAllVoices()); }
static FORCE_INLINE int FX_StopSound(int handle, bool useCallBack = true) { return FX_CheckMVErr(MV_Kill(handle, useCallBack)); }
static FORCE_INLINE int FX_StopAllSounds(bool useCallBack = true) { return FX_CheckMVErr(MV_KillAllVoices(useCallBack)); }
#ifdef __cplusplus
}
......
......@@ -86,8 +86,8 @@ static FORCE_INLINE void MV_Unlock(void)
}
int MV_VoicePlaying(int handle);
int MV_KillAllVoices(void);
int MV_Kill(int handle);
int MV_KillAllVoices(bool useCallBack = true);
int MV_Kill(int handle, bool useCallBack = true);
int MV_VoicesPlaying(void);
int MV_VoiceAvailable(int priority);
int MV_SetPitch(int handle, int pitchoffset);
......
......@@ -52,7 +52,7 @@ int MV_XMPInterpolation = XMP_INTERP_NEAREST;
#endif
static void MV_StopVoice(VoiceNode *voice);
static void MV_StopVoice(VoiceNode *voice, bool useCallBack = true);
static void MV_ServiceVoc(void);
static VoiceNode *MV_GetVoice(int handle);
......@@ -206,9 +206,9 @@ static void MV_FreeHandle(VoiceNode* voice)
LL::Move(voice, &VoicePool);
}
static void MV_CleanupVoice(VoiceNode* voice)
static void MV_CleanupVoice(VoiceNode* voice, bool useCallBack = true)
{
if (MV_CallBackFunc)
if (useCallBack && MV_CallBackFunc)
MV_CallBackFunc(voice->callbackval);
switch (voice->wavetype)
......@@ -231,9 +231,9 @@ static void MV_CleanupVoice(VoiceNode* voice)
}
}
static void MV_StopVoice(VoiceNode *voice)
void MV_StopVoice(VoiceNode *voice, bool useCallBack)
{
MV_CleanupVoice(voice);
MV_CleanupVoice(voice, useCallBack);
MV_Lock();
// move the voice from the play list to the free list
MV_FreeHandle(voice);
......@@ -380,7 +380,7 @@ int MV_VoicePlaying(int handle)
return MV_Installed && voice != nullptr && !voice->Paused.load(std::memory_order_relaxed);
}
int MV_KillAllVoices(void)
int MV_KillAllVoices(bool useCallBack)
{
if (!MV_Installed)
return MV_Error;
......@@ -404,7 +404,7 @@ int MV_KillAllVoices(void)
continue;
}
MV_Kill(voice->handle);
MV_Kill(voice->handle, useCallBack);
voice = VoiceList.prev;
}
......@@ -413,14 +413,14 @@ int MV_KillAllVoices(void)
return MV_Ok;
}
int MV_Kill(int handle)
int MV_Kill(int handle, bool useCallBack)
{
auto voice = MV_BeginService(handle);
if (voice == nullptr)
return MV_Error;
MV_StopVoice(voice);
MV_StopVoice(voice, useCallBack);
MV_EndService();
return MV_Ok;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment