This forum is read-only. Please post new topics in our Q&A forum.

Killing Time(ers)

General discussion about MIDI Translator

Moderators: florian, DvlsAdvct

Post Reply
timothyallan
User
Posts: 11
Joined: Mon Aug 20, 2007 12:10 pm

Killing Time(ers)

Post by timothyallan » Mon Aug 20, 2007 12:22 pm

Hi Florian, awesome bit of programming you've done :) . I have a quick question for you regarding MT Pro:

I have a midi button down press coming in at 7F.
First translater sets GA to 0.
Second translator triggers a timer that increments GA by 1 every 20ms

On midi button up 00 it kills that timer.

Also on that same button up 00 I have another timer that now starts decrementing GA by 1 every 20ms.

GA=GA-1
GA=GA-1
GA=GA-1
GA=GA-1
...

until GA = 0. How do I get the decrementing timer to stop when GA hits 0 without hitting any buttons? If timers could be executed GA times, it would solve it, but in the meantime? ;)

Cheers,
Tim

User avatar
florian
Bome Software: Founder
Posts: 2435
Joined: Thu Apr 28, 2005 10:09 pm
Location: Munich, Germany
Contact:

Post by florian » Tue Aug 21, 2007 12:28 am

I assume the second timer's Outgoing Action is None? then you can do this:

Code: Select all

Incoming: Timer 2
Rules:
 ga=ga-1
 if ga>0 Exit Rules, Do Not execute outgoing action
Outgoing: Kill Timer 2
Another way of optimizing (but not improving otherwise) is to use a variable gb as the amount of add/subtract:

Code: Select all

Translator 1: start timer
Incoming: button down 7f
Rule:
 ga=0
 gb=1
Outgoing: start Timer 1

Translator 2: reverse ga direction
Incoming: button up 00
Rule:
 gb=-1
Outgoing: None

Translator 2: on timer
Incoming: Timer 1
Rules:
 ga=ga+gb
 if ga>0 Exit Rules, Do Not execute outgoing action
Outgoing: Kill Timer 1
That way you don't need a second timer.

Regards,
Florian

Post Reply