2023-07-31 08:16:19 +00:00
|
|
|
using System;
|
|
|
|
|
|
|
|
namespace MoonWorks.Audio
|
|
|
|
{
|
2023-08-03 01:26:27 +00:00
|
|
|
/// <summary>
|
|
|
|
/// SourceVoices can send audio to a SubmixVoice for convenient effects processing.
|
2023-08-03 05:30:30 +00:00
|
|
|
/// 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.
|
2023-08-03 01:26:27 +00:00
|
|
|
/// </summary>
|
2023-08-02 01:13:17 +00:00
|
|
|
public class SubmixVoice : Voice
|
2023-07-31 08:16:19 +00:00
|
|
|
{
|
|
|
|
public SubmixVoice(
|
|
|
|
AudioDevice device,
|
2023-08-01 18:22:49 +00:00
|
|
|
uint sourceChannelCount,
|
2023-08-03 05:30:30 +00:00
|
|
|
uint sampleRate,
|
|
|
|
uint processingStage
|
2023-08-01 18:22:49 +00:00
|
|
|
) : base(device, sourceChannelCount, device.DeviceDetails.OutputFormat.Format.nChannels)
|
2023-07-31 08:16:19 +00:00
|
|
|
{
|
|
|
|
FAudio.FAudio_CreateSubmixVoice(
|
|
|
|
device.Handle,
|
2023-08-01 18:22:49 +00:00
|
|
|
out handle,
|
|
|
|
sourceChannelCount,
|
2023-07-31 08:16:19 +00:00
|
|
|
sampleRate,
|
2023-08-02 21:39:42 +00:00
|
|
|
FAudio.FAUDIO_VOICE_USEFILTER,
|
2023-08-03 05:30:30 +00:00
|
|
|
processingStage,
|
2023-08-01 18:22:49 +00:00
|
|
|
IntPtr.Zero, // default sends to mastering voice
|
2023-07-31 08:16:19 +00:00
|
|
|
IntPtr.Zero
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|