fix effect sends
parent
d3d9d4fe3f
commit
025d8f4d97
|
@ -244,7 +244,7 @@ typedef struct FAudioGMS_Device
|
||||||
FAudioDeviceDetails deviceDetails;
|
FAudioDeviceDetails deviceDetails;
|
||||||
FAudioMasteringVoice *masteringVoice;
|
FAudioMasteringVoice *masteringVoice;
|
||||||
|
|
||||||
FAudioGMS_Voice fauxMasteringVoice;
|
FAudioGMS_Voice fauxMasteringVoice;
|
||||||
|
|
||||||
F3DAUDIO_LISTENER listener;
|
F3DAUDIO_LISTENER listener;
|
||||||
float spatialDistanceScale;
|
float spatialDistanceScale;
|
||||||
|
@ -402,10 +402,10 @@ void FAudioGMS_Init(double spatialDistanceScale, double timestep)
|
||||||
if (FAudio_CreateSubmixVoice(
|
if (FAudio_CreateSubmixVoice(
|
||||||
device->handle,
|
device->handle,
|
||||||
&device->fauxMasteringVoice.handle,
|
&device->fauxMasteringVoice.handle,
|
||||||
FAUDIO_DEFAULT_CHANNELS,
|
device->deviceDetails.OutputFormat.Format.nChannels,
|
||||||
FAUDIO_DEFAULT_SAMPLERATE,
|
device->deviceDetails.OutputFormat.Format.nSamplesPerSec,
|
||||||
|
0,
|
||||||
0,
|
0,
|
||||||
i,
|
|
||||||
&device->fauxMasteringVoice.sends,
|
&device->fauxMasteringVoice.sends,
|
||||||
NULL
|
NULL
|
||||||
) != 0)
|
) != 0)
|
||||||
|
@ -1553,7 +1553,15 @@ static void FAudioGMS_INTERNAL_SetEffectChain(FAudioGMS_Voice* voice, FAudioGMS_
|
||||||
voice->effectSends.pSends = SDL_malloc(sizeof(FAudioSendDescriptor));
|
voice->effectSends.pSends = SDL_malloc(sizeof(FAudioSendDescriptor));
|
||||||
|
|
||||||
voice->effectSends.pSends[0].Flags = 0;
|
voice->effectSends.pSends[0].Flags = 0;
|
||||||
voice->effectSends.pSends[0].pOutputVoice = device->fauxMasteringVoice.handle;
|
|
||||||
|
if (voice == &device->fauxMasteringVoice)
|
||||||
|
{
|
||||||
|
voice->effectSends.pSends[0].pOutputVoice = device->masteringVoice;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
voice->effectSends.pSends[0].pOutputVoice = device->fauxMasteringVoice.handle;
|
||||||
|
}
|
||||||
|
|
||||||
FAudio_CreateSubmixVoice(
|
FAudio_CreateSubmixVoice(
|
||||||
device->handle,
|
device->handle,
|
||||||
|
@ -1592,7 +1600,14 @@ static void FAudioGMS_INTERNAL_SetEffectChain(FAudioGMS_Voice* voice, FAudioGMS_
|
||||||
|
|
||||||
/* Set the instance voice to go through both faux mastering and effect voice for wet/dry */
|
/* Set the instance voice to go through both faux mastering and effect voice for wet/dry */
|
||||||
voice->sends.pSends[0].Flags = 0;
|
voice->sends.pSends[0].Flags = 0;
|
||||||
voice->sends.pSends[0].pOutputVoice = device->fauxMasteringVoice.handle;
|
if (voice == &device->fauxMasteringVoice)
|
||||||
|
{
|
||||||
|
voice->sends.pSends[0].pOutputVoice = device->masteringVoice;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
voice->sends.pSends[0].pOutputVoice = device->fauxMasteringVoice.handle;
|
||||||
|
}
|
||||||
voice->sends.pSends[1].Flags = 0;
|
voice->sends.pSends[1].Flags = 0;
|
||||||
voice->sends.pSends[1].pOutputVoice = voice->effectVoice;
|
voice->sends.pSends[1].pOutputVoice = voice->effectVoice;
|
||||||
|
|
||||||
|
@ -1600,7 +1615,7 @@ static void FAudioGMS_INTERNAL_SetEffectChain(FAudioGMS_Voice* voice, FAudioGMS_
|
||||||
|
|
||||||
FAudioVoice_SetOutputVoices(
|
FAudioVoice_SetOutputVoices(
|
||||||
voice->handle,
|
voice->handle,
|
||||||
&voice->effectSends);
|
&voice->sends);
|
||||||
|
|
||||||
FAudioGMS_INTERNAL_Voice_SetEffectGain(voice, effectGain);
|
FAudioGMS_INTERNAL_Voice_SetEffectGain(voice, effectGain);
|
||||||
|
|
||||||
|
@ -1629,7 +1644,7 @@ void FAudioGMS_SetMasteringEffectChain(double effectChainID, double effectGain)
|
||||||
{
|
{
|
||||||
RETURN_ON_NULL_DEVICE()
|
RETURN_ON_NULL_DEVICE()
|
||||||
FAudioGMS_EffectChain* effectChain = FAudioGMS_INTERNAL_LookupEffectChain((uint32_t)effectChainID);
|
FAudioGMS_EffectChain* effectChain = FAudioGMS_INTERNAL_LookupEffectChain((uint32_t)effectChainID);
|
||||||
|
|
||||||
if (effectChain != NULL)
|
if (effectChain != NULL)
|
||||||
{
|
{
|
||||||
FAudioGMS_INTERNAL_SetEffectChain(&device->fauxMasteringVoice, effectChain, effectGain);
|
FAudioGMS_INTERNAL_SetEffectChain(&device->fauxMasteringVoice, effectChain, effectGain);
|
||||||
|
@ -1789,7 +1804,6 @@ void FAudioGMS_Destroy()
|
||||||
FAudioGMS_INTERNAL_StaticSound_Destroy(device->staticSounds[i]);
|
FAudioGMS_INTERNAL_StaticSound_Destroy(device->staticSounds[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: FAudioGMS_Voice_Destroy call */
|
|
||||||
FAudioVoice_DestroyVoice(device->fauxMasteringVoice.handle);
|
FAudioVoice_DestroyVoice(device->fauxMasteringVoice.handle);
|
||||||
SDL_free(device->fauxMasteringVoice.sends.pSends);
|
SDL_free(device->fauxMasteringVoice.sends.pSends);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue