diff --git a/src/Audio/AudioDevice.cs b/src/Audio/AudioDevice.cs index 7e5ad822..62129a8b 100644 --- a/src/Audio/AudioDevice.cs +++ b/src/Audio/AudioDevice.cs @@ -105,7 +105,7 @@ namespace MoonWorks.Audio return; } - fauxMasteringVoice = new SubmixVoice(this, DeviceDetails.OutputFormat.Format.nChannels, DeviceDetails.OutputFormat.Format.nSamplesPerSec, int.MaxValue); + fauxMasteringVoice = SubmixVoice.CreateFauxMasteringVoice(this); /* Init 3D Audio */ diff --git a/src/Audio/SourceVoice.cs b/src/Audio/SourceVoice.cs index dfe91892..5e4efeca 100644 --- a/src/Audio/SourceVoice.cs +++ b/src/Audio/SourceVoice.cs @@ -69,6 +69,8 @@ namespace MoonWorks.Audio IntPtr.Zero, // default sends to mastering voice! IntPtr.Zero ); + + SetOutputVoice(device.MasteringVoice); } /// diff --git a/src/Audio/SubmixVoice.cs b/src/Audio/SubmixVoice.cs index ae64e9f8..3edf650a 100644 --- a/src/Audio/SubmixVoice.cs +++ b/src/Audio/SubmixVoice.cs @@ -23,9 +23,34 @@ namespace MoonWorks.Audio sampleRate, FAudio.FAUDIO_VOICE_USEFILTER, processingStage, + IntPtr.Zero, + IntPtr.Zero + ); + + SetOutputVoice(device.MasteringVoice); + } + + private SubmixVoice( + AudioDevice device + ) : base(device, device.DeviceDetails.OutputFormat.Format.nChannels, device.DeviceDetails.OutputFormat.Format.nChannels) + { + FAudio.FAudio_CreateSubmixVoice( + device.Handle, + out handle, + device.DeviceDetails.OutputFormat.Format.nChannels, + device.DeviceDetails.OutputFormat.Format.nSamplesPerSec, + FAudio.FAUDIO_VOICE_USEFILTER, + int.MaxValue, IntPtr.Zero, // default sends to mastering voice IntPtr.Zero ); + + OutputVoice = null; + } + + internal static SubmixVoice CreateFauxMasteringVoice(AudioDevice device) + { + return new SubmixVoice(device); } } } diff --git a/src/Audio/Voice.cs b/src/Audio/Voice.cs index c5870a4a..e5bba154 100644 --- a/src/Audio/Voice.cs +++ b/src/Audio/Voice.cs @@ -261,7 +261,6 @@ namespace MoonWorks.Audio { SourceChannelCount = sourceChannelCount; DestinationChannelCount = destinationChannelCount; - OutputVoice = device.MasteringVoice; nuint memsize = 4 * sourceChannelCount * destinationChannelCount; pMatrixCoefficients = (byte*) NativeMemory.AllocZeroed(memsize); SetPanMatrixCoefficients();