Tao.Sdl SDK Documentation

SdlMixer.Mix_ReserveChannels Method 

Prevent channels from being used in default group

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

Parameters

num
Number of channels to reserve from default mixing. Zero removes all reservations.

Return Value

The number of channels reserved. Never fails, but may return less channels than you ask for, depending on the number of channels previously allocated.

Remarks

Reserve num channels from being used when playing samples when passing in -1 as a channel number to playback functions. The channels are reserved starting from channel 0 to num-1. Passing in zero will unreserve all channels. Normally SDL_mixer starts without any channels reserved.

The following functions are affected by this setting:



Binds to C-function in SDL_mixer.h

int Mix_ReserveChannels(int num)
            

Example

            // reserve the first 8 mixing channels
                    int reserved_count;
                    reserved_count=Mix_ReserveChannels(8);
                    if(reserved_count!=8)
                {
                    printf("reserved %d channels from default mixing.\n",reserved_count);
                    printf("8 channels were not reserved!\n");
                    // this might be a critical error...
                }
            

See Also

SdlMixer Class | Tao.Sdl Namespace | Mix_AllocateChannels