From f97c9a5968f35f2e365c1878991299e001fe3166 Mon Sep 17 00:00:00 2001 From: Jelle Raaijmakers Date: Wed, 24 Nov 2021 12:20:20 +0100 Subject: Kernel: Allow higher audio sample rates than 65kHZ (`u16`) Executing `asctl set r 96000` no longer results in weird sample rates being set on the audio devices. SB16 checks for a sample rate between 1 and 44100 Hz, while AC97 implements double-rate support which allows sample rates between 8kHz and 96kHZ. --- Kernel/Devices/Audio/SB16.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'Kernel/Devices/Audio/SB16.cpp') diff --git a/Kernel/Devices/Audio/SB16.cpp b/Kernel/Devices/Audio/SB16.cpp index e5bfef119d..ce2cdc8d63 100644 --- a/Kernel/Devices/Audio/SB16.cpp +++ b/Kernel/Devices/Audio/SB16.cpp @@ -123,9 +123,10 @@ ErrorOr SB16::ioctl(OpenFileDescription&, unsigned request, Userspace(arg.ptr()); - if (sample_rate_value == 0) - return EINVAL; + auto sample_rate_input = static_cast(arg.ptr()); + if (sample_rate_input == 0 || sample_rate_input > 44100) + return ENOTSUP; + auto sample_rate_value = static_cast(sample_rate_input); if (m_sample_rate != sample_rate_value) set_sample_rate(sample_rate_value); return {}; -- cgit v1.2.3