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.
This commit is contained in:
Sryder 2018-10-13 23:01:11 +01:00
parent 1b531ddcfe
commit 6184f91dd3
11 changed files with 23 additions and 14 deletions

View File

@ -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;

View File

@ -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;
}

View File

@ -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.

View File

@ -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;
}

View File

@ -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)

View File

@ -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

View File

@ -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;

View File

@ -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

View File

@ -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;

View File

@ -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);

View File

@ -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;