home *** CD-ROM | disk | FTP | other *** search
- Technical Documentation for MODOBJ.
- Revision 0.03
-
- To simply playback a module from a program
-
- Call MODINIT
- Call MODDEVICE and remember the device is returns
- Call MODVOLUME to set the volume to maximum
- Call MODSETUP to load and start playback of the module
- Do your programme here
- Call MODSTOP to stop the module
-
- Turbo C notes:
-
- Works with all memory models (as long as you declare
- the procedures to be FAR - see example program). Note that
- the parameters are the other way around to the Pascal ones.
-
- Playback through the speaker is more 'grainy' than under
- turbo pascal.
-
-
- Turbo Pascal Notes:
-
- The default is for Turbo Pascal to eat all available memory
- for itself. You must limit the heap-size otherwise there
- will be no room for the module. Look in your Turbo Pascal
- documentation and at the example program for details.
-
-
-
- ────────────────────────────────────────────────────────────────────────
- Initialize Devices
-
- P: procedure modinit;
- C: modinit ( void );
- ────────────────────────────────────────────────────────────────────────
-
- The first thing you must call before any of these other
- routines. It intialises internal variables and checks for
- soundblasters and the like.
-
- ────────────────────────────────────────────────────────────────────────
- Ask for a Device
-
- P: procedure moddevice( var device:integer);
- C: moddevice ( int *device );
- ────────────────────────────────────────────────────────────────────────
-
- Asks the user to select an output device. Returns a device number
- in the range 0-255. (0 is valid, the speaker and 255 is no-sound).
- You need not call this routine as the numeric values it returns
- will be constant for the particular version of MOD-OBJ. So you
- could ask the user once, then save their preference in a file.
-
- For this version of mod-obj (other values not used)
-
- 0 PC Speaker
- 1 D/A converter on LPT1
- 2 D/A converter on LPT2
- 3 D/A converter on LPT3
- 4 D/A converters on LPT1 and LPT2 (stereo)
- 5 D/A converters on LPT1 and LPT2 (mono)
- 7 Soundblaster card
- 10 Stereo-on-1 card
- 11 Disney Sound Source on LPT1
- 12 Disney Sound Source on LPT2
- 13 Disney Sound Source on LPT3
- 255 No sound
-
- Note that there is no need for 'user defined' adaptors. If you
- have two D/A converters on ports 0300 and 0301 say, then simply
- patch the LPT table using debug, and use devices 4 or 5
-
- C:\>debug
- -e 40:8 00 03 01 03 * Enters 0300 0301 as LPT1/2
- -q
-
- ────────────────────────────────────────────────────────────────────────
- Set the playback volume
-
- P: procedure modvolume( v1,v2,v3,v4:integer);
- C: modvolume ( int v4, int v3, int v2, int v1 );
- ────────────────────────────────────────────────────────────────────────
-
- Sets the module volume for each channel to 'volume'. Must be
- called before modsetup. 255 is normal, maximum volume. 0 is
- minimum (off). You can call this routine to change the volume
- whilst a module is playing. (4 different channels, one volume
- byte for each!)
-
- ────────────────────────────────────────────────────────────────────────
- Load and Play module
-
- P: procedure modsetup( var status: integer; device, mixspeed:integer;
- protrack, looping: integer, var filename:string )
- C: modsetup ( char *filename, int looping, int protracker
- int mixspeed, int device, int *status )
- ────────────────────────────────────────────────────────────────────────
-
- Pass this procedure the following data
-
- o The device number found above
- o The mixing speed in Hz (10000 is a good one, 14000 is better
- for the speaker... see what works on your machine).
- o A string giving the filename of the module.
- o Set to 1 if your mod sounds odd when run in protracker mode
- (converts volume slide commands only, might as well leave it
- on 0 )
- o Data on looping (Normally set this to 4)
- looping = 0 - Stop at end of module
- looping = 1 - Play the first pattern only
- looping = 2 - Play normally but disallow backward jumps
- looping = 4 - At end of module start again
-
- It will return
-
- o Status = 0 with the module playing
- o Status = 1 if there was an error loading/ not a mod
- o Status = 2 if already playing a mod
- o Status = 4 out of memory.
-
- ────────────────────────────────────────────────────────────────────────
- Stop the module - free memory
-
- P: procedure modstop;
- C: modstop ();
- ────────────────────────────────────────────────────────────────────────
-
- Stops the module playback and free's the memory that was
- allocated to it. MUST stop the mod before exiting to DOS.
- Can call this routine even if there is no module playing
-
-
-
- The REGISTERED version also has these functions:
- >
- > ────────────────────────────────────────────────────────────────────────
- > P: procedure getinsdetails ( ins:integer, var str:string, var len:length )
- > C: getinsdetails ( int *length, char *insname, int insnumber );
- > ────────────────────────────────────────────────────────────────────────
- >
- > Pass the sample number (1-31) as ins. It will return with
- > a string giving the name of that instrument, and the length
- > (a length of 0 means no instrument available).
- >
-
- > ────────────────────────────────────────────────────────────────────────
- > Get values for drawing bars
- >
- > P: procedure modbar ( var bar1, bar2, bar3, bar4:integer)
- > C: modbar ( int *bar4, int *bar3, int *bar2, int *bar1);
- > ────────────────────────────────────────────────────────────────────────
- >
- > Returns four values from 0-63 representing the 'level' of each
- > of the four channels. Look at Modplay's display to see how
- > this works.
- >
- >
- > ────────────────────────────────────────────────────────────────────────
- > Find out where you are in the module
- >
- > P: procedure modwhereami( var finished, speed, pattpos, songpos:integer)
- > C: modwhereami ( int *songpos, int *pattpos, int *speed, int *finished);
- > ────────────────────────────────────────────────────────────────────────
- >
- > Gets the current status and postion of the module
- >
- > o Playing Set to 1 if there is a module playing
- > o Speed Not useful
- > o Songpos Position within the song (0 = first pattern, 1 etc
- > keeps adding 1 each time pattpos reaches 1024).
- > o Pattpos The current pattern (0 - 1024 in steps of 16).
- > See the MODEDIT docs for details of patterns and
- > songs.
- >
- > ────────────────────────────────────────────────────────────────────────
- > Set position within the module
- >
- > P: procedure modsetpos ( var pattpos, songpos:integer);
- > C: modsetpos ( int songpos, int pattpos );
- > ────────────────────────────────────────────────────────────────────────
- >
- > Sets the current module position to be the values given
- > to this call. Pattpos gets rounded to nearest 16 bytes.
- >
- >
-
- > ────────────────────────────────────────────────────────────────────────
- > Outputting Samples.
- > ────────────────────────────────────────────────────────────────────────
- >
- > There are three ways of playing samples whilst a module is playing in
- > the background. (The routine returns, and the sample continues playing).
- >
- > Spotsample: The first will play one of the samples that is contained
- > within the module
- >
- > Spotsample3: The next will load a sample and play it - when the sample
- > has ended the memory it took up will be free-d straight
- > automatically.
- >
- > ────────────────────────────────────────────────────────────────────────
- > P: procedure spotsample ( sample,frequency:integer );
- > C: spotsample ( int frequency, int sample );
- > ────────────────────────────────────────────────────────────────────────
- >
- > This command lets you play a sample over the top of the mod.
- > The main module volume is halved and the sample is mixed in
- > with the playback. As soon as the sample has finished playing
- > the original module volume is restored.
- > In stereo mode, the sample is output to both the left and
- > right channels. Looping samples don't loop.
- >
- > Pass this procedure the sample number (1 to 31) from the module
- > and the 'frequency'. Actually this number corresponds similar
- > to the mod notes, so to play back at C-1 use 856. Similarly
- > C2 - 428, C3 - 214 etc. Any value 1-1000 can be used.
- >
- >
- > ────────────────────────────────────────────────────────────────────────
- > P: procedure spotsample3 ( var status: integer
- > frequency:integer, filename:string );
- > C: spotsample3 ( int *status, int frequenct, char *filename );
- > ────────────────────────────────────────────────────────────────────────
- >
- > Similar to spotsample in operation. Plays a sample that isn't
- > in the module over the top. Give the filename of the sample.
- > The sample is loaded, played and then the space free'd all in
- > the background.
- >
- > Status = 0 Okay
- > = 1 Loading error (file not found)
- > = 2 Out of memory
- >
- > If a sample was already playing, then the old sample is stopped and
- > free'd before the new sample is loaded/played.
-
-