forked from MoonsideGames/FAudioGMS
fix effect sends
parent
5a7f98944c
commit
ee6214d06d
|
@ -244,7 +244,7 @@ typedef struct FAudioGMS_Device
|
|||
FAudioDeviceDetails deviceDetails;
|
||||
FAudioMasteringVoice *masteringVoice;
|
||||
|
||||
FAudioGMS_Voice fauxMasteringVoice;
|
||||
FAudioGMS_Voice fauxMasteringVoice;
|
||||
|
||||
F3DAUDIO_LISTENER listener;
|
||||
float spatialDistanceScale;
|
||||
|
@ -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;
|
||||
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(
|
||||
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;
|
||||
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].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);
|
||||
|
||||
|
@ -1629,7 +1644,7 @@ void FAudioGMS_SetMasteringEffectChain(double effectChainID, double effectGain)
|
|||
{
|
||||
RETURN_ON_NULL_DEVICE()
|
||||
FAudioGMS_EffectChain* effectChain = FAudioGMS_INTERNAL_LookupEffectChain((uint32_t)effectChainID);
|
||||
|
||||
|
||||
if (effectChain != NULL)
|
||||
{
|
||||
FAudioGMS_INTERNAL_SetEffectChain(&device->fauxMasteringVoice, effectChain, 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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue