attach reverb

main
cosmonaut 2021-01-19 22:06:23 -08:00
parent ec28d17a75
commit ec09a5952b
2 changed files with 8 additions and 3 deletions

View File

@ -16,7 +16,7 @@ namespace MoonWorks.Audio
public float DopplerScale = 1f;
public float SpeedOfSound = 343.5f;
private FAudio.FAudioVoiceSends reverbSends;
internal FAudio.FAudioVoiceSends ReverbSends;
private readonly List<WeakReference<DynamicSoundInstance>> dynamicSoundInstances = new List<WeakReference<DynamicSoundInstance>>();
@ -180,14 +180,14 @@ namespace MoonWorks.Audio
/* Init reverb sends */
reverbSends = new FAudio.FAudioVoiceSends
ReverbSends = new FAudio.FAudioVoiceSends
{
SendCount = 2,
pSends = Marshal.AllocHGlobal(
2 * Marshal.SizeOf<FAudio.FAudioSendDescriptor>()
)
};
FAudio.FAudioSendDescriptor* sendDesc = (FAudio.FAudioSendDescriptor*) reverbSends.pSends;
FAudio.FAudioSendDescriptor* sendDesc = (FAudio.FAudioSendDescriptor*) ReverbSends.pSends;
sendDesc[0].Flags = 0;
sendDesc[0].pOutputVoice = MasteringVoice;
sendDesc[1].Flags = 0;

View File

@ -198,6 +198,11 @@ namespace MoonWorks.Audio
Handle = handle;
this.is3D = is3D;
InitDSPSettings(Parent.Format.nChannels);
FAudio.FAudioVoice_SetOutputVoices(
handle,
ref Device.ReverbSends
);
}
private void InitDSPSettings(uint srcChannels)