need help with template code

Discuss Lemur and share techniques.
Post Reply
drewboles
Newbie
Posts: 20
Joined: 01 Feb 2012 19:03

need help with template code

Post by drewboles »

Hello everybody -
I've created a MIDI sequencer using M4L and Lemur, but I am having a small problem.
The dimensions of the switches I am using are being controlled by expressions so that if I use the template in another session and need to resize/reorient these switches, I can do so easily (the fader entitled "count" enables the constant changing of these dimensions, which is why I have to use expressions, rather than just entering these values into the switches directly).

My problem, though, is that, due to a patch of code in the "count" fader, whenever I open up the template anew, all of the sequencer switches revert to their minimum size (X: 0, Y: 0, W: 384, H: 24). When I move the "count" fader, they snap back to the position determined by the expressions. However, I want to be able to open it and have it in the right place to begin with!

I've discovered the following code to be the culprit, but I don't know what changes to make so that the dimensions will load properly each time. I've pasted the errant code below - it seems that everything under the "if(mode.x==0)" brackets are the problem. Unfortunately, though, I cannot remove this entirely, as it obviously affects how this template runs.

I'm also attaching a .jzlib of my template so that you can see what I'm talking about. Anybody have ideas about how to fix this? Thanks!

else if(ch==0)
{
setattribute(sequencer1,'column',r);
setattribute(sequencer2,'column',r);
setattribute(sequencer3,'column',r);
setattribute(sequencer4,'column',r);
setattribute(sequencer5,'column',r);
setattribute(sequencer6,'column',r);
setattribute(sequencer7,'column',r);
setattribute(sequencer8,'column',r);
if(mode.x==0)
{
setobjectrect(sequencer1,{xl,yh,r*length,height});
setobjectrect(sequencer2,{xl,yh+(height*1),r*length,height});
setobjectrect(sequencer3,{xl,yh+(height*2),r*length,height});
setobjectrect(sequencer4,{xl,yh+(height*3),r*length,height});
setobjectrect(sequencer5,{xl,yh+(height*4),r*length,height});
setobjectrect(sequencer6,{xl,yh+(height*5),r*length,height});
setobjectrect(sequencer7,{xl,yh+(height*6),r*length,height});
setobjectrect(sequencer8,{xl,yh+(height*7),r*length,height});
}
Attachments
sequencer_testing.jzlib
sequencer lemur template
(46.6 KiB) Downloaded 77 times
Post Reply