From 6184f91dd3bd82164282c7379d457ffcea5e5a8c Mon Sep 17 00:00:00 2001 From: Sryder Date: Sat, 13 Oct 2018 23:01:11 +0100 Subject: [PATCH] Add an int to I_PlaySound to tell an interface which channel number SRB2 is using. I've voided this out on other sound interfaces than SDL Mixer ones because I'm both not sure whether they need it, and not sure how to make them work with it if they do. --- src/djgppdos/i_sound.c | 4 +++- src/dummy/i_sound.c | 3 ++- src/i_sound.h | 2 +- src/nds/i_sound.c | 3 ++- src/s_sound.c | 4 ++-- src/sdl/mixer_sound.c | 4 ++-- src/sdl/sdl_sound.c | 3 ++- src/sdl12/mixer_sound.c | 4 ++-- src/sdl12/sdl_sound.c | 3 ++- src/win32/win_snd.c | 3 ++- src/win32ce/win_snd.c | 4 +++- 11 files changed, 23 insertions(+), 14 deletions(-) diff --git a/src/djgppdos/i_sound.c b/src/djgppdos/i_sound.c index 88fc807f4..f1e2ad2bf 100644 --- a/src/djgppdos/i_sound.c +++ b/src/djgppdos/i_sound.c @@ -165,9 +165,11 @@ INT32 I_StartSound ( sfxenum_t id, INT32 vol, INT32 sep, INT32 pitch, - INT32 priority ) + INT32 priority + INT32 channel) { int voice; + (void)channel; if (nosound) return 0; diff --git a/src/dummy/i_sound.c b/src/dummy/i_sound.c index 51dbb610d..143da186c 100644 --- a/src/dummy/i_sound.c +++ b/src/dummy/i_sound.c @@ -23,13 +23,14 @@ void I_UpdateSound(void){}; // SFX I/O // -INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority) +INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority, INT32 channel) { (void)id; (void)vol; (void)sep; (void)pitch; (void)priority; + (void)channel; return -1; } diff --git a/src/i_sound.h b/src/i_sound.h index 084479ee1..098c9be17 100644 --- a/src/i_sound.h +++ b/src/i_sound.h @@ -64,7 +64,7 @@ void I_ShutdownSound(void); \return sfx handle */ -INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority); +INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority, INT32 channel); /** \brief Stops a sound channel. diff --git a/src/nds/i_sound.c b/src/nds/i_sound.c index 8dea4ad7d..a17c7f66a 100644 --- a/src/nds/i_sound.c +++ b/src/nds/i_sound.c @@ -21,13 +21,14 @@ void I_ShutdownSound(void){} // SFX I/O // -INT32 I_StartSound(sfxenum_t id, INT32 vol, INT32 sep, INT32 pitch, INT32 priority) +INT32 I_StartSound(sfxenum_t id, INT32 vol, INT32 sep, INT32 pitch, INT32 priority, INT32 channel) { (void)id; (void)vol; (void)sep; (void)pitch; (void)priority; + (void)channel; return -1; } diff --git a/src/s_sound.c b/src/s_sound.c index 76ee4c649..3b35b36f6 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -529,7 +529,7 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume) // Assigns the handle to one of the channels in the // mix/output buffer. - channels[cnum].handle = I_StartSound(sfx_id, volume, sep, pitch, priority); + channels[cnum].handle = I_StartSound(sfx_id, volume, sep, pitch, priority, cnum); } dontplay: @@ -579,7 +579,7 @@ dontplay: // Assigns the handle to one of the channels in the // mix/output buffer. - channels[cnum].handle = I_StartSound(sfx_id, volume, sep, pitch, priority); + channels[cnum].handle = I_StartSound(sfx_id, volume, sep, pitch, priority, cnum); } void S_StartSound(const void *origin, sfxenum_t sfx_id) diff --git a/src/sdl/mixer_sound.c b/src/sdl/mixer_sound.c index cfdb32303..4b4ad3e62 100644 --- a/src/sdl/mixer_sound.c +++ b/src/sdl/mixer_sound.c @@ -419,10 +419,10 @@ void I_FreeSfx(sfxinfo_t *sfx) sfx->lumpnum = LUMPERROR; } -INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority) +INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority, INT32 channel) { UINT8 volume = (((UINT16)vol + 1) * (UINT16)sfx_volume) / 62; // (256 * 31) / 62 == 127 - INT32 handle = Mix_PlayChannel(-1, S_sfx[id].data, 0); + INT32 handle = Mix_PlayChannel(channel, S_sfx[id].data, 0); Mix_Volume(handle, volume); Mix_SetPanning(handle, min((UINT16)(0xff-sep)<<1, 0xff), min((UINT16)(sep)<<1, 0xff)); (void)pitch; // Mixer can't handle pitch diff --git a/src/sdl/sdl_sound.c b/src/sdl/sdl_sound.c index 6c70c163b..a7c8383a3 100644 --- a/src/sdl/sdl_sound.c +++ b/src/sdl/sdl_sound.c @@ -604,10 +604,11 @@ void I_FreeSfx(sfxinfo_t * sfx) // Pitching (that is, increased speed of playback) // is set, but currently not used by mixing. // -INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority) +INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority, INT32 channel) { (void)priority; (void)pitch; + (void)channel; if (nosound) return 0; diff --git a/src/sdl12/mixer_sound.c b/src/sdl12/mixer_sound.c index 542a67169..daf09ab91 100644 --- a/src/sdl12/mixer_sound.c +++ b/src/sdl12/mixer_sound.c @@ -376,10 +376,10 @@ void I_FreeSfx(sfxinfo_t *sfx) sfx->data = NULL; } -INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority) +INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority, INT32 channel) { UINT8 volume = (((UINT16)vol + 1) * (UINT16)sfx_volume) / 62; // (256 * 31) / 62 == 127 - INT32 handle = Mix_PlayChannel(-1, S_sfx[id].data, 0); + INT32 handle = Mix_PlayChannel(channel, S_sfx[id].data, 0); Mix_Volume(handle, volume); Mix_SetPanning(handle, min((UINT16)(0xff-sep)<<1, 0xff), min((UINT16)(sep)<<1, 0xff)); (void)pitch; // Mixer can't handle pitch diff --git a/src/sdl12/sdl_sound.c b/src/sdl12/sdl_sound.c index 6ba83104e..01a27153e 100644 --- a/src/sdl12/sdl_sound.c +++ b/src/sdl12/sdl_sound.c @@ -621,10 +621,11 @@ void I_FreeSfx(sfxinfo_t * sfx) // Pitching (that is, increased speed of playback) // is set, but currently not used by mixing. // -INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority) +INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority, INT32 channel) { (void)priority; (void)pitch; + (void)channel; if (nosound) return 0; diff --git a/src/win32/win_snd.c b/src/win32/win_snd.c index 58644457a..e50a4737e 100644 --- a/src/win32/win_snd.c +++ b/src/win32/win_snd.c @@ -353,12 +353,13 @@ void I_FreeSfx(sfxinfo_t *sfx) sfx->data = NULL; } -INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority) +INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority, INT32 channel) { FMOD_SOUND *sound; FMOD_CHANNEL *chan; INT32 i; float frequency; + (void)channel; sound = (FMOD_SOUND *)S_sfx[id].data; I_Assert(sound != NULL); diff --git a/src/win32ce/win_snd.c b/src/win32ce/win_snd.c index f9c652178..a58bbc3ce 100644 --- a/src/win32ce/win_snd.c +++ b/src/win32ce/win_snd.c @@ -538,7 +538,8 @@ INT32 I_StartSound (sfxenum_t id, INT32 vol, INT32 sep, INT32 pitch, - INT32 priority) + INT32 priority + INT32 channel) { HRESULT hr; LPDIRECTSOUNDBUFFER dsbuffer; @@ -549,6 +550,7 @@ INT32 I_StartSound (sfxenum_t id, #ifdef SURROUND LPDIRECTSOUNDBUFFER dssurround; #endif + (void)channel; if (nosound) return -1;