Problem: two simultanous incoming messages and a toggle rule

red33mer

2008-11-18 15:00:30

Hello,

I got a Stanton DaScratch with 8 touchpads and want to merge every two so i get 4 outgoing messages. Thats is not a big deal with variables and if condition but additionaly i have a timer/Killswitch triggered by the pads aswell. To realise that i am using a toggle rule like user metastatik told me.

Example for Pad 1 (Midicontroller 79) and 2 (Midicontroller 81)

Code: Select all

Translator 1 (set_toggle_set_timer)
Incoming:  MIDI 90 xx 01
Rules:
  if xx==79 then Goto "Merge"
  if xx==81 then Goto "Merge"
  exit rules, skip outgoing Action
  Label "Merge"   
  ga = 1 – ga
  if ga!=1 then exit rules, skip Outgoing Action
Outgoing: Timer T1

Translator 2 (Kill Timer)
Incoming: MIDI 90 xx 01
if ga!=0 then exit rules, skip Outgoing Action
if xx==79 then exit rules, execute Outgoing Action
if xx==81 then exit rules, execute Outgoing Action
exit rules, skip Outgoing Action

Outgoing: Kill Timer T1 

Problem is: when Djing it happens that both fields are pressed simultaneously with one finger due to the fact that they have a very short distance. In this case the timer doesnt start. In my opinion this results from the toggle rule..the first midi message sets the toggle to 1 while the second one arrives a few milliseconds later and sets it to 0 again. That means that the timer is not executed...

How can i solve this problem? I dont get it....:-(
Please help if you can...

Thank You
[/code]

metastatik

2008-11-18 23:32:00

Yes, merging 2 incoming messages with the translators I posted would not work. Those were intended for a single button (field) to a single LED. Two fields to a single LED would be something like this…

Code: Select all

Translator 1 (Field 1 - set global/set timer) 
Options: Stop=False 
Incoming: MIDI 90 4F 01 
Rules: 
gb = 0
ga = 1 – ga 
If ga != 1 then exit rules, skip Outgoing Action 
Outgoing: Periodic timer “T1”: 250 ms (initial delay: 0 ms) 

Translator 2 (Field 2 - set global/set timer) 
Options: Stop=False 
Incoming: MIDI 90 51 01 
Rules: 
ga = 0
gb = 1 – gb
If gb != 1 then exit rules, skip Outgoing Action 
Outgoing: Periodic timer “T1”: 250 ms (initial delay: 0 ms) 

Translator 3 (Field 1+2 - kill timer) 
Options: Stop=False 
Incoming: MIDI 90 pp 01 
Rules: 
If pp = 79 then Goto “Kill”  
If pp = 81 then Goto “Kill”   
exit rules, skip outgoing Action 
Label "Kill" 
If ga = 1 then exit rules, skip Outgoing Action
If gb = 1 then exit rules, skip Outgoing Action
exit rules, execute Outgoing Action 
Outgoing: Kill timer “T1”

Translator 4 (LED) 
Options: Stop=False 
Incoming: On timer “T1” 
Rules: 
gc = 1 - gc 
If gc = 1 then pp = 144 
If gc = 0 then pp = 128 
Outgoing: MIDI pp 4F gc
HTH

red33mer

2008-11-20 21:27:33

Hi Metastatik,

thats an idea but in this case not working properly. The problem is that i have not only the situation that i press the two buttons accidentally simultanously but that i start with button 79 and kill with 79 or start with 79 and kill with 81 and vice versa.

That means, if i start the timer by pressing Button 79 and try to kill it with 81 its not working due to the fact that gb still has the value 0...

florian

2008-11-25 11:00:05

I think what you need is to track "how many" buttons are pressed at once. I.e. use gb as a counter.

Code: Select all

Translator 1 (set_toggle_set_timer)
Incoming:  MIDI 90 xx pp
Rules:
  if xx==79 then Goto "Merge"
  if xx==81 then Goto "Merge"
  exit rules, skip outgoing Action
  Label "Merge"
  if pp=1 then Goto Merge2
  if gb>0 then gb=gb-1
  exit rules, skip outgoing Action
  Label "Merge2"
  gb=gb+1
  if gb>1 then exit rules, skip Outgoing Action
  ga = 1 - ga
  if ga!=1 then exit rules, skip Outgoing Action
Outgoing: Timer T1

Translator 2 (Kill Timer)
Incoming: MIDI 90 xx 01
if ga!=0 then exit rules, skip Outgoing Action
if gb>1 then exit rules, skip Outgoing Action
if xx==79 then exit rules, execute Outgoing Action
if xx==81 then exit rules, execute Outgoing Action
exit rules, skip Outgoing Action
Outgoing: Kill Timer T1
Basically, you only start or stop the timer if only one button is currently pressed down. Pressing simultaneously a second button is ignored.

How does that work?
Florian