|
utility 2026.1.9
A comprehensive C++ utilities library tailored for the development of modern desktop and extended reality (XR) applications.
|
Abstract base class for audio decoders. More...
#include <headers/utility/sound/decoder/audio_decoder.hpp>

Public Member Functions | |
| virtual | ~AAudioDecoder ()=default |
| Virtual destructor. | |
| virtual bool | canDecode (const std::string &filePath) const =0 |
| Determines whether the decoder supports the specified file. | |
| virtual bool | canDecode (AudioDecoderType type=AudioDecoderType::UNKNOWN) const =0 |
| Determines whether the decoder supports the specified audio type. | |
| virtual std::shared_ptr< AudioBuffer > | decode (std::shared_ptr< utility::File > file)=0 |
| Decodes an audio file into an AudioBuffer. | |
| ALenum | getALFormat (uint16_t channels, uint16_t bitsPerSample) const |
| Converts audio properties to an OpenAL format. | |
Abstract base class for audio decoders.
This class defines the common interface for decoding audio files into AudioBuffer objects that can be played through the audio subsystem.
Concrete implementations are responsible for:
Supported formats are identified either by file path or by AudioDecoderType.
Definition at line 123 of file audio_decoder.hpp.
|
pure virtual |
Determines whether the decoder supports the specified audio type.
| type | The audio format to test. |
Implemented in utility::sound::MP3Decoder, and utility::sound::WAVDecoder.
|
pure virtual |
Determines whether the decoder supports the specified file.
Implementations typically inspect the file extension or file contents to determine compatibility.
| filePath | Path to the audio file. |
Implemented in utility::sound::MP3Decoder, and utility::sound::WAVDecoder.
|
pure virtual |
Decodes an audio file into an AudioBuffer.
This function reads the specified file, decodes its audio content, uploads the decoded samples to an AudioBuffer, and returns the resulting buffer.
| file | The file containing the encoded audio data. |
| std::runtime_error | If decoding fails or the file format is invalid. |
Implemented in utility::sound::MP3Decoder, and utility::sound::WAVDecoder.
| ALenum utility::sound::AAudioDecoder::getALFormat | ( | uint16_t | channels, |
| uint16_t | bitsPerSample | ||
| ) | const |
Converts audio properties to an OpenAL format.
This helper function maps the specified channel count and sample size to the corresponding OpenAL format enumeration.
| channels | Number of audio channels. |
| bitsPerSample | Number of bits per sample. |
| std::runtime_error | If the specified format is unsupported. |
Definition at line 24 of file audio_decoder.cpp.