fix effect sends

pull/1/head
cosmonaut 2021-11-02 01:45:38 -07:00
parent 5a7f98944c
commit ee6214d06d
1 changed files with 23 additions and 9 deletions

View File

@ -402,10 +402,10 @@ void FAudioGMS_Init(double spatialDistanceScale, double timestep)
if (FAudio_CreateSubmixVoice(
device->handle,
&device->fauxMasteringVoice.handle,
FAUDIO_DEFAULT_CHANNELS,
FAUDIO_DEFAULT_SAMPLERATE,
device->deviceDetails.OutputFormat.Format.nChannels,
device->deviceDetails.OutputFormat.Format.nSamplesPerSec,
0,
0,
i,
&device->fauxMasteringVoice.sends,
NULL
) != 0)
@ -1553,7 +1553,15 @@ static void FAudioGMS_INTERNAL_SetEffectChain(FAudioGMS_Voice* voice, FAudioGMS_
voice->effectSends.pSends = SDL_malloc(sizeof(FAudioSendDescriptor));
voice->effectSends.pSends[0].Flags = 0;
if (voice == &device->fauxMasteringVoice)
{
voice->effectSends.pSends[0].pOutputVoice = device->masteringVoice;
}
else
{
voice->effectSends.pSends[0].pOutputVoice = device->fauxMasteringVoice.handle;
}
FAudio_CreateSubmixVoice(
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 */
voice->sends.pSends[0].Flags = 0;
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].pOutputVoice = voice->effectVoice;
@ -1600,7 +1615,7 @@ static void FAudioGMS_INTERNAL_SetEffectChain(FAudioGMS_Voice* voice, FAudioGMS_
FAudioVoice_SetOutputVoices(
voice->handle,
&voice->effectSends);
&voice->sends);
FAudioGMS_INTERNAL_Voice_SetEffectGain(voice, effectGain);
@ -1789,7 +1804,6 @@ void FAudioGMS_Destroy()
FAudioGMS_INTERNAL_StaticSound_Destroy(device->staticSounds[i]);
}
/* FIXME: FAudioGMS_Voice_Destroy call */
FAudioVoice_DestroyVoice(device->fauxMasteringVoice.handle);
SDL_free(device->fauxMasteringVoice.sends.pSends);