Global variable

Hi all, i have a small problem with a big effect

Following situation (what i like to do):
1.) I have one script which runs at MaL start (it is the “testmidiout” or as it called from Torben.
This script detect all Midi devices and give as a feedback the correct name.
Now i want to compare the name from feedback which a string to get the correct device number.
This device number i want to put in a global variable called e.g. “Devicenr”

2.) Now i have another notification script which sets some midi commands to the device “Devicenr”.

The reason: I don’t know why, but sometimes Windows put me an additional mididevice in (and sometimes not), so the number of the needed mididevice will change sometimes. If i use a fix number at the notification script sometimes it will not work (and change me some other parameters at my mixer as well grrr

By the reason it takes some time to get the devicenumber i want to do it at MaL start and not everytime i run the notification script.

OK, part one solved. I can put notification together with the other one and run once at start up. Should work.
But i found a bigger problem.
How i can compare a information from the midiOuttest-Script with the real name e.g. “Tascam Device 6”.
I did not found how the MidiOutListDevices works and where the name will read :frowning:


Variables cannot be shared among separate scripts at the moment.

The MIDI device list will appear in the system log (double click the status bar in the main window).

Hi Torben, where to read the name, i found allready, but thanks for the info.
My problem is that i want to compare the name with the readout from MidiDeviceList so i can compare the name with the readout (the name will normally not changed, but by some reasons the device number)

So i think the compare line must be something like…

  for i := 0 to midiOutGetNumDevs - 1 do begin
    for j := $3C to $3C + 11 do begin
      MidiOut(i, $90, j, $64);
      MidiOut(i, $80, j, $64);
        if MidiOutListDevices = "MidiOut4 (Tascam DM-3200)" then devicenr = actual counter number from do loop

Where devicenr is set as an global variable.
But how i can compare these strings, let’s say where i find the read out.
The script “except your line” is your MidiOuttest script.

in the OnPlayer… in another position of the notification script i would call the midiout like this:

MidiOut ( devicenr, 184, 03, 95 ) ;

Both preocedures are in the same script. i call it once on start up (works fine) and later as the normal notifications, so problem with the variable solved)
Main problem is, that the “MidiOut4” is not automatically the device number 4. It’s only the fourth device from the mixer. But sometimes windows change the order and it is possible that i have up to 5 other devices in front so that the Device4 get the absolute number 9.

Maybe i should also explain in german, i don’t know if i explained in a good way to understand gg

I got the point.

The midiOutListDevices is just a helper function. Its output is always directed to the system log and cannot be used in any other way. Of course, I could introduce a second function which returns the list as a IStrings object or so.

How come that your device numbers change? Usually they should be fixed, unless you keep unplugging and plugging your hardware.

Hi torben,
the problem is in one firewire card which also provide 2 Mididevices, but sometimes this card is unlocked and by this also the devices will lost (i don’t know why but just figure it out this morning whne i reconfigure the Tascam because the midi script suddenly does not work anymore)

But no problem. I do a work around and create a constant, so if device changed it goes quickly to modify at only one point.



Yes, that seems to be a reasonable workaround until we find a better solution.

Problem found.
The mixer support 8 midi devices. 6 are by USB and another two by Firewire. At the moment the mixer is switched of the firewire is unlocked and also the two midi devices are not present. So if i switch on mixer before computer start the firewire devices will read first and after this the USB devices. If mixer is switched on later the USB devices will be first, because powered from computer. :smiley:

So i know what to do gg