diff options
author | Jelle Raaijmakers <jelle@gmta.nl> | 2022-02-26 19:20:07 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-02-26 20:23:15 +0100 |
commit | 8bf0e04c1629dcecf68035bb94a036b29b918005 (patch) | |
tree | 3cb212b2e235c74a318052aa64138468b31d6e9b /Kernel | |
parent | e2891e9aa4fd6466305d0b4047b2ae0db044e533 (diff) | |
download | serenity-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')
-rw-r--r-- | Kernel/Devices/Audio/AC97.cpp | 4 |
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 {}; } |