home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gold Fish 1
/
GoldFishApril1994_CD2.img
/
d4xx
/
d483
/
med
/
med.lzh
/
MED
/
Programmers
/
Examples
/
example2.c
< prev
next >
Wrap
C/C++ Source or Header
|
1991-05-08
|
1KB
|
41 lines
/* This example loads two songs, the first one is the load music of the
second song. Compile with Lattice/SAS C V5.xx */
#include <exec/types.h>
#include <libraries/dos.h>
#include <proto/exec.h>
#include <proto/dos.h>
#include "libproto.h"
void main(argc,argv)
int argc;
char *argv[];
{
struct MMD0 *sng1,*sng2;
register struct Library *MEDPlayerBase = OpenLibrary("medplayer.library",0);
if(!MEDPlayerBase) return;
printf("---example2---\n");
if(argc < 3) {
printf("Usage: example2 <song1> <song2>\n");
return;
}
GetPlayer(0); /* If this fails, no crash. Just no music. */
printf("Loading the first song...\n");
sng1 = LoadModule(argv[1]);
PlayModule(sng1); /* start the load music */
printf("Loading the second song...\n");
sng2 = LoadModule(argv[2]);
printf("Press Ctrl-C to play next song.\n");
Wait(SIGBREAKF_CTRL_C);
DimOffPlayer(35); /* fade out the first tune */
Delay(250); /* wait 5 seconds for fading */
PlayModule(sng2);
printf("Press Ctrl-C to quit.\n");
Wait(SIGBREAKF_CTRL_C);
UnLoadModule(sng1); /* Even if LoadModule failed, this won't crash */
UnLoadModule(sng2);
FreePlayer();
CloseLibrary(MEDPlayerBase);
printf("Bye!!!\n");
}