SDL_audiolib 0.0.0
An audio decoding, resampling and mixing library
|
With SDL_audiolib, you can play many forms of audio files in your programs. It uses SDL to access the audio hardware, and uses existing libraries to handle the decoding of various audio formats.
Only mono and stereo output are supported.
As of right now, only a C++ API is provided, and is not finalized yet. That means if you use this, expect API breaking changes every day. A C API will hopefully also be provided in the future.
The provided decoders are:
Aulib::DecoderDrflac - uses built-in dr_flac
It can decode raw FLAC or Ogg/FLAC audio. This decoder is built-in into SDL_audiolib and has no external library dependencies.
Aulib::DecoderDrmp3 - uses built-in dr_mp3
This decoder is built-in into SDL_audiolib and has no external library dependencies.
Aulib::DecoderDrwav - uses built-in dr_wav
This decoder is built-in into SDL_audiolib and has no external library dependencies.
Aulib::DecoderVorbis - uses libvorbis
It can decode Ogg/Vorbis audio.
Aulib::DecoderOpus - uses Opusfile
It can decode Ogg/Opus audio.
Aulib::DecoderFlac - uses libFLAC
It can decode FLAC and Ogg/FLAC audio.
Aulib::DecoderMusepack - uses Musepack SV8
It can decode Musepack audio.
Aulib::DecoderMpg123 - uses libmpg123
It can decode MPEG 1.0/2.0/2.5 for layers 1, 2 and 3. Like MP3, for example.
Aulib::DecoderSndfile - uses libsndfile
It can decode many various audio formats, including FLAC, WAV, AIFF/AIFC, AU/SND, IFF/SVX, VOC, CAF and Ogg/Vorbis.
Note that even though Ogg/Vorbis is supported in this decoder, it is highly recommended to use Aulib::DecoderVorbis instead, since the libsndfile-based decoder does not handle all types of Vorbis audio (streams with sample rate changes in the middle of them, for example.)
Aulib::DecoderOpenmpt - uses libopenmpt
It can render various MOD file formats, like MOD, XM, S3M, IT, etc. This is the recommended decoder for MOD audio files.
Aulib::DecoderXmp - uses libxmp
Similar to OpenMPT. It can render various MOD file formats.
Aulib::DecoderModplug - uses libmodplug
It can render various MOD file formats, like MOD, XM, S3M, IT, etc. Note that libmodplug has been superseded by libopenmpt.
Aulib::DecoderFluidsynth - uses FluidSynth
It can render MIDI files using SoundFont (SF2) instrument files.
Aulib::DecoderBassmidi - uses BASSMIDI
It can render MIDI files using SoundFont (SF2) instrument files.
Aulib::DecoderWildmidi - uses WildMIDI
It can render MIDI files using Gravis Ultrasound patch files.
Aulib::DecoderAdlmidi - uses libADLMIDI
A Yamaha OPL3 (YMF262) emulation library.
If the decoded audio does not match the output sample rate with which the library was initialized, it is resampled using one of the available resamplers:
It uses the Speex resampler from the Opus codec. This resampler is built-in into SDL_audiolib and has no external library dependencies.
It uses the SRC (aka "libsamplerate") resampler.
It uses the SoxR resampler.
It uses the built-in resampling functionality of SDL (through the SDL_AudioStream API) and has no external dependencies. Requires at least SDL 2.0.7.
Usage of the library is fairly simple. To play a music.ogg file containing Vorbis audio and having the audio automatically resampled by the internal resampler to the sample rate that the audio device is opened with (in this case 44.1kHz,) you would do: