7. Callbacks

This is rather formality.
Firstly we need an info when the song will end. If plugin supports end of song detection, supportsNextSongHook field in plugin info structure is true, then we have to pass address of variable/flag to the plugin. Plugin will be writing to passed address and will be indicating there that end of song was reached. If a value in this variable at provided address will be 1 then end of the song was reached. So for example we can react to this event and reloop whole song once again or play another one from the list.

short int finishedReplayFlag; //our variable when end of song info will be stored void *ret=sendJamCmd(&finishedReplayFlag,(void *)0L,JAM_SONG_NEXT_HOOK,0);


Next two hooks are for plugin communication with outer world. We need to provide the callbacks which will be called whenever plugin will try to output some information or report the problem, for replay only they doesn't have to be very fancy:

Example logging and error reporting hooks
void logHook(){ puts("Want to tell you something...\r\n"); } void alertHook(){ puts("Houston we have a problem!\r\n"); }


Next we have to install them:

Installation of log and error callbacks
void *ret=sendJamCmd(logHook,(void *)0L,JAM_LOG_HOOK,0); ret=sendJamCmd(alertHook,(void *)0L,JAM_ALERT_HOOK,0);



page:6/8