SDL Wiki
(This function is part of SDL_mixer, a separate library from SDL.)


Reserve the first channels for the application.

Header File

Defined in <SDL_mixer.h>


int Mix_ReserveChannels(int num);

Function Parameters

int num number of channels to reserve, starting at index zero.

Return Value

(int) Returns the number of reserved channels.


While SDL_mixer will use up to the number of channels allocated by Mix_AllocateChannels(), this sets channels aside that will not be available when calling Mix_PlayChannel with a channel of -1 (play on the first unused channel). In this case, SDL_mixer will treat reserved channels as "used" whether anything is playing on them at the moment or not.

This is useful if you've budgeted some channels for dedicated audio and the rest are just used as they are available.

Calling this function will set channels 0 to n - 1 to be reserved. This will not change channel allocations. The number of reserved channels will be clamped to the current number allocated.

By default, no channels are reserved.


This function is available since SDL_mixer 2.0.0.

CategoryAPI, CategoryAPIFunction

[ 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.