QuickMidi : QMIDI 5 Pre-Release Demo
By Thomas Laguzzi (C) 1999 TLP
Email    : Laguzzi@mail.dada.it
HomePage : Http://tlp.virtualave.net

CONTENTS:
1- INTRO
2- WORKING WITH A MIDI




INTRO:

This library is designed for who want to use BackGround Midi Music in Basic.
It uses an External Driver programmed by Creative Labs (C) for it's Sound
Blaster (C) cards. 
This library is based on QMidi of Jesse Dorland, who was the first people
that used the SBMIDI driver. I decided to port it in ASM and add some 
advanced features, like XMS support and FM handling routines. 

Currently I have done only the Basilar Functions of MIDI playing , with 
full multiple midis support and fast DOS loading (Things that were already
implemented in QMIDI). This is a beta version and you are invited to send 
bug reports and suggestions!

Here's a list of supported functions:
 FUNCTION CHECKMIDI%  (Return the state of a music FALSE not playing 
                      or TRUE playing )
 SUB      CREDITMIDI  (Print a very small temp. credit!)
 SUB      DISABLEMIDI (To disable the Midi Functions)
 FUNCTION DRIVERSLOADED% (Return the state of the drivers 1- SBSIM loaded
                         256 SBMIDI loaded 257 both loaded 0 nothing loaded)

 SUB      ENABLEMIDI  (Enable the Midi system again)
 FUNCTION GETERROR%    (Get the Last Error )
 FUNCTION GETSENSITIVE%(If the pause system works (0) or not (1) )
 FUNCTION GETWARNING%  (Get the last warning)
 FUNCTION INTMIDI%     (The Interrupts of MIDI (use with HEX$))
 FUNCTION LOADMIDI% (FileName$) Returns the Handle of the MIDI loaded
 SUB LOOPMIDI        Loops the Midi playing 
 FUNCTION MEMMIDI%(Handle%) Returns the memory used by the Midi Specified             
 SUB PAUSEMIDI       (Pauses the MIDI)
 SUB PLAYMIDI(Handle%)   (Plays a MIDI)
 SUB RESUMEMIDI            (Resume a paused Midi)
 SUB STOPMIDI            (Stops a midi)  
 FUNCTION TIMEMIDI&     (Returns how many seconds the midi is played)                
 FUNCTION TYPEMIDI%     (Return the switch number of SBMIDI)
 SUB UNLOADMIDI (Handle%) (Unload the Midi from the memory!)    

WARNING: This is a beta version and it isn't tested on various configurations.
If your computer suffers any mishaps as a result of using QMIDI, I'm not
responsible for it.  Reading the documentation should ensure safe
operation, and I don't think that it's even possible for QMIDI to do any
permanent damage, but I'm not making any guarantees.  You have been
warned....

----------------------COMPLETE VERSION FEATURES----------------------------
Full Mixing routines (Bass,Treble,Panning,Fading,ecc. in Background)
Debug Functions      (Logging, Tracing, ecc...)
Off-Playing XMS Support  (Un-Played Midis are temporary stored on the XMS)
FM Support  
---------------------------------------------------------------------------
The Mixing support and the Debug function will be present on the first version
but the FM and the XMS things will be avaiable on the second release...

---
WORKING WITH A MIDI:

BEFORE USING THE MIDI LIBRARY YOU MUST CALL THE DriversLoaded% ROUTINE!!!
After that you can load a Midi on the Memory, and you'll receive an handle.
An Handle is simply a number associated with the Midi. When you use the 
PlayMidi or the UnloadMidi you must specify the handle of the Midi you want
play or Unload.
Example:
DIM MidiHandle1%, MidiHandle2%
X%= DriversLoaded%
MidiHandle1% = LoadMidi "C:\MIDI1.MID"
MidiHandle2% = LoadMidi "C:\MIDI2.MID"

Now MidiHandle1% is associated with C:\MIDI1.MID and Midihandle2% with 
C:\MIDI2.MID

PlayMidi MidiHandle2% 'This plays the C:\MIDI2.MID
SLEEP
StopMidi               'This doesn't need an handle...
PlayMidi MidiHandle1% 'This plays the C:\MIDI1.MID
SLEEP
StopMidi

Every routine set the MidiError internal Var.You can get it's value with 
GetError% and GetWarning%
With an Error you can't continue and with a warning you are warned :-)!

You can use PauseMidi and Resume midi to pause and resume the current midi...
If you load SBMIDI with the /3 switch, the pause system will not work.


Sorry for this poor documentation , but we are working on the full version, 
that's only for testing purposes!


ERROR CODES (Directly from the source): 

;Here the errors before the end of the file

E0	DB	'Function successfully completed',13,10,'$'
E1	DB	'Error (1): Could not open the file',13,10,'$'
E2	DB	'Error (2): Out of Memory',13,10,'$'
E3	DB	'Error (3): No Midi file playing',13,10,'$'
E4	DB	'Error (4): Useless$',13,10,'$'
E5	DB	'Error (5): Useless$',13,10,'$'
E6	DB	'Error (6): No Mixer Chip',13,10,'$'
E7	DB	'Error (7): Could not detect soundcard',13,10,'$'
E8	DB	'Error (8): Feature unavaiable',13,10,'$'
E9	DB	'Error (9): Useless$',13,10,'$'
E10	DB	'Error (10): Invalid SoundCard',13,10,'$'
E11	DB	'Error (11): Could not play music',13,10,'$'
E12	DB	'Error (12): All handles in use',13,10,'$'
E13	DB	'Error (13): Invalid Handle Number',13,10,'$'
E14	DB	'Error (14): Could not detect the drivers',13,10,'$'
E15	DB	'Error (15): SBSIM needs SBMIDI',13,10,'$'
E16     DB      'Error (16): Could not pause or resume music: MPU401 loaded',13,10,'$'
;Now the warnings 

W1	DB	'Warning (1): Handle 255 in use'
W2	DB	'Playing time greater than 10 minutes'
W3	DB	'MidNight elapsed while paused'
W4	DB	'SBSIM not detected'
W5	DB	'File has size 0'
W6      DB      'Music Disabled',13,10,'$'