Tao.Sdl SDK Documentation

SdlMixer.Mix_GetMusicType Method 

Find out the music format of a mixer music, or the currently playing music, if 'music' is NULL.

[Visual Basic]
Public Shared Function Mix_GetMusicType( _
   ByVal music As IntPtr _
) As Integer
[C#]
public static int Mix_GetMusicType(
   IntPtr music
);

Parameters

music
The music to get the type of. NULL will get the currently playing music type.

Return Value

The type of music or if music is NULL then the currently playing music type, otherwise MUS_NONE if no music is playing.

Remarks

Tells you the file format encoding of the music. This may be handy when used with Mix_SetMusicPosition, and other music functions that vary based on the type of music being played. If you want to know the type of music currently being played, pass in NULL to music.

Binds to C-function in SDL_mixer.h

Mix_MusicType Mix_GetMusicType(const Mix_Music *music)
            

Example

            // print the type of music currently playing
                    switch(Mix_GetMusicType(NULL))
                {
                    case MUS_NONE:
                    MUS_CMD:
                    printf("Command based music is playing.\n");
                    break;
                    MUS_WAV:
                    printf("WAVE/RIFF music is playing.\n");
                    break;
                    MUS_MOD:
                    printf("MOD music is playing.\n");
                    break;
                    MUS_MID:
                    printf("MIDI music is playing.\n");
                    break;
                    MUS_OGG:
                    printf("OGG music is playing.\n");
                    break;
                    MUS_MP3:
                    printf("MP3 music is playing.\n");
                    break;
                    default:
                    printf("Unknown music is playing.\n");
                    break;
                }
            

See Also

SdlMixer Class | Tao.Sdl Namespace | Mix_SetPosition | Mix_SetPosition