home *** CD-ROM | disk | FTP | other *** search
- -----------------------------------------------------------------------------
-
- MLIB.QB/MLIB.VB - BASIC implementation of Play/R interface
-
- -----------------------------------------------------------------------------
- Copyright 1992, Kevin Weiner, All rights reserved
-
- Proprietary material - not for distribution
- -----------------------------------------------------------------------------
-
-
- Copy MLIB.QB or MLIB.VB to MLIB.BAS, depending on whether you are using
- Microsoft Quick Basic or Visual Basic for DOS, respectively. There are
- only very minor differences between the two files, addressing some
- QB and VB incompatibilities. Compile MLIB.BAS into a library and load
- it with your program. Necessary include definitions are contained
- in MLIB.BI (use '$INCLUDE: 'mlib.bi').
-
- See API.DOC for further information on the API functions, which in most
- cases have a one-to-one correspondence with the Basic versions. API.DOC
- also includes other important information on the driver, plus distribution
- licensing terms.
-
-
- ----------------------- Global variables defined ---------------------------
-
- MidiDriverLoaded as INTEGER -- true (-1) if driver is loaded,
- else false (0)
-
- MID as INTEGER -- Default device id number
-
-
- ---------------------- Initialization function -----------------------------
-
- SUB mfInit ()
-
- Tests for presence of driver and does other initialization.
- Defines global variables MidiDriverLoaded and MID. Must be
- first mlib routine called.
-
- ------------------------ MIDI file functions -------------------------------
-
- SUB mfPause ()
-
- Pauses MIDI file play.
-
-
- SUB mfContinue ()
-
- Continues play after pausing.
-
-
- SUB mfPopup ()
-
- Causes pop up window to appear. (Play/R)
-
-
- SUB mfRewind ()
-
- Rewind to beginning of song and pause.
-
-
- FUNCTION mfPlay% (filename$)
-
- Load specified song and start play.
- Return value = load status:
- 0 = File loaded successfully
- 1 = File not found
- 2 = Not MIDI file format
- 3 = Unexpected end of file
- 4 = Format not supported
- 5 = Track not found
- 6 = I/O error reading file
- 7 = Not enough memory
- 8 = Unsupported time base
- 255 = Nothing loaded
-
-
- SUB mfSongStat (playing AS INTEGER, done AS INTEGER, position AS LONG,
- songcount AS INTEGER, cursong AS INTEGER)
-
- Gets song status:
- playing = 1 if play in progress, 0 if paused
- done = 1 if at end of song, else 0
- position = song position in milliseconds
- songcount = size of play list, 0 if none
- cursong = current song number in play list
-
-
- SUB mfFileStat (stat AS INTEGER, filename AS STRING)
-
- Gets file load status (see mfPlay%) and current file name.
-
-
- FUNCTION mfLoad% (filename$)
-
- Load file but do not begin play.
- Return value = load status (see mfPlay%).
-
-
- SUB mfQuiet ()
-
- Stops all sounding notes.
-
-
- SUB mfPopEnable (stat AS INTEGER)
-
- Enable (stat=1) or disable (stat=0) user initiated pop up.
- (Play/R only)
-
-
- SUB mfVolume (adjust AS INTEGER)
-
- Adjust song volume +/- 128 velocity units from initial value.
-
-
- SUB mfTimeMode (mode AS INTEGER)
-
- Set timer stepping mode (1-3). See "Timing Considerations" in
- the file API.DOC for further info.
-
-
- SUB mfGetChan (datatype AS INTEGER, chan() AS INTEGER)
-
- Get channel attributes. Returns an array of 16 integer channel
- attributes, their meaning depending on the value of datatype:
-
- "datatype" "chan" array contents
- -------------- --------------------------------------------
- 0 (ChanMap) Output channel map - values from 0 to 15
-
- 1 (ChanEna) Channel enable flag - 1=enable, 0=disable
-
- 2 (ChanXpos) Channel transpose - Positive or negative integer
-
- (ChanMap, ChanEna, and ChanXpos are constants defined in MLIB.BI)
-
-
- SUB mfSetChan (datatype AS INTEGER, chan() AS INTEGER)
-
- Set channel attributes according to the specified integer array
- (chan) and attribute type (datatype). See mfGetChan.
-
-
- SUB mfSetPos (time AS LONG)
-
- Set song position to specified time in milliseconds. If time is
- less than zero, skip forward abs(time) milliseconds.
-
-
- SUB mfSkipSong (n AS INTEGER)
-
- Skip to song n in play list. If beyond end of list, skip to 1.
- Note: Play lists will not advance automatically in Basic.
-
-
- SUB mfLoopMode (n AS INTEGER)
-
- Set song looping mode: 0 = no looping
- 1 = loop current song
- 2 = loop play list (startup default)
-
-
- ---------------------- General MIDI functions ----------------------------
-
- FUNCTION midiDevName% (dev AS INTEGER, devname AS STRING,
- devdesc AS STRING)
-
- Gets 3-letter device designation and 20-character description
- for specified device number (starting at 1). Returns non-zero
- if device exists, else 0 if no more devices.
-
-
- SUB midiReset (dev AS INTEGER)
-
- Resets device to playable UART status.
-
-
- SUB midiPutBuffer (dev AS INTEGER, buf AS STRING, datalen AS INTEGER)
-
- Writes a buffer (buf) of datalen bytes to device dev. May be used
- while MIDI file play is in progress (although play will be
- suspended until all the data is sent).
-
-
- FUNCTION midiGetBuffer% (dev AS INTEGER, buf AS STRING, max AS INTEGER)
-
- Returns up to max bytes to buf from device dev. Function return
- value is number of bytes actually transferred.
-
-
- FUNCTION midiInputReady% (dev AS INTEGER)
-
- Test for input data waiting. Function returns true (-1)1 if data
- waiting, else false (0).
-
-
- SUB midiPutShort (dev AS INTEGER, b1 AS INTEGER, b2 AS INTEGER,
- b3 AS INTEGER)
-
- Send a full MIDI message using specified device, and one to three
- data bytes (one byte per integer argument).
-
-
-
- ---------------------------- Misc. functions ----------------------------
-
- FUNCTION msTimer& ()
-
- Return reference time in milliseconds.
-
-
- SUB midiRemove ()
-
- Removes driver from memory if possible to do so.
-
- =========
-