ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ Module Player V1.4 (c) 1994,1995 by Lord Excess of Sound Wizards Int. ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ USING THE SWMP DRIVERS WITH 'BORLAND C 2.0' ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ First of all you have to unzip the files of the included archive C_SDK.ZIP in an existing directory. The files you need in any case are: MODPLAY.INC : interface to drivers MOD_DRV.OBJ : all sound drivers The rest are example files, which can be important to understand things better. Now you have to perform two steps to use all mod-routines: 1. Add the following expression to your source code: #include "modplay.inc" 2. For a successfull link of the drivers you best open a project file, else you have to study the syntax of your linker... After that add the file "mod_drv.obj" and of course all of your source files. At program start you have to initialize one of the drivers using the following subroutine: ÚÄÄINIT DRIVERÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ³ void MOD_Init(unsigned int Driver, unsigned int Port, ³ unsigned char IRQ, unsigned char DMA) ³ -> Select and initialize driver for sound output ³ ³ Driver = Detection (0) : Port = 0 ³ IRQ = 0 ³ DMA = 0 ³ ³ = SoundBlaster (1) : Port = SB base address (x220..) ³ IRQ = SB IRQ# ³ DMA = 1 (always) ³ ³ = SoundBlaster_Pro (2) : Port = SBP base address ³ IRQ = SBP IRQ# ³ DMA = SBP DMA channel ³ ³ = Gravis_UltraSound (3) : Port = GUS base address ³ IRQ = GF1 IRQ# ³ DMA = MIDI IRQ# !! À A very powerful hardware detection is able to detect any supported soundcard with all required settings. So in general the easiest way to init the drivers is: MOD_Init(Detection,0,0,0); If all fails you can override detection and select one of the drivers by yourself, but in this case you have to know (or ask for) the settings of an installed soundcard. If you want to know if initialisation was successfull, have a look at the variable (unsigned int) Soundcard, which will contain the output device: 0: no sound available 1: SoundBlaster [ 22.2 kHz mono ] 2: SoundBlaster Pro [ 21.7 kHz stereo ] 3: Gravis UltraSound [ 44.1 kHz +stereo+ ] You do not have to handle this variable. You can also call the driver's subfunctions even if no soundcard was detected, nothing will happen in this case. At program end the unit selfrestores any altered interrupt vectors etc. The following functions are now available: (Note: The first two functions are enough to playback a mod !!!) ÚÄÄLOAD MODULEÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ³ void Mod_Load(char *File_Name) ³ -> Stops possible sound output, loads module file into memory, ³ but does not start playing. If successfull the variable ³ (unsigned int) Channels will contain the number of channels, ³ else zero. À ÚÄÄPLAY MODULEÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ³ void Mod_Play(unsigned int Looping) ³ -> Starts playing previously loaded song. If looping is zero, ³ song is played only once, else continuously. À ÚÄÄSTOP MODULEÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ³ void Mod_Stop(void) ³ -> Stops sound output at once. À ÚÄÄMAIN VOLUMEÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ³ void Mod_Volume(unsigned char Volume) ³ -> Changes the driver's main volume setting. Valid values are ³ between 0 (lowest) and 64 (loudest). À ÚÄÄSTATUSÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ³ unsigned int Mod_Status(void) ³ -> Returns 1 if sound is being played, else 0. À ÚÄÄGET POSITIONÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ³ unsigned int Mod_Position(void) ³ -> Returns 256*PatternNumber+LineNumber. Can be useful to ³ syncronize a special graphic effect to the sound. À ÚÄÄJUMP BACKÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ³ void Mod_Rewind(void) ³ -> Decreases current songposition. No effect in first pattern. À ÚÄÄJUMP FORWARDÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ³ void Mod_Forward(void) ³ -> Increases current songposition. No effect in last pattern. À ÚÄÄPEAKSÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ³ void Mod_Peak(void) ³ -> Updates the array Peaks by copying the driver's volume ³ setting (0..64) of each channel. The number of channels ³ can be found in the variable Channels (WORD) and is either ³ four, six or eight. À In general it remains to be said that you can do as much error checking as you like, but it is not necessary. In a demo or intro for example you do not care if there is sound available to the grafix you produce on the screen (in most cases). But in a player it is evident that you need to have any sounddevice at all to output the sound! The best way is to take a look at the example programs. Have a lot of fun! Lord Excess in June '95