1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 03:37:45 +00:00

Kernel: Set audio sample rate to 44.1 KHz by default

Ideally, we would want the audio controller to run a channel at a
device's initial sample rate instead of hardcoding 44.1 KHz. However,
most audio is provided at 44.1 KHz and as long as `Audio::Resampler`
introduces significant audio artifacts, let's set a sensible sample
rate that offers a better experience for most users.

This can be removed after someone implements a higher quality
`Audio::Resampler`.
This commit is contained in:
Jelle Raaijmakers 2023-06-19 21:13:39 +02:00 committed by Andreas Kling
parent 2133bae1a4
commit 4a86861a9d
2 changed files with 11 additions and 3 deletions

View file

@ -86,8 +86,6 @@ UNMAP_AFTER_INIT ErrorOr<void> AC97::initialize(Badge<AudioManagement>)
dbgln_if(AC97_DEBUG, "AC97 @ {}: mixer base: {:#04x}", device_identifier().address(), m_mixer_io_window);
dbgln_if(AC97_DEBUG, "AC97 @ {}: bus base: {:#04x}", device_identifier().address(), m_bus_io_window);
m_audio_channel = TRY(AudioChannel::create(*this, 0));
// Read out AC'97 codec revision and vendor
auto extended_audio_id = m_mixer_io_window->read16(NativeAudioMixerRegister::ExtendedAudioID);
m_codec_revision = static_cast<AC97Revision>(((extended_audio_id & ExtendedAudioMask::Revision) >> 10) & 0b11);
@ -133,6 +131,8 @@ UNMAP_AFTER_INIT ErrorOr<void> AC97::initialize(Badge<AudioManagement>)
m_pcm_out_channel->reset();
enable_irq();
m_audio_channel = TRY(AudioChannel::create(*this, 0));
return {};
}