private uint SelectHardwareChannelCount(uint targetChannelCount) { if (_realDriver.SupportsChannelCount(targetChannelCount)) { return(targetChannelCount); } return(targetChannelCount switch { 6 => SelectHardwareChannelCount(2), 2 => SelectHardwareChannelCount(1), 1 => throw new ArgumentException("No valid channel configuration found!"), _ => throw new ArgumentException($"Invalid targetChannelCount {targetChannelCount}") });
private static uint GetHardwareChannelCount(IHardwareDeviceDriver deviceDriver) { // Get the real device driver (In case the compat layer is on top of it). deviceDriver = deviceDriver.GetRealDeviceDriver(); if (deviceDriver.SupportsChannelCount(6)) { return(6); } else { // NOTE: We default to stereo as this will get downmixed to mono by the compat layer if it's not compatible. return(2); } }