Refactoring 100% template

Discuss Lemur and share techniques.
Post Reply
electrofux
Regular
Posts: 294
Joined: 24 Jan 2012 18:22

Refactoring 100% template

Post by electrofux »

My template is controling 20 Reason pattern sequencers and has Lemur controls for every one of them (among others a Multislider with 16 sliders, one ecoder for the edit mode, one for pattern direction, one for the sequencer rate, one for pattern length per track and another 40 objects like up and down buttons which dont send midi) which look the same for every track but because they are bidirectional i have an item for each control which adds up heavily. So i am thinking about refactoring.

For that i would need custom midis for every cc the Reason pattern sequencers sends (400 in total if i count right) and then set the cc# of that custom Midis via a variable triggered by a "selected track" button. Then i need a Midi script listening to the incoming midi and writing the values in an array (per track). I hope 20 Midi scripts are enough when i set it to multiple values that it listens to and then catch it with a "for" loop - i smell performance issues here(?). When i hit the selected track button it reads the array for that track, sets the Lemur items to the correct Midi ccs and then sets the value of the items to the values read out of the array - thats the plan.

Now the question is would that give me a significant amount of freed space considering i have to add a ton of custom Midis (400), arrays (20 and 20 wide) and listening Midi scripts (20) and probaly more variables and stuff. And is that the right way to go about refactoring such a muli track set up? The project is pretty huge so going that route would eat up alot of time and i don't want to come out with something worse than i have now.
Traxus
Regular
Posts: 211
Joined: 30 Nov 2012 06:19
Location: Detroit
Contact:

Re: Refactoring 100% template

Post by Traxus »

One thing I just figured out, if you aren't already, try one global midi listener (or as few as a midi script will allow) that then calls out to other static functions...

So something like onMidi:
Target 0
CC 0 - CC 127
Channel 1

Code: Select all

decl cc = MIDI_ARGS[0];
decl v = MIDI_ARGS[1];

if (cc >= 10 && cc <= 14) {
    staticFunction(cc,v);
}

if (cc >= 14 && cc <= 16) {
    staticFunction2(cc,v);
}
Post Reply