Forums > Max For Live

Does Speedlim work when editing patches in M4L?

February 16, 2013 | 6:10 pm

If i try to use speedlim in an amxd device then when I am in device edit mode messages do not seem to pass through the speedlim object at all; it becomes a black hole eating all input. This makes a wide variety of thing more complex than they ought to be. OTOH it works fine if I load a frozen device with speedlim in.

To demonstrate what i mean, I have created an M4L device wherein speedlim doesn’t work. If you load it up as a device, you can drag the upper number box and the lwoer number box will claim to receive updates every 200ms. But if you unfreeze and edit it, doesn’t do anything.

https://www.dropbox.com/s/n1eagx5wqmw4lsa/does.speedlim.work.amxd

For comparison, I have the same patch as a vanilla Max patch linked and pasted below.

https://www.dropbox.com/s/mb3zqla32styvcn/does.speedlim.work.maxpat

Works fine.

Is there something about scheduling that I am not understanding here?

Dan

– Pasted Max Patch, click to expand. –

April 5, 2013 | 10:23 pm

I just heard from the bug team about this one.

Apparently the answer is: "no. it’s a bug"



Lee
April 6, 2013 | 3:41 am

at least it’ll get fixed then :)


May 5, 2013 | 10:05 pm

That’s what you’d think, isn’t it, Lee? However, it didn’t get fixed in the latest version of Max.

So anyway, I wrote a "speedlim" in javascript which I am replacing the broken max "speedlim" objects with. This might be useful to anyone else who wishes to limit the rates of messages and also use M4L.

var s_interval = 10.0;
var s_output_task = "nothing";
var s_output_task_exists = false;
var s_message_content = "nothing";
var s_kill_on_next_loop = false;

if(jsarguments.length>1) {
   s_interval = jsarguments[1];
}
if (s_interval< =0.0) {
	s_interval = 10.0;
}
function anything() {
	s_message_content = arrayfromargs(messagename, arguments);
	if (!s_output_task_exists) {
		s_output_task_exists = true;
		s_output_task = new Task(_output_stuff, this);
		s_output_task.interval = s_interval;
		s_output_task.repeat();
		s_kill_on_next_loop = false;
	} else {
		s_kill_on_next_loop = false;
	};
}
function _output_stuff() {
	outlet(0, s_message_content);
	if (s_kill_on_next_loop) {
		s_output_task_exists = false;
		arguments.callee.task.cancel();
		s_output_task = "nothing";
	}
	s_kill_on_next_loop = true;
}

June 6, 2013 | 1:16 am

Thanks for this.

Good to know its a bug. Thought I was going mad there for a second.


June 6, 2013 | 2:12 am

I personally prefer doing atrocities with metro and zl reg, but I guess I can see how a js replacement might help ;)


Viewing 6 posts - 1 through 6 (of 6 total)