MusSetMarkerCallback()

Syntax

void MusSetMarkerCallback(void *callback);

Arguments

callback
the callback function address

Description

It sets the callback function for a synchronous marker. This function specifies the address of the function to inform when a marker prepared in a function by the programmer appears during playback of a song. The callback argument takes on the LIBMUScb_marker definition set with typedef in libmus.h

  typedef void(*LIBMUScb_marker)  (musHandle, int);

The parameters passed to the callback function are the handle of the song that generated the callback and the number of synchronous markers found.

Note: The callback function is called from the library thread, so it is best to process it as soon as called.

Return Value

None

Example

void GameSongCallback(musHandle handle, int marker)
{
  if (handle==gamesong_handle)
    gamesong_position = marker;
}

void GameSongStart(void)
{
  gamesong_position = 0;
  gamesong_handle = MusStartSongFromMarker(&song_data, 1);
  MusSetMarkerCallback(GameSongCallback);
}

See Also

MusStartSongFromMarker()