|
utility 2026.1.9
A comprehensive C++ utilities library tailored for the development of modern desktop and extended reality (XR) applications.
|
Decoder implementation for MPEG Audio Layer III (MP3) files. More...
#include <headers/utility/sound/decoder/mp3_decoder.hpp>


Public Member Functions | |
| MP3Decoder () | |
| Creates an MP3 decoder instance. | |
| ~MP3Decoder () override | |
| Destroys the MP3 decoder instance. | |
| bool | canDecode (const std::string &filePath) const override |
| Determines whether the specified file can be decoded. | |
| bool | canDecode (AudioDecoderType type) const override |
| Determines whether the specified decoder type is supported. | |
| std::shared_ptr< AudioBuffer > | decode (std::shared_ptr< utility::File > file) override |
| Decodes an MP3 file into an AudioBuffer. | |
Public Member Functions inherited from utility::sound::AAudioDecoder | |
| virtual | ~AAudioDecoder ()=default |
| Virtual destructor. | |
| ALenum | getALFormat (uint16_t channels, uint16_t bitsPerSample) const |
| Converts audio properties to an OpenAL format. | |
Decoder implementation for MPEG Audio Layer III (MP3) files.
MP3Decoder uses the dr_mp3 library to decode MP3-encoded audio data into raw Pulse-Code Modulation (PCM) samples compatible with OpenAL.
Decoded audio samples are converted to 16-bit PCM format and uploaded to an AudioBuffer instance for playback.
Definition at line 40 of file mp3_decoder.hpp.
| utility::sound::MP3Decoder::MP3Decoder | ( | ) |
Creates an MP3 decoder instance.
Definition at line 33 of file mp3_decoder.cpp.

|
override |
Destroys the MP3 decoder instance.
Definition at line 38 of file mp3_decoder.cpp.

|
overridevirtual |
Determines whether the specified decoder type is supported.
| type | Audio decoder type to test. |
Implements utility::sound::AAudioDecoder.
Definition at line 50 of file mp3_decoder.cpp.
|
overridevirtual |
Determines whether the specified file can be decoded.
Compatibility is determined from the file extension.
| filePath | Path to the audio file. |
Implements utility::sound::AAudioDecoder.
Definition at line 43 of file mp3_decoder.cpp.
|
overridevirtual |
Decodes an MP3 file into an AudioBuffer.
The encoded audio stream is decoded into 16-bit PCM samples and uploaded to an AudioBuffer for playback.
| file | The file containing MP3-encoded audio data. |
Implements utility::sound::AAudioDecoder.
Definition at line 56 of file mp3_decoder.cpp.