Hello,
I am using following script to control mAirList 6.x from KORG nanoKontrol2 MIDI controller for some years already. It works just fine after I run mAirList and start to work, but after each dozen of minutes or so of work in progress it goes wild: controls start to behave erraticaly, volumes jumping up and down when moving a fader, start / stop function became reversed or controlling different player than it should etc. The cure (except of restarting mAirList) is to to turn the MIDI Remote control off by unchecking it in the mAirList Control Panel / Remote Control / Apply / OK and then turning it on again. Than it works well again for some dozen of minutes etc.
I think the problem is not in the controller itself, because it is controlling another application (Reaper) simultaneously, which does not exhibit such problems.
Also the fact, that just triggering off/on the MIDI Remote control in mAirlist (without restartning anything else) cures the problems leads me to an estimation, that it lies somewhere in mAirList around my script.
Any guidance to possible solution is higly appeciated, thank you.
// last values of fader data
var lm0,lm1,lm2,lm3,lm4,lma,lmb: byte;
// fader level in dB
var f: single;
// ON/OFF fader button states
var on0,on1,on2,on3,on4,ona,onb: byte;
procedure OnLoad;
begin
end;
procedure OnMidiMessage(Device: integer; Status, Data1, Data2: byte);
begin
if (Status = $B0) then begin
// convert the 0-127 MIDI fader data value to dB
if (Data2 = 0) then f := -200
else f := 20 * ln(single(Data2) / 127)/ln(3);
// fader starts + player volumes (send the PLAYER X-Y START command when the respective fader is moved from 0 position and fader button is ON); STOPS or PAUSES PLAYER when fader moved to 0 position
if (Data1 = $01) then begin
ExecuteCommand('PLAYER 1-1 VOLUME ' + FloatToStr(f));
if (Data2 >= $01) and (lm1 = $00) and (on1 = $7F) then ExecuteCommand('PLAYER 1-1 START');
if (Data2 = $00) then ExecuteCommand('PLAYER 1-1 STOP');
lm1 := Data2;
end;
if (Data1 = $02) then begin
ExecuteCommand('PLAYER 1-2 VOLUME ' + FloatToStr(f));
if (Data2 >= $01) and (lm2 = $00) and (on2 = $7F) then ExecuteCommand('PLAYER 1-2 START');
if (Data2 = $00) then ExecuteCommand('PLAYER 1-2 STOP');
lm2 := Data2;
end;
if (Data1 = $04) then begin
ExecuteCommand('PLAYER 2-1 VOLUME ' + FloatToStr(f));
if (Data2 >= $01) and (lm4 = $00) and (on4 = $7F) then ExecuteCommand('PLAYER 2-1 START');
if (Data2 = $00) then ExecuteCommand('PLAYER 2-1 PAUSE');
lm4 := Data2;
end;
// VOICE TRACKING fader starts + VT PLAYER volumes
if (Data1 = $06) then begin
ExecuteCommand('VT PLAYER A VOLUME ' + FloatToStr(f));
if (Data2 >= $01) and (lma = $00) and (ona = $7F) then ExecuteCommand('VT PLAYER A START');
lma := Data2;
end;
if (Data1 = $07) then begin
ExecuteCommand('VT PLAYER B VOLUME ' + FloatToStr(f));
if (Data2 >= $01) and (lmb = $00) and (onb = $7F) then ExecuteCommand('VT PLAYER B START');
lmb := Data2;
end;
// REC button - starts / stops and saves Voice track recoding
if (Data1 = $2D) then begin
if (Data2 = $7F) and (lma = $7F) then ExecuteCommand('VT RECORD START');
if (Data2 = $00) then begin
ExecuteCommand('VT RECORD STOP');
ExecuteCommand('VT SAVE');
end;
end;
// STOP button - stops and cancel Voice track recording
if (Data1 = $2A) then begin
if (Data2 = $7F) then ExecuteCommand('VT RECORD CANCEL');
end;
// << button - rewinds PLAYER 2-1 to the beginning
if (Data1 = $2B) then begin
if (Data2 = $7F) then ExecuteCommand('PLAYER 2-1 RESET');
end;
// ON buttons on faders - start or stop respective player, when the respective fader is above 0 position
if (Data1 = $31) then begin
on1 := Data2
if (Data2 = $7F) and (lm1 > $00) then ExecuteCommand('PLAYER 1-1 START');
if (Data2 = $00) then ExecuteCommand('PLAYER 1-1 STOP');
end;
if (Data1 = $32) then begin
on2 := Data2
if (Data2 = $7F) and (lm2 > $00) then ExecuteCommand('PLAYER 1-2 START');
if (Data2 = $00) then ExecuteCommand('PLAYER 1-2 STOP');
end;
if (Data1 = $33) then begin
on3 := Data2
if (Data2 = $7F) then ExecuteCommand('CARTWALL MODE ON AIR');
if (Data2 = $00) then ExecuteCommand('CARTWALL MODE OFF AIR');
end;
if (Data1 = $34) then begin
on4 := Data2
if (Data2 = $7F) and (lm4 > $00) then ExecuteCommand('PLAYER 2-1 START');
if (Data2 = $00) then ExecuteCommand('PLAYER 2-1 STOP');
end;
if (Data1 = $36) then begin
ona := Data2
if (Data2 = $7F) and (lma > $00) then ExecuteCommand('VT PLAYER A START');
if (Data2 = $00) then ExecuteCommand('VT PLAYER A STOP');
end;
if (Data1 = $37) then begin
onb := Data2
if (Data2 = $7F) and (lmb > $00) then ExecuteCommand('VT PLAYER B START');
if (Data2 = $00) then ExecuteCommand('VT PLAYER B STOP');
end;
// SOLO buttons on faders - activate PFL mode on respective players
if (Data1 = $21) then begin
if (Data2 = $7F) then ExecuteCommand('PLAYER 1-1 PFL ON');
if (Data2 = $00) then ExecuteCommand('PLAYER 1-1 PFL OFF');
end;
if (Data1 = $22) then begin
if (Data2 = $7F) then ExecuteCommand('PLAYER 1-2 PFL ON');
if (Data2 = $00) then ExecuteCommand('PLAYER 1-2 PFL OFF');
end;
if (Data1 = $23) then begin
if (Data2 = $7F) then ExecuteCommand('CARTWALL MODE PFL');
if (Data2 = $00) then ExecuteCommand('CARTWALL MODE ON AIR');
end;
if (Data1 = $24) then begin
if (Data2 = $7F) then ExecuteCommand('PLAYER 2-1 PFL ON');
if (Data2 = $00) then ExecuteCommand('PLAYER 2-1 PFL OFF');
end;
if (Data1 = $26) then begin
if (Data2 = $7F) then ExecuteCommand('VT PLAYER A START');
if (Data2 = $00) then ExecuteCommand('VT PLAYER A STOP');
end;
if (Data1 = $27) then begin
if (Data2 = $7F) then ExecuteCommand('VT PLAYER B START');
if (Data2 = $00) then ExecuteCommand('VT PLAYER B STOP');
end;
end;
end;