IAudioLoader class
#include <nCine/Audio/IAudioLoader.h>
Interface for an audio loader.
Opens an audio file and reads its format. Use CreateFromFile() or CreateFromStream(), then CreateReader() to decode the samples.
Derived classes
- class AudioLoaderMp3
- Audio loader for the MPEG audio format (MP3), backed by
libmpg123. - class AudioLoaderMpt
- Audio loader for tracker module formats, backed by
libopenmpt. - class AudioLoaderOgg
- Audio loader for the Ogg Vorbis format, backed by
libvorbis. - class AudioLoaderWav
- Audio loader for the WAVE (
.wav) format. - class AudioLoaderXmp
- Audio loader for tracker module formats, backed by
libxmp(see AudioReaderXmp).
Public static functions
-
static auto CreateFromFile(const Death::
Containers:: StringView path) -> std:: unique_ptr<IAudioLoader> - Creates the loader matching the extension of the specified file.
-
static auto CreateFromStream(std::
unique_ptr<Death:: IO:: Stream> fileHandle, Death:: Containers:: StringView path) -> std:: unique_ptr<IAudioLoader> - Creates the loader matching the specified file for an already opened stream.
Constructors, destructors, conversion operators
- ~IAudioLoader() virtual
-
IAudioLoader(std::
unique_ptr<Death:: IO:: Stream> fileHandle) protected explicit
Public functions
- auto HasLoaded() const -> bool
- Returns
trueif the audio file was loaded successfully. -
auto GetBytesPerSample() const -> std::
int32_t - Returns the number of bytes per sample.
-
auto GetChannelCount() const -> std::
int32_t - Returns the number of channels.
-
auto GetFrequency() const -> std::
int32_t - Returns the sample frequency.
-
auto GetSampleCount() const -> std::
int32_t - Returns the total number of samples.
- auto GetDuration() const -> float
- Returns the duration in seconds.
-
auto GetBufferSize() const -> std::
int32_t - Returns the decoded buffer size in bytes.
-
auto CreateReader() -> std::
unique_ptr<IAudioReader> pure virtual - Creates the audio reader matching this loader.
Protected static functions
-
static auto CreateLoader(std::
unique_ptr<Death:: IO:: Stream> fileHandle, Death:: Containers:: StringView path) -> std:: unique_ptr<IAudioLoader>