florian wrote:RichardT wrote:Are you thinking I can just get away with just checking a change in gd?Rich
It should suffice: each time you turn by more than 4 (or whatever number you put in), it will be
valid. You can increase the amount you need to turn by using a larger number than 4.
Hi Florian, I've made some changes to my script along the lines you suggest. It's working but there is a strange feature which may or may not be a bug, I'm not sure.
The script now has four translators and looks like this
Code: Select all
[Project]
Version=1
[Preset.0]
Name=Novation SL 1
Active=1
Name0=Track Select: Identify wanted messages
Incoming0=MID1B008pp
Outgoing0=None
Options0=Actv01Stop00OutO00StMa00000005gv=0if(gl==0)gl=ppgd=pp-glif(gd>=12)gv=1if(gd<=-12)gv=1
Name1=Track Select: Send keystroke right if turned to the right
Incoming1=MID1B008pp
Outgoing1=KAM10100KSQ1000E012126326212012126326212012126326212127327
Options1=Actv01Stop00OutO00StMa00000002if(gd<=0)noexecuteif(gv==0)noexecute
Name2=Track Select: Send keystroke left if turned to the left
Incoming2=MID1B008pp
Outgoing2=KAM10100KSQ1000E012126326212012126326212012126326212125325
Options2=Actv01Stop00OutO00StMa00000002if(gd>=0)noexecuteif(gv==0)noexecute
Name3=Track Select: Store Last Value
Incoming3=MID1B008pp
Outgoing3=None
Options3=Actv01Stop01OutO00StMa00000001if(gv==1)gl=pp
Basically, this script works as follows
- the first translator sets the variable gv to 1 if the control midi value has moved 12 or more in either direction, otherwise to 0. In addition it initialises the last value to the current value if required.
- the second picks up positive moves when gv = 1. It then issues a series of keystrokes to move focus to the session list in Live and move one track to the right
- the third picks up negative moves when gv = 1 and does the same as above, but going left
- the fourth sets the last value to current value if gv = 1.
The problem I'm having is that when I start with the control at 0, and turn it right, the first time it sets gv = 1 it doesn't execute the second translator. By which I mean the log shows the incoming event of the translator but there is nothing else shown for it. At least, that's what I think is happening. The next time it sets gv = 1, it does execute the second step.
This might be a programming error of course (quite likely!), but it doesn't look right to me and I'm stuck. If you have time to look at this, please let me know what you think.
This doesn't stop the script doing the job it's supposed to, but it does mean that the control feels sluggish when at the left hand end of the dial.
Here's an extract from the log for all the processing when the difference value first reaches 12. The line that puzzles me is in bold
- IN : MIDI B0 08 15, pp=0x15
assignment: (gv=0) = 0
assignment: (gd=pp-gl) = 12
condition satisfied: if gd>=12 then gv=1
assignment: (if gd>=12 then gv=1) = 1
IN : MIDI B0 08 15, pp=0x15
IN : MIDI B0 08 15, pp=0x15
condition satisfied: if gd>=0 then exit rules, skip Outgoing Action
IN : MIDI B0 08 15, pp=0x15
condition satisfied: if gv==1 then gl=pp
assignment: (if gv==1 then gl=pp) = 21
I've got some suggestions that would really help debug...
- - a facility to put comments either as rule steps or as notes against each rule step
- could the log show the translator name and step number?
- could you add a facility to translate the script into meaningful English, in the way that you do when you include a script in a post
I've also noticed that when I start the program minimized, it doesn't pass messages on. Is that supposed to happen?
thanks very much.
Rich