AudioReaderXmp class
#include <nCine/Audio/AudioReaderXmp.h>
Audio reader for tracker module formats, backed by libxmp.
The lightweight alternative to AudioReaderMpt for platforms where libopenmpt is not real-time-viable (the classic Amiga above all - where a tracker player is also the native idiom). libxmp covers everything the game's soundtrack ships: .it, .mod, .s3m, .xm and, through its Galaxy Music System loaders, the original .j2b modules.
Unlike libopenmpt's pull-from-stream interface, libxmp wants the whole file up front, so the module (at most a few hundred KB) is read into memory once at load; that also keeps the per-frame render free of file I/O, which matters on the slow-storage machines this exists for.
Base classes
- class IAudioReader
- Interface for an audio reader.
Constructors, destructors, conversion operators
-
AudioReaderXmp(std::
unique_ptr<Death:: IO:: Stream> fileHandle, std:: int32_t frequency) - ~AudioReaderXmp()
- AudioReaderXmp(const AudioReaderXmp&) deleted
Public functions
- auto operator=(const AudioReaderXmp&) -> AudioReaderXmp& deleted
-
auto read(void* buffer,
std::
int32_t bufferSize) const -> std:: int32_t override - Decodes audio data into the specified buffer.
- void rewind() const override
- Rewinds the reader back to the beginning.
- void setLooping(bool value) override
- Enables native stream looping if the format supports it.
Function documentation
std:: int32_t nCine:: AudioReaderXmp:: read(void* buffer,
std:: int32_t bufferSize) const override
Decodes audio data into the specified buffer.
| Parameters | |
|---|---|
| buffer | Destination buffer |
| bufferSize | Buffer size in bytes |
| Returns | Number of bytes actually written |