fix voices not respecting the faux mastering voice

remotes/1695061714407202320/main
cosmonaut 2023-08-10 10:46:19 -07:00
parent 1de3c73bb7
commit 7f6b6a7bae
4 changed files with 28 additions and 2 deletions

View File

@ -105,7 +105,7 @@ namespace MoonWorks.Audio
return; return;
} }
fauxMasteringVoice = new SubmixVoice(this, DeviceDetails.OutputFormat.Format.nChannels, DeviceDetails.OutputFormat.Format.nSamplesPerSec, int.MaxValue); fauxMasteringVoice = SubmixVoice.CreateFauxMasteringVoice(this);
/* Init 3D Audio */ /* Init 3D Audio */

View File

@ -69,6 +69,8 @@ namespace MoonWorks.Audio
IntPtr.Zero, // default sends to mastering voice! IntPtr.Zero, // default sends to mastering voice!
IntPtr.Zero IntPtr.Zero
); );
SetOutputVoice(device.MasteringVoice);
} }
/// <summary> /// <summary>

View File

@ -23,9 +23,34 @@ namespace MoonWorks.Audio
sampleRate, sampleRate,
FAudio.FAUDIO_VOICE_USEFILTER, FAudio.FAUDIO_VOICE_USEFILTER,
processingStage, 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, // default sends to mastering voice
IntPtr.Zero IntPtr.Zero
); );
OutputVoice = null;
}
internal static SubmixVoice CreateFauxMasteringVoice(AudioDevice device)
{
return new SubmixVoice(device);
} }
} }
} }

View File

@ -261,7 +261,6 @@ namespace MoonWorks.Audio
{ {
SourceChannelCount = sourceChannelCount; SourceChannelCount = sourceChannelCount;
DestinationChannelCount = destinationChannelCount; DestinationChannelCount = destinationChannelCount;
OutputVoice = device.MasteringVoice;
nuint memsize = 4 * sourceChannelCount * destinationChannelCount; nuint memsize = 4 * sourceChannelCount * destinationChannelCount;
pMatrixCoefficients = (byte*) NativeMemory.AllocZeroed(memsize); pMatrixCoefficients = (byte*) NativeMemory.AllocZeroed(memsize);
SetPanMatrixCoefficients(); SetPanMatrixCoefficients();