Tao.Sdl SDK Documentation |
|
SdlMixer.Mix_PlayMusic Method
Play music, with looping
[Visual Basic]
Public Shared Function Mix_PlayMusic( _
ByVal
music As
IntPtr, _
ByVal
loops As
Integer _
) As
Integer
[C#]
public static
int Mix_PlayMusic(
IntPtr music,
int loops);
Parameters
-
music
- Pointer to Mix_Music to play.
-
loops
- number of times to play through the music.
Return Value
0 on success, or -1 on errors.
Remarks
Play the loaded music loop times through from start to finish. The previous music will be halted, or if fading out it waits (blocking) for that to finish.
Binds to C-function in SDL_mixer.h
int Mix_PlayMusic(Mix_Music *music, int loops)
Example
// play music forever
// Mix_Music *music; // I assume this has been loaded already
if(Mix_PlayMusic(music, -1)==-1)
{
printf("Mix_PlayMusic: %s\n", Mix_GetError());
// well, there's no music, but most games don't break without music...
}
See Also
SdlMixer Class | Tao.Sdl Namespace | Mix_FadeInMusic