add processingStage input to SubmixVoice

pull/50/head
cosmonaut 2023-08-02 22:30:30 -07:00
parent 03b4b5f9a5
commit f81133a5a3
3 changed files with 7 additions and 4 deletions

View File

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

View File

@ -8,7 +8,7 @@ namespace MoonWorks.Audio
/// </summary> /// </summary>
public unsafe class ReverbEffect : SubmixVoice public unsafe class ReverbEffect : SubmixVoice
{ {
public ReverbEffect(AudioDevice audioDevice) : base(audioDevice, 1, audioDevice.DeviceDetails.OutputFormat.Format.nSamplesPerSec) public ReverbEffect(AudioDevice audioDevice, uint processingStage) : base(audioDevice, 1, audioDevice.DeviceDetails.OutputFormat.Format.nSamplesPerSec, processingStage)
{ {
/* Init reverb */ /* Init reverb */
IntPtr reverb; IntPtr reverb;

View File

@ -4,13 +4,16 @@ namespace MoonWorks.Audio
{ {
/// <summary> /// <summary>
/// SourceVoices can send audio to a SubmixVoice for convenient effects processing. /// SourceVoices can send audio to a SubmixVoice for convenient effects processing.
/// Submixes process in order of processingStage, from lowest to highest.
/// Therefore submixes early in a chain should have a low processingStage, and later in the chain they should have a higher one.
/// </summary> /// </summary>
public class SubmixVoice : Voice public class SubmixVoice : Voice
{ {
public SubmixVoice( public SubmixVoice(
AudioDevice device, AudioDevice device,
uint sourceChannelCount, uint sourceChannelCount,
uint sampleRate uint sampleRate,
uint processingStage
) : base(device, sourceChannelCount, device.DeviceDetails.OutputFormat.Format.nChannels) ) : base(device, sourceChannelCount, device.DeviceDetails.OutputFormat.Format.nChannels)
{ {
FAudio.FAudio_CreateSubmixVoice( FAudio.FAudio_CreateSubmixVoice(
@ -19,7 +22,7 @@ namespace MoonWorks.Audio
sourceChannelCount, sourceChannelCount,
sampleRate, sampleRate,
FAudio.FAUDIO_VOICE_USEFILTER, FAudio.FAUDIO_VOICE_USEFILTER,
0, processingStage,
IntPtr.Zero, // default sends to mastering voice IntPtr.Zero, // default sends to mastering voice
IntPtr.Zero IntPtr.Zero
); );