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

LibAudio: Support 32 and 64-bit float WAV files

LibAudio's WavLoader plugin for loading WAV files now supports loading
audio files with 32-bit float or 64-bit float samples.

By supporting these new non-int sample formats, Audio::Buffer now stores
the sample format (out of a list of supported formats) instead of the
raw bit depth. (The bit depth is easily calculated with
pcm_bits_per_sample)
This commit is contained in:
kleines Filmröllchen 2021-04-26 17:13:04 +02:00 committed by Andreas Kling
parent 91c210c39a
commit 563cc17a50
5 changed files with 127 additions and 35 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018-2020, the SerenityOS developers.
* Copyright (c) 2018-2021, the SerenityOS developers.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@ -33,7 +33,7 @@ public:
virtual int total_samples() = 0;
virtual u32 sample_rate() = 0;
virtual u16 num_channels() = 0;
virtual u16 bits_per_sample() = 0;
virtual PcmSampleFormat pcm_format() = 0;
virtual RefPtr<Core::File> file() = 0;
};
@ -62,7 +62,7 @@ public:
int total_samples() const { return m_plugin ? m_plugin->total_samples() : 0; }
u32 sample_rate() const { return m_plugin ? m_plugin->sample_rate() : 0; }
u16 num_channels() const { return m_plugin ? m_plugin->num_channels() : 0; }
u16 bits_per_sample() const { return m_plugin ? m_plugin->bits_per_sample() : 0; }
u16 bits_per_sample() const { return m_plugin ? pcm_bits_per_sample(m_plugin->pcm_format()) : 0; }
RefPtr<Core::File> file() const { return m_plugin ? m_plugin->file() : nullptr; }
private: