8. Song information retrieval, Play and Stop tune

To play the tune we need optionally retrieve song information, select the song number, and press play. Literally ;).. Songs are numbered from 1, not from 0.

Here is example of the following steps in one function. songInfo is a pointer to pointer to sJamSongInfo structure, which will be filled with current tune info and will be described later.

Deinitialisation
void jamSetSong(void *songPtr,U16 songNb,sJamSongInfo **songInfo){ S32 usp=0; usp=Super(0L); sendJamCmd((*songInfo),songPtr,JAM_SONGINFO,0); sendJamCmd(songPtr,(void *)0L,JAM_SONGSELECT,songNb); sendJamCmd(songPtr,(void *)0L,JAM_SONGSELECT,songNb); sendJamCmd(&songInfo,(void *)0L,JAM_SONGINFO,0); SuperToUser(usp); }


The sJamSongInfo structure looks like this:
Deinitialisation
typedef struct { char title [256]; char composer [256]; char ripper [256]; char email [256]; char www [256]; char comments [256]; short int songHz; short int songCount; short int songPreselect; short int isYMsong; long dmaHz; char filename [256]; short int playtime_min [99]; short int playtime_sec [99]; } sJamSongInfo;


Tunes in several formats can have more than one sub songs (like ym2149 sndh format). So you can read it from this structure and select it with JAM_SONGSELECT and play it.

After all this hard work we can play our tune. Jam plugin handles all the interrupt stuff internally, so we only have to call the following function:

Deinitialisation
void jamPlay(){ long usp=0; usp=Super(0L); sendJamCmd((void *)0L,(void *)0L,JAM_PLAY,0); SuperToUser(usp); }


To stop a tune we simply call:
Deinitialisation
void jamStop(){ S32 usp=0; usp=Super(0L); sendJamCmd((void *)0L,(void *)0L,JAM_STOP,0); SuperToUser(usp); }



page:7/8