#define BYTE unsigned char << These are just to save keystrokes ;) >> #define WORD unsigned int WORD findcmfdriver(void); <> <> void setcmfstatusbyte(void); <> <> unsigned short getcmfdriverversion(void); <> long getlength(char *filename); <> <> <> unsigned int cmfplay(char huge *cmfdata); <> unsigned int startcmfplayback(char far *cmfdata, unsigned int offset); <> unsigned int pausecmfplayback(void); <> <> <> unsigned int continuecmfplayback(void); <> <> unsigned int stopcmfplayback(void); <> <> <> void freestatusbyte(void); <> <> unsigned int initcmfdriver(void); <> <> ************************************************************************************ * THESE FUNCTIONS ARE CALLED BY OTHER FUNCTIONS AND SHOULD NOT BE USED UNLESS YOU * * ARE SURE YOU KNOW WHAT YOU ARE DOING * ************************************************************************************ * void setinstruments(unsigned int instruments, char far *data); * * <> * * * * void setsystemclock(unsigned int hertz); * * <> * * * * void setdriverclock(unsigned int hertz); * * <> * * * * void cmftranspose(int halfsteps); * * <> * ************************************************************************************ unsigned char far *cmf_status=NULL; This is the variable you check after calling 'setcmfstatusbyte()'. Note: You can use any global one byte variable but I suggest you use this one. <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< What to DO >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> The general format for playing a .CMF song is this: 1. Make sure the SBFMDRV.COM is already loaded. It is a TSR that should be loaded before the program is run. I have successfully used 'system()' to invoke a DOS command to load it if 'findcmfdriver()' returned false. But I could not unload it using 'system("SBFMDRV.COM/u")' from within the same program. One method is to run your program from a .BAT file. Load the SBFMDRV.COM, load your program, and then unload the SBFMDRV.COM/u. 2. The next step is to find the length of the .CMF file 'findlength()' and allocate that much memory to a pointer. This is the pointer that most of the other functions will use. I named mine 'cmf_data' 3. Once the proper amount of memory is allocated, load the .CMF file into the buffer 'loadcmf()'. Set the status byte 'setcmfstatusbyte()'. This is a byte that you can check to see if a song is playing or not. The driver constantly updates this byte. 4. Now play the .CMF file 'playcmf()'. The song will play in the background so your program can do other neat things. 5. Here is where you can use 'pausecmfplayback()', 'stopcmfplayback()', etc... 6. Make sure before you exit the program that you: a. initcmfdriver() b. freestatusbyte() c. release the allocated buffer Note: Obviously you must include "SOUND.H". ;) ********************************************************************************** All functions and code written by Clint Roudenbush E-mail me: ZarrinW@aol.com This update is current as of September 1995