Best Practice

NormtheMusician

2020-08-13 12:42:12

I've been working on using a launchpad Mk2 to control keyswitches in my DAW, and all is going really well (thanks for your help with switching lights on and off).

A simple question - Is it better to have multiple Presets or multiple translators or very long individual translators with lots of 'goto' instructions?

Which gives better performance ?

Here is an extract from one translator I've created (there are 1821 lines in the full version), and I'd be interested in knowing if it would be better to separate each sample set into either a different translator or different preset, or doesn't it make any difference (except in finding the right one to edit)?

 

//----------------------------------------------------
if zn==hb then he=hb

//if zc==2 then gv=0

//----------------------------------------------------

//Round button 1
if ic==104 then Goto "BBC SO"

//Round button 2
if ic==105 then Goto "VSL"

//Round button 3
if ic==106 then Goto "SYNCHRONSMARTORCHXP"

// Round button 4
if ic==107 then Goto "BIG BANG LOW BRASS"

// Round button 5
if ic==108 then Goto "BIG BANG HIGH STRINGS"

//************************************************************
//************************************************************
//************************************************************

// Round button 6 with variation

if ic!=109 then skip next 2 rules
if id!=1 then skip next rule
if ic==109 then Goto "BIG BANG LOW STRINGS"

if ic!=109 then skip next 2 rules
if id!=2 then skip next rule
if ic==109 then Goto "BIG BANG HIGH & LOW STRINGS"

if ic!=109 then skip next 2 rules
if id!=3 then skip next rule
Goto "HISTORIC TRAVERSE FLUTE"

//************************************************************
//************************************************************
//************************************************************

// Round button 7 WITH BUTTON variations

// if ic=110 and id = 1 then goto "SYNCHRONIZED SOLO VIOLIN"

//if ic==110 then Goto "SYNCHRONIZED SOLO VIOLIN"
if ic!=110 then skip next 2 rules
if id!=1 then skip next rule
Goto "SYNCHRONIZED SOLO VIOLIN1"

//if ic==110 then Goto "SYNCHRONIZED SOLO VIOLIN2"
if ic!=110 then skip next 2 rules
if id!=2 then skip next rule
Goto "SYNCHRONIZED SOLO VIOLIN2"

//if ic==110 then Goto "SYNCHRONIZED SOLO VIOLIN3"
if ic!=110 then skip next 2 rules
if id!=3 then skip next rule
Goto "SYNCHRONIZED SOLO VIOLIN3"

//************************************************************
//************************************************************
//************************************************************

// Round button 8
//if ic==111 then Goto "SYNCHRONIZED SOLO VIOLIN2"

//****************************************************
//****************************************************
Label "BBC SO"
//Triggered by round button 1
za=0
if hb==36 then za=1
if hb==36 then he=21
if hb==35 then za=1
if hb==35 then he=20
if hb==34 then za=1
if hb==34 then he=19
if hb==33 then za=1
if hb==33 then he=18
if hb==32 then za=1
if hb==32 then he=17
if hb==31 then za=1
if hb==31 then he=16
if hb==28 then za=1
if hb==28 then he=15
if hb==27 then za=1
if hb==27 then he=14
if hb==26 then za=1
if hb==26 then he=13
if hb==25 then za=1
if hb==25 then he=12
if hb==24 then za=1
if hb==24 then he=11
if hb==23 then za=1
if hb==23 then he=10
if hb==22 then za=1
if hb==22 then he=9
if hb==21 then za=1
if hb==21 then he=8

if hb==18 then za=1
if hb==18 then he=7
if hb==17 then za=1
if hb==17 then he=6
if hb==16 then za=1
if hb==16 then he=5
if hb==15 then za=1
if hb==15 then he=4
if hb==14 then za=1
if hb==14 then he=3
if hb==13 then za=1
if hb==13 then he=2
if hb==12 then za=1
if hb==12 then he=1
if hb==11 then za=1
if hb==11 then he=0
Goto "END"

//---------------------------------------------------

Label "VSL"
//Triggered by round button 2

 

 

Steve-Bome Forum Moderator

2020-08-13 16:31:12

Hi,

My personal preference is to use less translators with more rules.  I have never run into performance issues (yet), and for me,  it is more efficient if I want to make wide spread  changes.  I can copy and paste existing rules into a text editor, edit them and then copy and paste them back into rules when done.

If I ever run into performance issues using the rules method, I can then determine what functions to split into different translators.  Translators can sometimes execute outgoing actions in parallel, however care must be taken when using global variables to avoid race conditions.

The documentation (F1 or help from within MT Pro) doesn't provide much detail on what can be parallel and what cannot and I have never tested it.  I assume that different incoming or outgoing actions on different ports can easily be in parallel while outgoing actions to a given MIDI port probably needs to be serial.

I have found in most cases, performance issues are introduced by the user in the way of introducing delays with timers or in some cases MIDI loops.

Again, my current recommendation for code maintainability is to stick with less translators and more rules. However if you have to manage different outgoing action types or different routing, you will be forced to use different translators.

I hope this helps!

 

Steve Caldwell
Bome Customer Care


Also available for paid consulting services: bome@sniz.biz

NormtheMusician

2020-08-13 18:08:44

Thank you.  Performance seemed fine, although it took a while for the rules to show if I wanted to look at them - which is why I posed the question.