Tao.Sdl SDK Documentation |
|
SdlMixer.Mix_PlayChannel Method
Play loop.
[Visual Basic]
Public Shared Function Mix_PlayChannel( _
ByVal
channel As
Integer, _
ByVal
chunk As
IntPtr, _
ByVal
loops As
Integer _
) As
Integer
[C#]
public static
int Mix_PlayChannel(
int channel,
IntPtr chunk,
int loops);
Parameters
-
channel
- Channel to play on, or -1 for the first free unreserved channel.
-
chunk
- Sample to play.
-
loops
- Number of loops, -1 is infinite loops. Passing one here plays the sample twice (1 loop).
Return Value
the channel the sample is played on. On any errors, -1 is returned.
Remarks
Play chunk on channel, or if channel is -1, pick the first free unreserved channel. The sample will play for loops+1 number of times, unless stopped by halt, or fade out, or setting a new expiration time of less time than it would have originally taken to play the loops, or closing the mixer.
Note: this just calls Mix_PlayChannelTimed() with ticks set to -1.
Binds to C-function in SDL_mixer.h
int Mix_PlayChannel(int channel, Mix_Chunk *chunk, int loops)
Example
// play sample on first free unreserved channel
// play it exactly once through
// Mix_Chunk *sample; //previously loaded
if(Mix_PlayChannel(-1, sample, 1)==-1)
{
printf("Mix_PlayChannel: %s\n",Mix_GetError());
// may be critical error, or maybe just no channels were free.
// you could allocated another channel in that case...
}
See Also
SdlMixer Class | Tao.Sdl Namespace | Mix_PlayChannelTimed | Mix_FadeInChannel | Mix_HaltChannel | Mix_ExpireChannel | Mix_ReserveChannels