Record program sound

the program play music and sounds using the sdl_mixer
is it possible to record the program current played sound and music and to save it to wav/mp3 file?

On Windows ‘Stereo Mix’ is usually one of the sources offered by SDL_GetAudioDeviceName() (although it’s often disabled by default and may need to be enabled in Windows Control Panel) so in that case it’s easy to capture and record the output, either using SDL itself or an independent program.

I believe that feature is not normally offered by other OSes, although there may be third-party utilities that provide something similar. As a last resort you can always loop back the headphone output to the microphone input, but the quality may not be that great and sometimes you’ll only get mono (seems to be stereo on a Mac though).

There is a disk audio driver set by environment variable.

  • SDL_AUDIODRIVER=disk

Additionally, the mixer has a post mix function.