home *** CD-ROM | disk | FTP | other *** search
- #define BYTE unsigned char << These are just to save keystrokes ;) >>
- #define WORD unsigned int
-
- WORD findcmfdriver(void);
- <<this function is used to detect if the cmf driver was loaded>>
- <<Note: CALL THIS FIRST. Nothing works without the SBFMDRV.COM>>
-
- void setcmfstatusbyte(void);
- <<call this to link 'cmf_status' global variable to the cmf driver>>
- <<you can use this to check if a song is playing or stopped (0=stopped)>>
-
- unsigned short getcmfdriverversion(void);
- <<call this to find out what version of cmf driver is loaded (BCD format)>>
-
- long getlength(char *filename);
- <<call this to find the length of the .CMF file>>
- <<Hint: malloc(getlength("SAMPLE.CMF"));
-
- void loadcmf(char *data, char *filename, long length);
- <<call this to load the .CMF file into buffer>>
- <<Note: must allocate the memory first; see above function>>
-
- unsigned int cmfplay(char huge *cmfdata);
- <<call this to play the song>>
-
- unsigned int startcmfplayback(char far *cmfdata, unsigned int offset);
- <<this function is used by 'playcmf()'; you do not need to call it>>
-
- unsigned int pausecmfplayback(void);
- <<this function is used to pause the song.>>
- <<Note: use 'continuecmfplayback()' to resume where it left off.>>
- <<Note: 'playcmf()' must be running when this is called>>
-
- unsigned int continuecmfplayback(void);
- <<this function is used to continue a paused song>>
- <<Note: 'playcmf()' must be running when this is called>>
-
- unsigned int stopcmfplayback(void);
- <<this is used to stop a playing .CMF song>>
- <<Note: 'playcmf()' must be running when this is called>>
- <<Note: you must use 'playcmf()' to play again>>
-
- void freestatusbyte(void);
- <<call this to unlink 'cmf_status' global variable from the cmf driver>>
- <<Note: do this when you are done with music (at exit of prg maybe?)>>
-
- unsigned int initcmfdriver(void);
- <<this is used to reset the cmf driver.>>
- <<Call it before you exit your program>>
-
- ************************************************************************************
- * 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); *
- * <<this function is used by 'playcmf()'; you do not need to call it>> *
- * *
- * void setsystemclock(unsigned int hertz); *
- * <<this function is used by 'playcmf()'; you do not need to call it>> *
- * *
- * void setdriverclock(unsigned int hertz); *
- * <<this function is used by 'playcmf()'; you do not need to call it>> *
- * *
- * void cmftranspose(int halfsteps); *
- * <<this function is used by 'playcmf()'; you do not need to call it>> *
- ************************************************************************************
- 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