Mixer
micro::audio::mixer is the SDL_mixer audio device. It opens the default
system playback device and is the single point through which all audio is
rendered — every sound you create is attached to a mixer, and the mixer
blends all active tracks together into one continuous output stream.
Most programs create exactly one mixer for the lifetime of the application. Creating more than one opens additional independent audio devices, resulting in multiple overlapping output streams — almost certainly not what you want.
Include <micro/audio.hpp> to use the audio module.
Setup
#include <micro/audio.hpp>
micro::audio::mixer mix; // opens default playback device
SDL_mixer is initialised by micro::init() and shut down by micro::quit()
alongside SDL itself.
Master gain
mix.set_gain(0.5f); // half volume for all tracks
float v = mix.gain(); // returns 1.0f by default
1.0f is full volume, 0.0f is silence. Values above 1.0f amplify beyond
the original level.