Welcome to %s forums

BrainModular Users Forum

Login Register

midi behavior change in version 3.22 and above

I need help on a Patch
Post Reply
martignasse
Site Admin
Posts: 611
Location: Lyon, FRANCE
Contact:

Unread post by martignasse » 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
Martin FLEURENT - Usine Developer - SDK maintainer

martignasse
Site Admin
Posts: 611
Location: Lyon, FRANCE
Contact:

Unread post by martignasse » 13 Oct 2007, 10:35

ooops, seem's like my message what published when i asked a preview !!

sorry for the triple posting
Martin FLEURENT - Usine Developer - SDK maintainer

User avatar
senso
Site Admin
Posts: 4425
Location: France
Contact:

Unread post by senso » 13 Oct 2007, 14:56

as I said in the announcement of the new version:
Important
-The new behaviour of the key learn on switches may cause some surprising results.
Now in absolute mode switches are turned ON when the key is pressed and OFF when the key is released.
In toggle mode, switches are turned ON when the key is pressed and OFF when the key pressed a second time.
You'll probably need to update your remotes.
maybe it can come from this new behaviour?

or you can add lines in the script:

Code: Select all

// Incrementation must be made before checkings values
// Active layer incrementation
vLayerInc := getValue(pLayerInc);
IF vLayerInc=1 THEN BEGIN
--->>>setvalue(pLayerInc,0);
   vActiveLayer := vActiveLayer + 1;
   IF vActiveLayer>2 THEN BEGIN
    vActiveLayer :=0;
    END;
END;

// Active track incrementation
vTrackInc := getValue(pTrackInc);
IF vTrackInc=1 THEN BEGIN
  --->>> setvalue(pTrackInc,0);
   vActiveTrack := vActiveTrack + 1;
   IF vActiveTrack>3 THEN BEGIN
    vActiveTrack :=0;
   END;
END;

martignasse
Site Admin
Posts: 611
Location: Lyon, FRANCE
Contact:

Unread post by martignasse » 13 Oct 2007, 19:53

senso wrote:as I said in the announcement of the new version:
Important
-The new behaviour of the key learn on switches may cause some surprising results.
Now in absolute mode switches are turned ON when the key is pressed and OFF when the key is released.
In toggle mode, switches are turned ON when the key is pressed and OFF when the key pressed a second time.
You'll probably need to update your remotes.
maybe it can come from this new behaviour?
If i dont misunderstood, this apply only with version 3.30 and above, and my problem appear with the version 2.22.
Anyway, i dont use switch, i use button, who aren't affected by this new behaviour, i'm right ?.

thats why i dont think this could be that.
senso wrote:or you can add lines in the script:

Code: Select all

// Incrementation must be made before checkings values
// Active layer incrementation
vLayerInc := getValue(pLayerInc);
IF vLayerInc=1 THEN BEGIN
--->>>setvalue(pLayerInc,0);
   vActiveLayer := vActiveLayer + 1;
   IF vActiveLayer>2 THEN BEGIN
    vActiveLayer :=0;
    END;
END;

// Active track incrementation
vTrackInc := getValue(pTrackInc);
IF vTrackInc=1 THEN BEGIN
  --->>> setvalue(pTrackInc,0);
   vActiveTrack := vActiveTrack + 1;
   IF vActiveTrack>3 THEN BEGIN
    vActiveTrack :=0;
   END;
END;
Yep, you think about reseting the button after checked his value, i'll try that, it's what i suspected when i said "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."


And thanks for this beautiful 3.3 version, it's really rock
Martin FLEURENT - Usine Developer - SDK maintainer

User avatar
senso
Site Admin
Posts: 4425
Location: France
Contact:

Unread post by senso » 14 Oct 2007, 08:59

yes normally you have to reset buttons values after the test.
It's really time to write a script manual.....

martignasse
Site Admin
Posts: 611
Location: Lyon, FRANCE
Contact:

Unread post by martignasse » 16 Oct 2007, 12:16

ok, i had time to make some little test.

my problem seem's to be a mix of the button mode (toggle instead of absolut) and bad scripting.

I have to make more deep test to confirme, but with button mode to "toggle", and each buttons reseted after treatement, and a boolean update variable be sure to make the counting once, it's seem's to be ok.

in conclusion, usine seem's to be less permissive, but more speed and powerful, witch is good.
Martin FLEURENT - Usine Developer - SDK maintainer

Post Reply

Who is online

Users browsing this forum: No registered users and 195 guests