Send Controller Snapshot?

Discuss Lemur and share techniques.
mbncp
Regular
Posts: 87
Joined: 08 Dec 2011 07:25

Re: Send Controller Snapshot?

Post by mbncp »

I don't know what is the limit but it's probably larger than 256.No the reason is that no one wants to fill a huge array by hand, at least not me ;)
Trailerman
Newbie
Posts: 18
Joined: 08 Dec 2011 12:30

Re: Send Controller Snapshot?

Post by Trailerman »

mbncp wrote:Don't know why but I had in mind that you needed this for 200 controls, but if you just have a limited amount of controls this is easier to deal with:


Create a custom button control and add it this script, On Expression x then select the arrow up symbol (trigger when going from 0 to else).


decl obj, n, c, a;

a = {'mymultiline1', 'mymultiline2', 'myfader1' }; // add as many controls you have/need, watch the spelling
c = sizeof(a);

for (n = 0; n < c; n++)
{
obj = a[n];
setexpression(obj, 'x', getexpression(obj, 'x')); // force control to re-send midi out
}

You can then just make copies for each page, but make sure to set the correct names.
mbncp - again thank you!!

I'm trying to implement this script right now. I'm a complete newb to this kind of thing, but am following your instructions and the manual as best I can.

Just so I'm clear, in your a= line above, am I right in assuming that the controls I'm referencing need to be referenced exactly as they're named in my Project page? In other words if I have 10 individual faders named Fader 1 through 10, I would stipulate these exact same names in this line?

Also, in the setexpression line, am I right in thinking this line sends ALL the data from the appropriate faders and sends them on the correct channel automatically, or does this line also have to be repeated for each fader?

Sorry for being so dumb, and thank you again for all your help. I'll try and post the finished product top the templates page once it's up and running, in case it helps others.

Jules
Trailerman
Newbie
Posts: 18
Joined: 08 Dec 2011 12:30

Re: Send Controller Snapshot?

Post by Trailerman »

Sorry - next question:

What should the MIDI mapping properties be for the object which the script is assigned to? I'm using a simple 'custom button' set in 'pad' mode (in order that it transmits the state of all faders on the page whenever it is pressed - toggle wouldn't work correctly).

From tests so far, with the script in place, if I don't assign it a MIDI target, it doesn't seem to do anything at all (no MIDI data is transmitted when I press it). If I assign it a MIDI target then it just performs transmission of the MIDI message assigned to it in it's MIDI properties (note on etc.). Am I perhaps missing something here?

Sorry for my totally ignorance here.

Jules
Trailerman
Newbie
Posts: 18
Joined: 08 Dec 2011 12:30

Re: Send Controller Snapshot?

Post by Trailerman »

Screengrab in case it helps.
Attachments
Snapshot1A.jpg
Snapshot1A.jpg (229.48 KiB) Viewed 3488 times
mbncp
Regular
Posts: 87
Joined: 08 Dec 2011 07:25

Re: Send Controller Snapshot?

Post by mbncp »

oops, my bad, the array has to be filled with controls, not text.
so it should be:
a= {Fader1, Fader2, ....}; without the ' ' :oops:

multifaders, pads, switches ...
From what I see, a midi event will be automatically sent for each slider, pad, so no need to make a loop like x[0] = x[0]; x[1| = x[1]; ....
Trailerman
Newbie
Posts: 18
Joined: 08 Dec 2011 12:30

Re: Send Controller Snapshot?

Post by Trailerman »

No worries - just grateful for your help.

Presumably then the script should look like this (see below). Presumably also, the MIDI properties for the object the script is assigned to (my custom button) are irrelevant, because the button is forcing the faders to resend their current values, so any MIDI message the button itself sends would be in addition to this.

Unfortunately it doesn't result in any MIDI data being sent, so I can only assume the getexpression/setexpression part of the script doesn't work for some reason, or the data which is being returned to 'a' is not correct. Oh well - I really appreciate your help and will continue to try and figure it out.

Jules
Attachments
Snapshot1B.jpg
Snapshot1B.jpg (69.25 KiB) Viewed 3485 times
mbncp
Regular
Posts: 87
Joined: 08 Dec 2011 07:25

Re: Send Controller Snapshot?

Post by mbncp »

Don't know what's going wrong, I just tested using 3 faders, and pressing my custom button does send out the 3 cc's.
using midi monitor:

Code: Select all

14:00:29.728	From Daemon Input 0	Control	1	0	127
14:00:29.728	From Daemon Input 0	Control	1	1	127
14:00:29.728	From Daemon Input 0	Control	1	2	127
This is the template I used:
sendCtrlSnapshot.jzml.zip
(1.04 KiB) Downloaded 154 times
Btw, you have twice fader3 in your array, shouldn't make a difference though.


You can also post your project, it takes me a few seconds to get it running and testing.
Trailerman
Newbie
Posts: 18
Joined: 08 Dec 2011 12:30

Re: Send Controller Snapshot?

Post by Trailerman »

Got it!!

I had the 'x' value missing from the script header - doh.

All working now. Next challenge is to try and save settings as presets, but I have a tutorial on that, and now I understand some of the basic scripting functions should be good to go.

Many many thanks again!

Jules
kraftf
Regular
Posts: 124
Joined: 14 Dec 2011 06:36

Re: Send Controller Snapshot?

Post by kraftf »

mbncp wrote:I don't know what is the limit but it's probably larger than 256.No the reason is that no one wants to fill a huge array by hand, at least not me ;)
Actually I just realised that the limit for an array to be filled in with items is 256 indeed.
mbncp
Regular
Posts: 87
Joined: 08 Dec 2011 07:25

Re: Send Controller Snapshot?

Post by mbncp »

Damm you're right. It's funny because if I type this :

decl a;
a = {fill(1,1, 256), fill(1,2, 256)};
Monitor.value = sizeof(a);

Monitor shows 256

But ..

Monitor.value = sizeof({fill(0, 0, 256), fill(0, 0, 256)});

shows 512.

which is a bit weird IMO.

Not a big deal as we can use multiple variables, though coding could be more efficient in some situations if we had larger arrays.
Post Reply