using System.Diagnostics; namespace Ryujinx.Audio.Renderer.Device { /// /// Represents a virtual device used by IAudioDevice. /// public class VirtualDevice { /// /// All the defined virtual devices. /// public static readonly VirtualDevice[] Devices = new VirtualDevice[5] { new VirtualDevice("AudioStereoJackOutput", 2, true), new VirtualDevice("AudioBuiltInSpeakerOutput", 2, false), new VirtualDevice("AudioTvOutput", 6, false), new VirtualDevice("AudioUsbDeviceOutput", 2, true), new VirtualDevice("AudioExternalOutput", 6, true), }; /// /// The name of the . /// public string Name { get; } /// /// The count of channels supported by the . /// public uint ChannelCount { get; } /// /// The system master volume of the . /// public float MasterVolume { get; private set; } /// /// Define if the is provided by an external interface. /// public bool IsExternalOutput { get; } /// /// Create a new instance. /// /// The name of the . /// The count of channels supported by the . /// Indicate if the is provided by an external interface. public VirtualDevice(string name, uint channelCount, bool isExternalOutput) { Name = name; ChannelCount = channelCount; IsExternalOutput = isExternalOutput; } /// /// Update the master volume of the . /// /// The new master volume. public void UpdateMasterVolume(float volume) { Debug.Assert(volume >= 0.0f && volume <= 1.0f); MasterVolume = volume; } /// /// Check if the is a usb device. /// /// Returns true if the is a usb device. public bool IsUsbDevice() { return Name.Equals("AudioUsbDeviceOutput"); } /// /// Get the output device name of the . /// /// The output device name of the . public string GetOutputDeviceName() { if (IsExternalOutput) { return "AudioExternalOutput"; } return Name; } } }