Programmatically modify M4L device width?

adamflorin's icon

I'm building a Max For Live device which needs to be able to expand or contract its width based on user interaction.

How can I do this programmatically? I've been futzing around with thispatcher and pattr to no avail...

I see that 'devicewidth' is a basic patcher arg when I open my .amxd file in a source code editor.

Any ideas?

adamflorin's icon

OK, I see that I can freely modify this parameter in the js object with one line:

this.patcher.devicewidth(width)

And I see this resize the box when I'm editing in Max. But Live won't resize its box dynamically. Is there a way to trigger Live to reload the patch?

Jan M's icon

Does anyone knows if there are any news on setting the device width dynamically? The change log of Max 6.1.1 states "device width settable". And I think I remember that Julien Bayle posted something about that somewhere outside this forum (was is facebook???). Though I cannot find anything about that in the documentation of the LOM and the behavior ofthis.patcher.devicewidth(width) hasn't changed. (I'm on Live 9 (32bit) Max 6.1.1 (32bit) Mountain Lion)

Jan

flocked's icon

send a message "setwidth xxx" to a live.thisdevice object.

;)

Jan M's icon

Ah!!!!!! thanks!!

queglay's icon

thats very handy.  thanks.  how is the default m4l device width defined?  even though i have everything hidden from presentation mode, the device width seems to take the maximum of everything.

Marcos's icon

Does the above message dynamically resize the device in Live? I haven't tried it yet, but if it does, that is awesome.

mooter's icon

I'm using the line object to smoothly widen the device if need be (from a toggle, not manually), and it works when the editor is open but not when it's closed. Is it just currently not set up to handle that at the moment?