44 lines
829 B
C#
44 lines
829 B
C#
using System;
|
|
|
|
namespace MoonWorks.Audio
|
|
{
|
|
public class MasteringVoice : Voice, IReceivableVoice
|
|
{
|
|
internal static bool Create(
|
|
AudioDevice device,
|
|
uint deviceIndex,
|
|
out MasteringVoice masteringVoice
|
|
) {
|
|
var result = FAudio.FAudio_CreateMasteringVoice(
|
|
device.Handle,
|
|
out var handle,
|
|
FAudio.FAUDIO_DEFAULT_CHANNELS,
|
|
FAudio.FAUDIO_DEFAULT_SAMPLERATE,
|
|
0,
|
|
deviceIndex,
|
|
IntPtr.Zero
|
|
);
|
|
|
|
if (result == 0)
|
|
{
|
|
masteringVoice = new MasteringVoice(device, handle);
|
|
}
|
|
else
|
|
{
|
|
Logger.LogError("Failed to create mastering voice!");
|
|
masteringVoice = null;
|
|
}
|
|
|
|
return result == 0;
|
|
}
|
|
|
|
internal MasteringVoice(
|
|
AudioDevice device,
|
|
IntPtr handle
|
|
) : base(device, device.DeviceDetails.OutputFormat.Format.nChannels, 0)
|
|
{
|
|
this.handle = handle;
|
|
}
|
|
}
|
|
}
|