From 009e6bcd1b4d55f511fc947d2d029f3f68b50d5d Mon Sep 17 00:00:00 2001 From: merry Date: Fri, 20 Jan 2023 20:46:13 +0000 Subject: Audio: Implement PCM24 output (#4321) --- .../Backends/CompatLayer/CompatLayerHardwareDeviceDriver.cs | 7 +++++-- .../Backends/CompatLayer/CompatLayerHardwareDeviceSession.cs | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'Ryujinx.Audio/Backends') diff --git a/Ryujinx.Audio/Backends/CompatLayer/CompatLayerHardwareDeviceDriver.cs b/Ryujinx.Audio/Backends/CompatLayer/CompatLayerHardwareDeviceDriver.cs index 1eedfa66..22919f1e 100644 --- a/Ryujinx.Audio/Backends/CompatLayer/CompatLayerHardwareDeviceDriver.cs +++ b/Ryujinx.Audio/Backends/CompatLayer/CompatLayerHardwareDeviceDriver.cs @@ -75,9 +75,12 @@ namespace Ryujinx.Audio.Backends.CompatLayer return SampleFormat.PcmFloat; } - // TODO: Implement PCM24 conversion. + if (_realDriver.SupportsSampleFormat(SampleFormat.PcmInt24)) + { + return SampleFormat.PcmInt24; + } - // If nothing is truly supported, attempt PCM8 at the cost of loosing quality. + // If nothing is truly supported, attempt PCM8 at the cost of losing quality. if (_realDriver.SupportsSampleFormat(SampleFormat.PcmInt8)) { return SampleFormat.PcmInt8; diff --git a/Ryujinx.Audio/Backends/CompatLayer/CompatLayerHardwareDeviceSession.cs b/Ryujinx.Audio/Backends/CompatLayer/CompatLayerHardwareDeviceSession.cs index ca6090fe..f22a7a69 100644 --- a/Ryujinx.Audio/Backends/CompatLayer/CompatLayerHardwareDeviceSession.cs +++ b/Ryujinx.Audio/Backends/CompatLayer/CompatLayerHardwareDeviceSession.cs @@ -58,10 +58,13 @@ namespace Ryujinx.Audio.Backends.CompatLayer switch (realSampleFormat) { case SampleFormat.PcmInt8: - PcmHelper.Convert(MemoryMarshal.Cast(convertedSamples), samples); + PcmHelper.ConvertSampleToPcm8(MemoryMarshal.Cast(convertedSamples), samples); + break; + case SampleFormat.PcmInt24: + PcmHelper.ConvertSampleToPcm24(convertedSamples, samples); break; case SampleFormat.PcmInt32: - PcmHelper.Convert(MemoryMarshal.Cast(convertedSamples), samples); + PcmHelper.ConvertSampleToPcm32(MemoryMarshal.Cast(convertedSamples), samples); break; case SampleFormat.PcmFloat: PcmHelper.ConvertSampleToPcmFloat(MemoryMarshal.Cast(convertedSamples), samples); -- cgit v1.2.3