Hey, I'm back
OK, so I've been playing a little more with Bomes and tried to wrap my head around things.
And though, I managed to achieve what I aimed for with my first simple project, I wonder if my solution is not very convoluted. And since I don't want to teach myself bad practices, I thought I'll ask here, if there are more straight forward ways to achieve what I wanted.
The goal:
Use the crossfader on the Nocturn to choose the track focus between one of 8 tracks. But in the end it's the very easy problem of how to translate a continuos encoder/fader and its range into several button presses.
So my fader sends on channel 6 (B5) with cc= 08 with the range rr between 0 and 127. B5 08 rr
For the range of rr between 0 and 16 I want it translate to button press: B5 11 F7
For the range of rr between 17 and 32 I want it translate to button press: B5 12 F7
For the range of rr between 33 and 48 I want it translate to button press: B5 13 F7
For the range of rr between 49 and 64 I want it translate to button press: B5 14 F7
For the range of rr between 65 and 80 I want it translate to button press: B5 15 F7
For the range of rr between 81 and 96 I want it translate to button press: B5 16 F7
For the range of rr between 97 and 112 I want it translate to button press: B5 17 F7
For the range of rr between 113 and 127 I want it translate to button press: B5 18 F7
I did this with one Translator first using If-Then statements. (I have to admit this is the first time I did any kind of programming, so If-Then statements were familiar as a concept, but I have never applied such a thing before)
The problem though was that there was no way to directly define ranges only greater than, equal to etc. so the first workaround started (Here I would be interested to know if defining ranges can be done with a more straight forward method. I was looking for something like: If rr between 17 and 32 Then ss = 18 )
Here is the first Translator:
Incoming: B5 08 rr
Outgoing: B5 ss F7
Rules:
if rr<=16 then ss=17
if ss==17 then Goto "End"
if rr<=32 then ss=18
if ss==18 then Goto "End"
if rr<=48 then ss=19
if ss==19 then Goto "End"
if rr<=64 then ss=20
if ss==20 then Goto "End"
if rr<=80 then ss=21
if ss==21 then Goto "End"
if rr<=96 then ss=22
if ss==22 then Goto "End"
if rr<=112 then ss=23
if ss==23 then Goto "End"
if rr<=127 then ss=24
if ss==24 then Goto "End"
Label "End"
exit rules, execute Outgoing Action
When I then tried to use this, it turned out that it only works for when I move the fader down, while moving it up did nothing. This is something I don't understand, I would have thought that I had already defined all possible conditions...
But alas the second workaround was applied. I added another translator in which I did everything from the other side:
Like this:
Incoming: B5 08 rr
Outgoing: B5 ss 7F
Rules:
if rr>=112 then ss=24
if ss==24 then Goto "End"
if rr>=96 then ss=23
if ss==23 then Goto "End"
if rr>=80 then ss=22
if ss==22 then Goto "End"
if rr>=64 then ss=21
if ss==21 then Goto "End"
if rr>=48 then ss=20
if ss==20 then Goto "End"
if rr>=32 then ss=19
if ss==19 then Goto "End"
if rr>=16 then ss=18
if ss==18 then Goto "End"
if rr>=0 then ss=17
if ss==17 then Goto "End"
Label "End"
exit rules, execute Outgoing Action
So while I have it working as desired, I'm wondering what would be cleaner ways to program that, and what problems could arise by doing it as I did.
Thanks, and cheers