Posted: 13 Oct 2007, 10:33
hello,
Like the title say, i experienced a midi behavior with version 3.22 and above, with a patch i originaly created in version 3.05.
I dont know if it's a bug or a bad scripting use, i explain :
I have a brunch of buttons controled by an Alesi ControlPad (who send a midi not on and a midi note off when a pad is hited).
these buttons go in a script, who produce some variable to control a selected element of a 4*3 matrice (like column selected, row selected, and some actions on this element)
here is the script to show you what it does :
-----------------------------------------------------------------------
//////////////////////////////////////////////////////
// Paramters declaration
//////////////////////////////////////////////////////
...
...
//////////////////////////////////////////////////////
// initialisation procedure
//////////////////////////////////////////////////////
procedure init;
begin
// Inputs
pMicOnOff := CreateParam('Mic MUTE',ptButton);
SetIsOutput(pMicOnOff,false);
pLayerInc := CreateParam('Layer INC',ptButton);
SetIsOutput(pLayerInc,false);
pTrackInc := CreateParam('Track INC',ptButton);
SetIsOutput(pTrackInc,false);
pLayerExlcusif := CreateParam('Layer EXCLU',ptSwitch);
SetIsOutput(pLayerExlcusif,false);
pLayerOnOff := CreateParam('Layer ON/OFF',ptButton);
SetIsOutput(pLayerOnOff,false);
pSampleOnOff := CreateParam('Sample ON/OFF',ptButton);
SetIsOutput(pSampleOnOff,false);
// outputs
pMicMute := CreateParam('Mic MUTE',ptButton);
SetIsInput(pMicMute,false);
pLayer01 := CreateParam('Layer 01 ON',ptSwitch);
SetIsInput(pLayer01,false);
pLayer02 := CreateParam('Layer 02 ON',ptSwitch);
SetIsInput(pLayer02,false);
pLayer03 := CreateParam('Layer 03 ON',ptSwitch);
SetIsInput(pLayer03,false);
pSampleOn := CreateParam('Sample ON',ptButton);
SetIsInput(pSampleOn,false);
pActiveLayer := CreateParam('Cur layer',ptDataField);
SetIsInput(pActiveLayer,false);
pActiveTrack := CreateParam('Cur track',ptDataField);
SetIsInput(pActiveTrack,false);
pActiveSample := CreateParam('Cur sample',ptDataField);
SetIsInput(pActiveSample,false);
vActiveLayer := 0;
vActiveTrack := 0;
vLastSampleOn := 0;
vSampleOn := 0;
end;
//////////////////////////////////////////////////////
// Main Loop procedure
//////////////////////////////////////////////////////
begin
// Incrementation must be made before checkings values
// Active layer incrementation
vLayerInc := getValue(pLayerInc);
IF vLayerInc=1 THEN BEGIN
vActiveLayer := vActiveLayer + 1;
IF vActiveLayer>2 THEN BEGIN
vActiveLayer :=0;
END;
END;
// Active track incrementation
vTrackInc := getValue(pTrackInc);
IF vTrackInc=1 THEN BEGIN
vActiveTrack := vActiveTrack + 1;
IF vActiveTrack>3 THEN BEGIN
vActiveTrack :=0;
END;
END;
// Checking values
// Layers ON / OFF
vLayerEXCLU := getValue(pLayerExlcusif);
vLayerON := getValue(pLayerOnOff);
IF vLayerON=1 THEN BEGIN
IF vActiveLayer=0 THEN BEGIN
SetValue(pLayer01,1 - GetValue(pLayer01) );
IF vLayerEXCLU= 1 THEN BEGIN
SetValue(pLayer02, 0 );
SetValue(pLayer03, 0 );
END;
END;
IF vActiveLayer=1 THEN BEGIN
SetValue(pLayer02,1 - GetValue(pLayer02) );
IF vLayerEXCLU= 1 THEN BEGIN
SetValue(pLayer01, 0 );
SetValue(pLayer03, 0 );
END;
END;
IF vActiveLayer=2 THEN BEGIN
SetValue(pLayer03,1 - GetValue(pLayer03) );
IF vLayerEXCLU= 1 THEN BEGIN
SetValue(pLayer01, 0 );
SetValue(pLayer02, 0 );
END;
END;
END;
// Output values update
SetValue( pMicMute , getValue( pMicOnOff ) );
SetValue(pSampleOn, getValue(pSampleOnOff) );
SetValue(pActiveSample,vActiveLayer + 1 + (vActiveTrack * 3) );
SetValue(pActiveLayer, vActiveLayer + 1 );
SetValue(pActiveTrack, vActiveTrack + 1 );
end.
-----------------------------------------------------------------------
for example, when i hit the pad who control the "layer down" button, it select the next of three samplers on the track (and loop to one after three)
with the 3.05 version, it work like a charme. But with 3.22 version and above, i have sometime some action ramdomly doubled, who make my patch acting very weird (for example, the selected element snap from 1 to 3 with only one pad hit).
I dont know if the way i coded my script is valid, it's like if now, the audio engine is so speed then the script main loop can process two time when the button is down.
hope it's clear enough, and someone can help
Like the title say, i experienced a midi behavior with version 3.22 and above, with a patch i originaly created in version 3.05.
I dont know if it's a bug or a bad scripting use, i explain :
I have a brunch of buttons controled by an Alesi ControlPad (who send a midi not on and a midi note off when a pad is hited).
these buttons go in a script, who produce some variable to control a selected element of a 4*3 matrice (like column selected, row selected, and some actions on this element)
here is the script to show you what it does :
-----------------------------------------------------------------------
//////////////////////////////////////////////////////
// Paramters declaration
//////////////////////////////////////////////////////
...
...
//////////////////////////////////////////////////////
// initialisation procedure
//////////////////////////////////////////////////////
procedure init;
begin
// Inputs
pMicOnOff := CreateParam('Mic MUTE',ptButton);
SetIsOutput(pMicOnOff,false);
pLayerInc := CreateParam('Layer INC',ptButton);
SetIsOutput(pLayerInc,false);
pTrackInc := CreateParam('Track INC',ptButton);
SetIsOutput(pTrackInc,false);
pLayerExlcusif := CreateParam('Layer EXCLU',ptSwitch);
SetIsOutput(pLayerExlcusif,false);
pLayerOnOff := CreateParam('Layer ON/OFF',ptButton);
SetIsOutput(pLayerOnOff,false);
pSampleOnOff := CreateParam('Sample ON/OFF',ptButton);
SetIsOutput(pSampleOnOff,false);
// outputs
pMicMute := CreateParam('Mic MUTE',ptButton);
SetIsInput(pMicMute,false);
pLayer01 := CreateParam('Layer 01 ON',ptSwitch);
SetIsInput(pLayer01,false);
pLayer02 := CreateParam('Layer 02 ON',ptSwitch);
SetIsInput(pLayer02,false);
pLayer03 := CreateParam('Layer 03 ON',ptSwitch);
SetIsInput(pLayer03,false);
pSampleOn := CreateParam('Sample ON',ptButton);
SetIsInput(pSampleOn,false);
pActiveLayer := CreateParam('Cur layer',ptDataField);
SetIsInput(pActiveLayer,false);
pActiveTrack := CreateParam('Cur track',ptDataField);
SetIsInput(pActiveTrack,false);
pActiveSample := CreateParam('Cur sample',ptDataField);
SetIsInput(pActiveSample,false);
vActiveLayer := 0;
vActiveTrack := 0;
vLastSampleOn := 0;
vSampleOn := 0;
end;
//////////////////////////////////////////////////////
// Main Loop procedure
//////////////////////////////////////////////////////
begin
// Incrementation must be made before checkings values
// Active layer incrementation
vLayerInc := getValue(pLayerInc);
IF vLayerInc=1 THEN BEGIN
vActiveLayer := vActiveLayer + 1;
IF vActiveLayer>2 THEN BEGIN
vActiveLayer :=0;
END;
END;
// Active track incrementation
vTrackInc := getValue(pTrackInc);
IF vTrackInc=1 THEN BEGIN
vActiveTrack := vActiveTrack + 1;
IF vActiveTrack>3 THEN BEGIN
vActiveTrack :=0;
END;
END;
// Checking values
// Layers ON / OFF
vLayerEXCLU := getValue(pLayerExlcusif);
vLayerON := getValue(pLayerOnOff);
IF vLayerON=1 THEN BEGIN
IF vActiveLayer=0 THEN BEGIN
SetValue(pLayer01,1 - GetValue(pLayer01) );
IF vLayerEXCLU= 1 THEN BEGIN
SetValue(pLayer02, 0 );
SetValue(pLayer03, 0 );
END;
END;
IF vActiveLayer=1 THEN BEGIN
SetValue(pLayer02,1 - GetValue(pLayer02) );
IF vLayerEXCLU= 1 THEN BEGIN
SetValue(pLayer01, 0 );
SetValue(pLayer03, 0 );
END;
END;
IF vActiveLayer=2 THEN BEGIN
SetValue(pLayer03,1 - GetValue(pLayer03) );
IF vLayerEXCLU= 1 THEN BEGIN
SetValue(pLayer01, 0 );
SetValue(pLayer02, 0 );
END;
END;
END;
// Output values update
SetValue( pMicMute , getValue( pMicOnOff ) );
SetValue(pSampleOn, getValue(pSampleOnOff) );
SetValue(pActiveSample,vActiveLayer + 1 + (vActiveTrack * 3) );
SetValue(pActiveLayer, vActiveLayer + 1 );
SetValue(pActiveTrack, vActiveTrack + 1 );
end.
-----------------------------------------------------------------------
for example, when i hit the pad who control the "layer down" button, it select the next of three samplers on the track (and loop to one after three)
with the 3.05 version, it work like a charme. But with 3.22 version and above, i have sometime some action ramdomly doubled, who make my patch acting very weird (for example, the selected element snap from 1 to 3 with only one pad hit).
I dont know if the way i coded my script is valid, it's like if now, the audio engine is so speed then the script main loop can process two time when the button is down.
hope it's clear enough, and someone can help