Tao.Sdl SDK Documentation

SdlMixer.Mix_AllocateChannels Method 

Dynamically change the number of channels managed by the mixer. If decreasing the number of channels, the upper channels are stopped.

This function returns the new number of allocated channels.

[Visual Basic]
Public Shared Function Mix_AllocateChannels( _
   ByVal numchans As Integer _
) As Integer
[C#]
public static int Mix_AllocateChannels(
   int numchans
);

Parameters

numchans
Number of channels to allocate for mixing. A negative number will not do anything, it will tell you how many channels are currently allocated.

Return Value

The number of channels allocated. Never fails...but a high number of channels can segfault if you run out of memory. We're talking REALLY high!

Remarks

Set the number of channels being mixed. This can be called multiple times, even with sounds playing. If numchans is less than the current number of channels, then the higher channels will be stopped, freed, and therefore not mixed any longer. It's probably not a good idea to change the size 1000 times a second though. If any channels are deallocated, any callback set by Mix_ChannelFinished will be called when each channel is halted to be freed. Note: passing in zero WILL free all mixing channels, however music will still play.

Example

            // allocate 16 mixing channels
            Mix_AllocateChannels(16);
            

See Also

SdlMixer Class | Tao.Sdl Namespace | Mix_OpenAudio