summaryrefslogtreecommitdiff
path: root/Kernel/Devices/Audio
diff options
context:
space:
mode:
authorJelle Raaijmakers <jelle@gmta.nl>2022-02-26 19:20:07 +0100
committerAndreas Kling <kling@serenityos.org>2022-02-26 20:23:15 +0100
commit8bf0e04c1629dcecf68035bb94a036b29b918005 (patch)
tree3cb212b2e235c74a318052aa64138468b31d6e9b /Kernel/Devices/Audio
parente2891e9aa4fd6466305d0b4047b2ae0db044e533 (diff)
downloadserenity-8bf0e04c1629dcecf68035bb94a036b29b918005.zip
Kernel: Allow setting AC'97 sample rate during playback
The Qemu AC'97 device stops its PCM channel's DMA engine when it is running and the sample rate is changed. We now make sure the DMA engine is restarted after changing the sample rate, allowing you to e.g. run `asctl set r 22050` during `aplay` playback.
Diffstat (limited to 'Kernel/Devices/Audio')
-rw-r--r--Kernel/Devices/Audio/AC97.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/Kernel/Devices/Audio/AC97.cpp b/Kernel/Devices/Audio/AC97.cpp
index 09dca53a56..68f7c51420 100644
--- a/Kernel/Devices/Audio/AC97.cpp
+++ b/Kernel/Devices/Audio/AC97.cpp
@@ -145,6 +145,10 @@ ErrorOr<void> AC97::set_pcm_output_sample_rate(u32 sample_rate)
dbgln("AC97 @ {}: PCM front DAC rate set to {} Hz", pci_address(), m_sample_rate);
+ // Setting the sample rate stops a running DMA engine, so restart it
+ if (m_pcm_out_channel.dma_running())
+ m_pcm_out_channel.start_dma();
+
return {};
}