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

Mix_AllocateChannels

Dynamically change the number of channels managed by the mixer.

Header File

Defined in <SDL_mixer.h>

Syntax

int Mix_AllocateChannels(int numchans);

Function Parameters

int numchans the new number of channels, or < 0 to query current channel count.

Return Value

(int) Returns the new number of allocated channels.

Remarks

SDL_mixer deals with "channels," which is not the same thing as the mono/stereo channels; they might be better described as "tracks," as each one corresponds to a separate source of audio data. Three different WAV files playing at the same time would be three separate SDL_mixer channels, for example.

An app needs as many channels as it has audio data it wants to play simultaneously, mixing them into a single stream to send to the audio device.

SDL_mixer allocates MIX_CHANNELS (currently 8) channels when you open an audio device, which may be more than an app needs, but if the app needs more or wants less, this function can change it.

If decreasing the number of channels, any upper channels currently playing are stopped. This will deregister all effects on those channels and call any callback specified by Mix_ChannelFinished() for each removed channel.

If numchans is less than zero, this will return the current number of channels without changing anything.

Version

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.