SDL Wiki

If you want to paste this into a text editor that can't handle the fancy Unicode section headers, try using QuickReferenceNoUnicode instead.

// SDL3_mixer API Quick Reference
//
// https://libsdl.org/
//
// The latest version of this document can be found at https://wiki.libsdl.org/SDL3_mixer/QuickReference
// Based on SDL_mixer version 3.0.0
//
// This can be useful in an IDE with search and syntax highlighting.
//
// Original idea for this document came from Dan Bechard (thanks!)
// ASCII art generated by: https://patorjk.com/software/taag/#p=display&f=ANSI%20Shadow (with modified 'S' for readability)


//  ██████╗ ██████╗  ██╗      ███╗   ███╗ ██╗ ██╗  ██╗ ███████╗ ██████╗ 
// ██╔════╝ ██╔══██╗ ██║      ████╗ ████║ ██║ ╚██╗██╔╝ ██╔════╝ ██╔══██╗
// ███████╗ ██║  ██║ ██║      ██╔████╔██║ ██║  ╚███╔╝  █████╗   ██████╔╝
// ╚════██║ ██║  ██║ ██║      ██║╚██╔╝██║ ██║  ██╔██╗  ██╔══╝   ██╔══██╗
// ██████╔╝ ██████╔╝ ███████╗ ██║ ╚═╝ ██║ ██║ ██╔╝ ██╗ ███████╗ ██║  ██║
// ╚═════╝  ╚═════╝  ╚══════╝ ╚═╝     ╚═╝ ╚═╝ ╚═╝  ╚═╝ ╚══════╝ ╚═╝  ╚═╝

#define SDL_MIXER_MAJOR_VERSION                                                           // Printable format: "%d.%d.%d", MAJOR, MINOR, MICRO
#define SDL_MIXER_VERSION                                                                 // This is the version number macro for the current SDL_mixer version.
#define SDL_MIXER_VERSION_ATLEAST(X, Y, Z)                                                // This macro will evaluate to true if compiled with SDL_mixer at least X.Y.Z.
int Mix_Version(void);                                                                    // This function gets the version of the dynamically linked SDL_mixer library.
MIX_InitFlags Mix_Init(MIX_InitFlags flags);                                              // Initialize SDL_mixer.
void Mix_Quit(void);                                                                      // Deinitialize SDL_mixer.
bool Mix_OpenAudio(SDL_AudioDeviceID devid, const SDL_AudioSpec *spec);                   // Open an audio device for playback.
void Mix_PauseAudio(int pause_on);                                                        // Suspend or resume the whole audio output.
bool Mix_QuerySpec(int *frequency, SDL_AudioFormat *format, int *channels);               // Find out what the actual audio device parameters are.
int Mix_AllocateChannels(int numchans);                                                   // Dynamically change the number of channels managed by the mixer.
Mix_Chunk * Mix_LoadWAV_IO(SDL_IOStream *src, bool closeio);                              // Load a supported audio format into a chunk.
Mix_Chunk * Mix_LoadWAV(const char *file);                                                // Load a supported audio format into a chunk.
Mix_Music * Mix_LoadMUS(const char *file);                                                // Load a supported audio format into a music object.
Mix_Music * Mix_LoadMUS_IO(SDL_IOStream *src, bool closeio);                              // Load a supported audio format into a music object.
Mix_Music * Mix_LoadMUSType_IO(SDL_IOStream *src, Mix_MusicType type, bool closeio);      // Load an audio format into a music object, assuming a specific format.
Mix_Chunk * Mix_QuickLoad_WAV(Uint8 *mem);                                                // Load a WAV file from memory as quickly as possible.
Mix_Chunk * Mix_QuickLoad_RAW(Uint8 *mem, Uint32 len);                                    // Load a raw audio data from memory as quickly as possible.
void Mix_FreeChunk(Mix_Chunk *chunk);                                                     // Free an audio chunk.
void Mix_FreeMusic(Mix_Music *music);                                                     // Free a music object.
int Mix_GetNumChunkDecoders(void);                                                        // Get a list of chunk decoders that this build of SDL_mixer provides.
const char * Mix_GetChunkDecoder(int index);                                              // Get a chunk decoder's name.
bool Mix_HasChunkDecoder(const char *name);                                               // Check if a chunk decoder is available by name.
int Mix_GetNumMusicDecoders(void);                                                        // Get a list of music decoders that this build of SDL_mixer provides.
const char * Mix_GetMusicDecoder(int index);                                              // Get a music decoder's name.
bool Mix_HasMusicDecoder(const char *name);                                               // Check if a music decoder is available by name.
Mix_MusicType Mix_GetMusicType(const Mix_Music *music);                                   // Find out the format of a mixer music.
const char * Mix_GetMusicTitle(const Mix_Music *music);                                   // Get the title for a music object, or its filename.
const char * Mix_GetMusicTitleTag(const Mix_Music *music);                                // Get the title for a music object.
const char * Mix_GetMusicArtistTag(const Mix_Music *music);                               // Get the artist name for a music object.
const char * Mix_GetMusicAlbumTag(const Mix_Music *music);                                // Get the album name for a music object.
const char * Mix_GetMusicCopyrightTag(const Mix_Music *music);                            // Get the copyright text for a music object.
void Mix_SetPostMix(Mix_MixCallback mix_func, void *arg);                                 // Set a function that is called after all mixing is performed.
void Mix_HookMusic(Mix_MixCallback mix_func, void *arg);                                  // Add your own music player or additional mixer function.
void Mix_HookMusicFinished(Mix_MusicFinishedCallback music_finished);                     // Set a callback that runs when a music object has stopped playing.
void * Mix_GetMusicHookData(void);                                                        // Get a pointer to the user data for the current music hook.
void Mix_ChannelFinished(Mix_ChannelFinishedCallback channel_finished);                   // Set a callback that runs when a channel has finished playing.
#define MIX_CHANNEL_POST                                                                  // Magic number for effects to operate on the postmix instead of a channel.
bool Mix_RegisterEffect(int chan, Mix_EffectFunc_t f, Mix_EffectDone_t d, void *arg);     // Register a special effect function.
bool Mix_UnregisterEffect(int channel, Mix_EffectFunc_t f);                               // Explicitly unregister a special effect function.
bool Mix_UnregisterAllEffects(int channel);                                               // Explicitly unregister all special effect functions.
#define MIX_EFFECTSMAXSPEED                                                               // Environment variable that makes some mixing effects favor speed over quality.
bool Mix_SetPanning(int channel, Uint8 left, Uint8 right);                                // Set the panning of a channel.
bool Mix_SetPosition(int channel, Sint16 angle, Uint8 distance);                          // Set the position of a channel.
bool Mix_SetDistance(int channel, Uint8 distance);                                        // Set the "distance" of a channel.
bool Mix_SetReverseStereo(int channel, int flip);                                         // Cause a channel to reverse its stereo.
int Mix_ReserveChannels(int num);                                                         // Reserve the first channels for the application.
bool Mix_GroupChannel(int which, int tag);                                                // Assign a tag to a channel.
bool Mix_GroupChannels(int from, int to, int tag);                                        // Assign several consecutive channels to the same tag.
int Mix_GroupAvailable(int tag);                                                          // Finds the first available channel in a group of channels.
int Mix_GroupCount(int tag);                                                              // Returns the number of channels in a group.
int Mix_GroupOldest(int tag);                                                             // Find the "oldest" sample playing in a group of channels.
int Mix_GroupNewer(int tag);                                                              // Find the "most recent" sample playing in a group of channels.
int Mix_PlayChannel(int channel, Mix_Chunk *chunk, int loops);                            // Play an audio chunk on a specific channel.
int Mix_PlayChannelTimed(int channel, Mix_Chunk *chunk, int loops, int ticks);            // Play an audio chunk on a specific channel for a maximum time.
bool Mix_PlayMusic(Mix_Music *music, int loops);                                          // Play a new music object.
bool Mix_FadeInMusic(Mix_Music *music, int loops, int ms);                                // Play a new music object, fading in the audio.
bool Mix_FadeInMusicPos(Mix_Music *music, int loops, int ms, double position);            // Play a new music object, fading in the audio, from a starting position.
int Mix_FadeInChannel(int channel, Mix_Chunk *chunk, int loops, int ms);                  // Play an audio chunk on a specific channel, fading in the audio.
int Mix_FadeInChannelTimed(int channel, Mix_Chunk *chunk, int loops, int ms, int ticks);  // Play an audio chunk on a specific channel, fading in the audio, for a maximum time.
int Mix_Volume(int channel, int volume);                                                  // Set the volume for a specific channel.
int Mix_VolumeChunk(Mix_Chunk *chunk, int volume);                                        // Set the volume for a specific chunk.
int Mix_VolumeMusic(int volume);                                                          // Set the volume for the music channel.
int Mix_GetMusicVolume(Mix_Music *music);                                                 // Query the current volume value for a music object.
int Mix_MasterVolume(int volume);                                                         // Set the master volume for all channels.
void Mix_HaltChannel(int channel);                                                        // Halt playing of a particular channel.
void Mix_HaltGroup(int tag);                                                              // Halt playing of a group of channels by arbitrary tag.
void Mix_HaltMusic(void);                                                                 // Halt playing of the music stream.
int Mix_ExpireChannel(int channel, int ticks);                                            // Change the expiration delay for a particular channel.
int Mix_FadeOutChannel(int which, int ms);                                                // Halt a channel after fading it out for a specified time.
int Mix_FadeOutGroup(int tag, int ms);                                                    // Halt a playing group of channels by arbitrary tag, after fading them out for a specified time.
bool Mix_FadeOutMusic(int ms);                                                            // Halt the music stream after fading it out for a specified time.
Mix_Fading Mix_FadingMusic(void);                                                         // Query the fading status of the music stream.
Mix_Fading Mix_FadingChannel(int which);                                                  // Query the fading status of a channel.
void Mix_Pause(int channel);                                                              // Pause a particular channel.
void Mix_PauseGroup(int tag);                                                             // Pause playing of a group of channels by arbitrary tag.
void Mix_Resume(int channel);                                                             // Resume a particular channel.
void Mix_ResumeGroup(int tag);                                                            // Resume playing of a group of channels by arbitrary tag.
int Mix_Paused(int channel);                                                              // Query whether a particular channel is paused.
void Mix_PauseMusic(void);                                                                // Pause the music stream.
void Mix_ResumeMusic(void);                                                               // Resume the music stream.
void Mix_RewindMusic(void);                                                               // Rewind the music stream.
bool Mix_PausedMusic(void);                                                               // Query whether the music stream is paused.
bool Mix_ModMusicJumpToOrder(int order);                                                  // Jump to a given order in mod music.
bool Mix_StartTrack(Mix_Music *music, int track);                                         // Start a track in music object.
int Mix_GetNumTracks(Mix_Music *music);                                                   // Get number of tracks in music object.
bool Mix_SetMusicPosition(double position);                                               // Set the current position in the music stream, in seconds.
double Mix_GetMusicPosition(Mix_Music *music);                                            // Get the time current position of music stream, in seconds.
double Mix_MusicDuration(Mix_Music *music);                                               // Get a music object's duration, in seconds.
double Mix_GetMusicLoopStartTime(Mix_Music *music);                                       // Get the loop start time position of music stream, in seconds.
double Mix_GetMusicLoopEndTime(Mix_Music *music);                                         // Get the loop end time position of music stream, in seconds.
double Mix_GetMusicLoopLengthTime(Mix_Music *music);                                      // Get the loop time length of music stream, in seconds.
int Mix_Playing(int channel);                                                             // Check the playing status of a specific channel.
bool Mix_PlayingMusic(void);                                                              // Check the playing status of the music stream.
bool Mix_SetSoundFonts(const char *paths);                                                // Set SoundFonts paths to use by supported MIDI backends.
const char * Mix_GetSoundFonts(void);                                                     // Get SoundFonts paths to use by supported MIDI backends.
bool Mix_EachSoundFont(Mix_EachSoundFontCallback function, void *data);                   // Iterate SoundFonts paths to use by supported MIDI backends.
bool Mix_SetTimidityCfg(const char *path);                                                // Set full path of the Timidity config file.
const char * Mix_GetTimidityCfg(void);                                                    // Get full path of a previously-specified Timidity config file.
Mix_Chunk * Mix_GetChunk(int channel);                                                    // Get the Mix_Chunk currently associated with a mixer channel.
void Mix_CloseAudio(void);                                                                // Close the mixer, halting all playing audio.

[ edit | delete | history | feedback | raw ]

[ front page | index | search | recent changes | git repo | offline html ]

All wiki content is licensed under Creative Commons Attribution 4.0 International (CC BY 4.0).
Wiki powered by ghwikipp.