IAudioReader class
#include <nCine/Audio/IAudioReader.h>
Interface for an audio reader.
Decodes audio samples on demand from a file opened by an IAudioLoader. Stream players call Read() repeatedly to refill their buffer queue.
Derived classes
- class AudioReaderMp3
- Audio reader for the MPEG audio format (MP3), backed by
libmpg123. - class AudioReaderMpt
- Audio reader for tracker module formats, backed by
libopenmpt. - class AudioReaderOgg
- Audio reader for the Ogg Vorbis format, backed by
libvorbis. - class AudioReaderWav
- Audio reader for the WAVE (
.wav) format. - class AudioReaderXmp
- Audio reader for tracker module formats, backed by
libxmp.
Constructors, destructors, conversion operators
- ~IAudioReader() virtual
Public functions
-
auto Read(void* buffer,
std::
int32_t bufferSize) const -> std:: int32_t pure virtual - Decodes audio data into the specified buffer.
- void Rewind() const pure virtual
- Rewinds the reader back to the beginning.
- void SetLooping(bool value) virtual
- Enables native stream looping if the format supports it.
Tracker modules
Supported only by readers of tracker modules, the others return false. Safe to call from any thread while another one reads, changes are applied by Read() before the frames it decodes next.
-
auto GetDecodedFrames() const -> std::
int64_t virtual - Returns the number of frames decoded so far, it keeps counting across rewinds.
-
auto GetModuleStateAt(std::
int64_t frame, AudioModuleState& state) const -> bool virtual - Returns the state of the module at a frame already decoded, see GetDecodedFrames().
- auto CanSetModulePosition() const -> bool virtual
- Returns
trueif SetModulePosition() is supported. -
auto SetModulePosition(std::
int32_t order, std:: int32_t row) -> bool virtual - Jumps to a row of a position in the order list.
-
auto SetModuleSpeed(std::
int32_t speed) -> bool virtual - Sets the ticks per row until the module changes them.
-
auto SetModuleTempo(std::
int32_t tempo) -> bool virtual - Sets the tempo until the module changes it.
-
auto SlideModuleChannelVolume(std::
int32_t channel, float volume, std:: int32_t milliseconds) -> bool virtual - Changes the volume of a channel gradually, from its current one to
volumein0.0to1.0.
Function documentation
std:: int32_t nCine:: IAudioReader:: Read(void* buffer,
std:: int32_t bufferSize) const pure virtual
Decodes audio data into the specified buffer.
| Parameters | |
|---|---|
| buffer | Destination buffer |
| bufferSize | Buffer size in bytes |
| Returns | Number of bytes actually written |