Qbasicnews.com

Full Version: Another QBMIDI related problem
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I gave the demo of my RFM project to some people so that they can test if the MIDI routines are working.
They said that they were able to run the drivers and game properly but then, inside the game, programm didn't regoznized that the drivers were loaded and therefor disable to option of turning the
music on.

I splitted my programm in two parts and left all the MIDI routines
in the second module.
In the main module, MIDI routines will execute only if SndDrivers = 1 (drivers are loaded) and PlayMusic = TRUE (music is switched on)

SndDrivers is a COMMON SHARED variable.

In the second module, with the MIDI routines, on the end of main sub I have this :
SndDrivers=1 'Deafult, drivers are loaded
DriversLoaded SBMIDI.INTERRUPT, SBSIM.INTERRUPT
IF SBMIDI.INTERRUPT = 0 THEN SBMIDI.INTERRUPT = &H80
IF SBSIM.INTERRUPT = 0 THEN SBSIM.INTERRUPT = &H81
IF SBMIDI.INTERRUPT = 0 THEN SndDrivers = 0
'If DriversLoaded sub returns a zero value SndDrivers = 0 and
'you should not be able to turn on the music(PlayMusic is always
'FALSE, you can't switch it in game options to TRUE).

What I want to know? Is SndDrivers value passed to the main module or should i use the DriversLoaded function in the main
module and use it to trigger SndDrivers like I done that in the second module?

Help.

Also, can I load SBMIDI.EXE in Windows 2000 DOS shell somehow?
Somewhat strange. MIDI only has to be activated at the beginning of your program, and it remains activated until you exit... Are you doing this at the beginning of your program?

Anyways, I can't help your more than this, 'cause my QMIDI version is the OBJ one that has a different initialization routine: http://usuarios.lycos.es/firstqbasicforum/qmidiobj.zip
I am doing this at the begining of the second module, not on the begining of the main module.
I mean, you have to do this at the beginning of the execution of your program (no matter where in the code it is, of course Wink ). I mean, the first thing you should do, besides initializing your arrays, is initializing the MIDI engine.
Code:
TYPE Registers
     AX    AS INTEGER
     BX    AS INTEGER
     CX    AS INTEGER
     DX    AS INTEGER
     BP    AS INTEGER
     SI    AS INTEGER
     DI    AS INTEGER
     FLAGS AS INTEGER
     DS    AS INTEGER
     ES    AS INTEGER
END TYPE
IntXCodeData:
DATA  &H55, &H8B, &HEC, &H83, &HEC, &H08, &H56, &H57, &H1E, &H55, &H8B, &H5E
DATA  &H06, &H8B, &H47, &H10, &H3D, &HFF, &HFF, &H75, &H04, &H1E, &H8F, &H47
DATA  &H10, &H8B, &H47, &H12, &H3D, &HFF, &HFF, &H75, &H04, &H1E, &H8F, &H47
DATA  &H12, &H8B, &H47, &H08, &H89, &H46, &HF8, &H8B, &H07, &H8B, &H4F, &H04
DATA  &H8B, &H57, &H06, &H8B, &H77, &H0A, &H8B, &H7F, &H0C, &HFF, &H77, &H12
DATA  &H07, &HFF, &H77, &H02, &H1E, &H8F, &H46, &HFA, &HFF, &H77, &H10, &H1F
DATA  &H8B, &H6E, &HF8, &H5B, &HCD, &H21, &H55, &H8B, &HEC, &H8B, &H6E, &H02
DATA  &H89, &H5E, &HFC, &H8B, &H5E, &H06, &H1E, &H8F, &H46, &HFE, &HFF, &H76
DATA  &HFA, &H1F, &H89, &H07, &H8B, &H46, &HFC, &H89, &H47, &H02, &H89, &H4F
DATA  &H04, &H89, &H57, &H06, &H58, &H89, &H47, &H08, &H89, &H77, &H0A, &H89
DATA  &H7F, &H0C, &H9C, &H8F, &H47, &H0E, &H06, &H8F, &H47, &H12, &H8B, &H46
DATA  &HFE, &H89, &H47, &H10, &H5A, &H1F, &H5F, &H5E, &H8B, &HE5, &H5D, &HCA
DATA  &H02, &H00
DIM SHARED QMIDIRegs AS Registers, MEM.SEGMENT(0 TO 255) AS INTEGER
DIM SHARED MIDI.PLAYTIME AS SINGLE, MIDI.ERROR AS INTEGER, PAUSED AS SINGLE
DIM SHARED SBMIDI.INTERRUPT AS INTEGER, MEM.ALLOCATED(0 TO 255) AS LONG
DIM SHARED SBSIM.INTERRUPT AS INTEGER, MIXER.CHIP AS INTEGER
DIM SHARED SB.BASEPORT AS INTEGER, SB.IRQ AS INTEGER
DIM SHARED SB.LODMA AS INTEGER, SB.HIDMA AS INTEGER, SB.CARDTYPE AS INTEGER
DIM SHARED SB.MPU401 AS INTEGER, BIT.STORAGE(0 TO 7) AS INTEGER
DIM SHARED SENSITIVE AS INTEGER, REVERSE.STEREO AS INTEGER
DIM SHARED SOUND.DISABLED AS INTEGER, CURRENTHANDLE AS INTEGER

DriversLoaded SBMIDI.INTERRUPT, SBSIM.INTERRUPT
IF SBMIDI.INTERRUPT = 0 THEN SBMIDI.INTERRUPT = &H80
IF SBSIM.INTERRUPT = 0 THEN SBSIM.INTERRUPT = &H81

Do I need to put this in the main module or can I leave it in the second module, where all MIDI subs are? I'm having memory problems when compiling the main module.