home *** CD-ROM | disk | FTP | other *** search
/ Sound, Music & MIDI Collection 2 / SMMVOL2.bin / MIDI_PAT / MTOOLS.ZIP / PLAYRDEV.EXE / MLIB_BAS.DOC < prev    next >
Encoding:
Text File  |  1992-11-07  |  6.4 KB  |  218 lines

  1. -----------------------------------------------------------------------------
  2.  
  3.         MLIB.QB/MLIB.VB - BASIC implementation of Play/R interface
  4.  
  5. -----------------------------------------------------------------------------
  6.             Copyright 1992, Kevin Weiner, All rights reserved
  7.  
  8.                Proprietary material - not for distribution
  9. ----------------------------------------------------------------------------- 
  10.  
  11.  
  12. Copy MLIB.QB or MLIB.VB to MLIB.BAS, depending on whether you are using
  13. Microsoft Quick Basic or Visual Basic for DOS, respectively.  There are
  14. only very minor differences between the two files, addressing some
  15. QB and VB incompatibilities.  Compile MLIB.BAS into a library and load
  16. it with your program.  Necessary include definitions are contained
  17. in MLIB.BI (use '$INCLUDE: 'mlib.bi').
  18.  
  19. See API.DOC for further information on the API functions, which in most
  20. cases have a one-to-one correspondence with the Basic versions.  API.DOC
  21. also includes other important information on the driver, plus distribution
  22. licensing terms.
  23.  
  24.  
  25. ----------------------- Global variables defined ---------------------------
  26.  
  27.   MidiDriverLoaded as INTEGER  --  true (-1) if driver is loaded,
  28.                                    else false (0)
  29.  
  30.   MID as INTEGER               --  Default device id number
  31.  
  32.  
  33. ---------------------- Initialization function -----------------------------
  34.  
  35. SUB mfInit ()
  36.  
  37.      Tests for presence of driver and does other initialization.
  38.      Defines global variables MidiDriverLoaded and MID.  Must be
  39.      first mlib routine called.
  40.  
  41. ------------------------ MIDI file functions -------------------------------
  42.  
  43. SUB mfPause ()
  44.  
  45.      Pauses MIDI file play.
  46.  
  47.  
  48. SUB mfContinue ()
  49.  
  50.      Continues play after pausing.
  51.  
  52.  
  53. SUB mfPopup ()
  54.  
  55.      Causes pop up window to appear.  (Play/R)
  56.  
  57.  
  58. SUB mfRewind ()
  59.  
  60.      Rewind to beginning of song and pause.
  61.  
  62.  
  63. FUNCTION mfPlay% (filename$)
  64.  
  65.      Load specified song and start play.
  66.      Return value = load status:
  67.                          0 = File loaded successfully
  68.                          1 = File not found
  69.                          2 = Not MIDI file format
  70.                          3 = Unexpected end of file
  71.                          4 = Format not supported
  72.                          5 = Track not found
  73.                          6 = I/O error reading file
  74.                          7 = Not enough memory 
  75.                          8 = Unsupported time base
  76.                          255 = Nothing loaded
  77.  
  78.  
  79. SUB mfSongStat (playing AS INTEGER, done AS INTEGER, position AS LONG,
  80.                 songcount AS INTEGER, cursong AS INTEGER)
  81.  
  82.      Gets song status:
  83.         playing   = 1 if play in progress, 0 if paused
  84.         done      = 1 if at end of song, else 0
  85.         position  = song position in milliseconds
  86.         songcount = size of play list, 0 if none
  87.         cursong   = current song number in play list
  88.  
  89.  
  90. SUB mfFileStat (stat AS INTEGER, filename AS STRING)
  91.  
  92.      Gets file load status (see mfPlay%) and current file name.
  93.  
  94.  
  95. FUNCTION mfLoad% (filename$)
  96.  
  97.     Load file but do not begin play.
  98.     Return value = load status (see mfPlay%).
  99.  
  100.  
  101. SUB mfQuiet ()
  102.  
  103.     Stops all sounding notes.
  104.  
  105.  
  106. SUB mfPopEnable (stat AS INTEGER)
  107.  
  108.     Enable (stat=1) or disable (stat=0) user initiated pop up.
  109.     (Play/R only)
  110.  
  111.  
  112. SUB mfVolume (adjust AS INTEGER)
  113.  
  114.     Adjust song volume +/- 128 velocity units from initial value.
  115.  
  116.  
  117. SUB mfTimeMode (mode AS INTEGER)
  118.  
  119.     Set timer stepping mode (1-3).  See "Timing Considerations" in
  120.     the file API.DOC for further info.
  121.  
  122.  
  123. SUB mfGetChan (datatype AS INTEGER, chan() AS INTEGER)
  124.  
  125.     Get channel attributes.  Returns an array of 16 integer channel
  126.     attributes, their meaning depending on the value of datatype:
  127.  
  128.         "datatype"              "chan" array contents
  129.       --------------   --------------------------------------------
  130.        0 (ChanMap)     Output channel map - values from 0 to 15
  131.  
  132.        1 (ChanEna)     Channel enable flag - 1=enable, 0=disable
  133.  
  134.        2 (ChanXpos)    Channel transpose - Positive or negative integer
  135.  
  136.        (ChanMap, ChanEna, and ChanXpos are constants defined in MLIB.BI)
  137.  
  138.  
  139. SUB mfSetChan (datatype AS INTEGER, chan() AS INTEGER)
  140.  
  141.     Set channel attributes according to the specified integer array
  142.     (chan) and attribute type (datatype).  See mfGetChan.
  143.  
  144.  
  145. SUB mfSetPos (time AS LONG)
  146.  
  147.     Set song position to specified time in milliseconds.  If time is
  148.     less than zero, skip forward abs(time) milliseconds.
  149.  
  150.  
  151. SUB mfSkipSong (n AS INTEGER)
  152.  
  153.     Skip to song n in play list.  If beyond end of list, skip to 1.
  154.     Note: Play lists will not advance automatically in Basic.
  155.  
  156.  
  157. SUB mfLoopMode (n AS INTEGER)
  158.  
  159.     Set song looping mode:   0 = no looping
  160.                              1 = loop current song
  161.                              2 = loop play list (startup default)
  162.  
  163.  
  164. ---------------------- General MIDI functions ----------------------------
  165.  
  166. FUNCTION midiDevName% (dev AS INTEGER, devname AS STRING,
  167.                        devdesc AS STRING)
  168.  
  169.     Gets 3-letter device designation and 20-character description
  170.     for specified device number (starting at 1).  Returns non-zero
  171.     if device exists, else 0 if no more devices.
  172.  
  173.  
  174. SUB midiReset (dev AS INTEGER)
  175.  
  176.     Resets device to playable UART status.
  177.  
  178.  
  179. SUB midiPutBuffer (dev AS INTEGER, buf AS STRING, datalen AS INTEGER)
  180.  
  181.     Writes a buffer (buf) of datalen bytes to device dev.  May be used
  182.     while MIDI file play is in progress (although play will be
  183.     suspended until all the data is sent).
  184.  
  185.  
  186. FUNCTION midiGetBuffer% (dev AS INTEGER, buf AS STRING, max AS INTEGER)
  187.  
  188.     Returns up to max bytes to buf from device dev.  Function return
  189.     value is number of bytes actually transferred.
  190.  
  191.  
  192. FUNCTION midiInputReady% (dev AS INTEGER)
  193.  
  194.     Test for input data waiting.  Function returns true (-1)1 if data
  195.     waiting, else false (0).
  196.  
  197.  
  198. SUB midiPutShort (dev AS INTEGER, b1 AS INTEGER, b2 AS INTEGER,
  199.                   b3 AS INTEGER)
  200.  
  201.     Send a full MIDI message using specified device, and one to three
  202.     data bytes (one byte per integer argument).
  203.  
  204.  
  205.  
  206. ---------------------------- Misc. functions ----------------------------
  207.  
  208. FUNCTION msTimer& ()
  209.  
  210.     Return reference time in milliseconds.
  211.  
  212.  
  213. SUB midiRemove ()
  214.  
  215.     Removes driver from memory if possible to do so.
  216.  
  217. =========
  218.