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

LibAudio: Modernize WAV loader

With this, the WAV loader is a completely modern LibAudio loader:
- Own type header for RIFF data structures
- custom stream read functions for the types
- Final removal of legacy I/O error checking
- clearer error messages
- clean handling of header chunks

The latter will allow proper handling of other chunks (before "data") in
the future, such as metadata :^)
This commit is contained in:
kleines Filmröllchen 2023-03-15 22:44:32 +01:00 committed by Jelle Raaijmakers
parent 830a3a25dc
commit 70970b2fa9
5 changed files with 163 additions and 112 deletions

View file

@ -17,14 +17,10 @@
namespace Audio {
// constants for handling the WAV header data
static constexpr unsigned const WAVE_FORMAT_PCM = 0x0001; // PCM
static constexpr unsigned const WAVE_FORMAT_IEEE_FLOAT = 0x0003; // IEEE float
static constexpr unsigned const WAVE_FORMAT_ALAW = 0x0006; // 8-bit ITU-T G.711 A-law
static constexpr unsigned const WAVE_FORMAT_MULAW = 0x0007; // 8-bit ITU-T G.711 µ-law
static constexpr unsigned const WAVE_FORMAT_EXTENSIBLE = 0xFFFE; // Determined by SubFormat
// Parses and reads audio data from a WAV file.
// Loader for the WAVE (file extension .wav) uncompressed audio file format.
// WAVE uses the Microsoft RIFF container.
// Original RIFF Spec, without later extensions: https://www.aelius.com/njh/wavemetatools/doc/riffmci.pdf
// More concise WAVE information plus various spec links: http://www-mmsp.ece.mcgill.ca/Documents/AudioFormats/WAVE/WAVE.html
class WavLoaderPlugin : public LoaderPlugin {
public:
explicit WavLoaderPlugin(NonnullOwnPtr<SeekableStream> stream);