General
Undocumented functions
Started by xanadu on .
Sign in or create an account to join the conversation.
It would be nice if we where able to create and destroy controllers from within MaxMSP. As is appears, there are some undocumented functions for the Lemur.
The function [color=#000080]destroyobject(obj);[/color] deletes an object from the project layout. Also, the function [color=#000080]createobject(p, q, r, s);[/color] appears to be syntactically right. But I can't get this to create a new object on the Lemur/iPad.
I wrote a little script to test this:
Does anyone know how to use createobject?
Are there other undocumented functions known to lemur users on this forum?
Cheers,
Xanadu
The function [color=#000080]destroyobject(obj);[/color] deletes an object from the project layout. Also, the function [color=#000080]createobject(p, q, r, s);[/color] appears to be syntactically right. But I can't get this to create a new object on the Lemur/iPad.
I wrote a little script to test this:
oscout(0, '/Test_Undocumented_Functions', 'Start');
decl p = findobject('Text2');
oscout(0, '/before_destroyobject', {p});
destroyobject(p);
p = findobject('Text2');
oscout(0, '/after_destroyobject', {p});
decl obj = createobject('Fader', 'FaderX', {0, 0, 60, 200}, RGB(70, 70, 70));
oscout(0, '/Created_object', {obj});
decl q = findobject('FaderX');
oscout(0, '/Found_object', {q});
oscout(0, '/Test_Undocumented_Functions', 'Ready');
The output is:LEMUR: /Test_Undocumented_Functions Start
LEMUR: /before_destroyobject 8828540
LEMUR: /after_destroyobject 0
LEMUR: /Created_object 0
LEMUR: /Found_object 0
LEMUR: /Test_Undocumented_Functions Ready
The deletion works, but the creation of a new control fails. I suppose this function needs other arguments.Does anyone know how to use createobject?
Are there other undocumented functions known to lemur users on this forum?
Cheers,
Xanadu
Hi,
They are undocumented because they could very well crash at any time, and disappear in any update.
Anyway if you want to try them out, the arguments are as follow :
createobject('Fader', 'FaderX', {0,0,60,200}, parent)
where parent is the path to the parent object, or zero to create it at the root of current interface.
For instance : createobject('Fader', 'FaderX', {0,0,60,200}, Container1.Container2)
They are undocumented because they could very well crash at any time, and disappear in any update.
Anyway if you want to try them out, the arguments are as follow :
createobject('Fader', 'FaderX', {0,0,60,200}, parent)
where parent is the path to the parent object, or zero to create it at the root of current interface.
For instance : createobject('Fader', 'FaderX', {0,0,60,200}, Container1.Container2)
don't know if they are listed in the new manual, but some that multi-line script and variables undestands are:
frame
pi
setattribute(objetc, 'color',HSV())
cheers,
frame
pi
setattribute(objetc, 'color',HSV())
cheers,
Thanks Axel, it works! I just could not figure out the parent parameter. I know that I'm on my own when using undocumented functions.
This opens the possibility to create an empty model and set the layout on the fly. Another use of this would be to create a layout using MaxMSP code. Then save it on the iPad, synchronize it to iTunes and finish the layout and scripts in the Lemur Editor. Using code for creating repeating objects can be used for accurate placement of objects and take away the tediousness.
My best guess is that createobject uses the same code that the Lemur uses when importing a .JZML file, which is rock-steady.
When the parameters change I have to find out about the new functionality and only change it in the empty model. But if this happens that means that you guys at Liine are taking the development of the Lemur code to new horizons. That would be a good thing!
Cheers,
Willem aka Xanadu.
This opens the possibility to create an empty model and set the layout on the fly. Another use of this would be to create a layout using MaxMSP code. Then save it on the iPad, synchronize it to iTunes and finish the layout and scripts in the Lemur Editor. Using code for creating repeating objects can be used for accurate placement of objects and take away the tediousness.
My best guess is that createobject uses the same code that the Lemur uses when importing a .JZML file, which is rock-steady.
When the parameters change I have to find out about the new functionality and only change it in the empty model. But if this happens that means that you guys at Liine are taking the development of the Lemur code to new horizons. That would be a good thing!
Cheers,
Willem aka Xanadu.
Createobject does sounds very useful. Especially for something like a live clip launcher. You could dynamically create a bunch of buttons and faders for instance to match the number of tracks you have live.
As I make often changes to my setup I would love to create object by coding, but a create object by itself isn't really useful, at least it would be nice to attach an on expression script and some variables. Are those functions available ?
No, there are no such functions at the time.mbncp wrote:As I make often changes to my setup I would love to create object by coding, but a create object by itself isn't really useful, at least it would be nice to attach an on expression script and some variables. Are those functions available ?
If you're using an environment like Max then that environment can be used to supply the dynamic settings you need in real time, at the expense of some cpu.mbncp wrote
As I make often changes to my setup I would love to create object by coding, but a create object by itself isn't really useful, at least it would be nice to attach an on expression script and some variables. Are those functions available ?
I have not tested adding variables or scripts, but I assume Axel is right, so I suppose we're out of luck here.
Fortunately the whole physics thing and all of the behariour attributes of Lemur are available for dynamic scripting. The functions Attributes and Attributes2 wil show the attributes that I know of that can gotten or set for each object type.
Attributes:
decl arg = OSC_ARGS[0];
if (arg == 'Breakpoint')
oscout(0, '/Attributes', {arg, 'name', 'rect', 'color',
'coordinates', 'editable', 'free', 'grid', 'grid_steps', 'label', 'nbr', 'physic', 'zoom',
'edit', 'attraction', 'friction', 'speed', 'rest', 'holdX', 'holdY',
'x',ý'y'});
else if (arg == 'Dummy')
oscout(0, '/Attributes', {arg, 'name', 'rect', 'color', 'transparent',
'label', 'tabbar'});
else if (arg == 'CustomButton')
oscout(0, '/Attributes', {arg, 'name', 'rect', 'color',
'behavior', 'capture', 'label_off', 'label_on', 'outline',
'Mode', 'mode',
'x'});
else if (arg == 'Fader')
oscout(0, '/Attributes', {arg, 'name', 'rect', 'color',
'capture', 'cursor', 'grid', 'grid_steps', 'label', 'value',
'physic', 'precision', 'zoom',
'attraction', 'friction', 'speed',
'x', 'y'});
else if (arg == 'Knob')
oscout(0, '/Attributes', {arg, 'name', 'rect', 'color',
'cursor', 'grid', 'grid_steps', 'label', 'value', 'physic', 'precision',
'type', 'unit', 'mode',
'attraction', 'friction', 'speed',
'x'});
else if (arg == 'Leds')
oscout(0, '/Attributes', {arg, 'name', 'rect', 'color',
'colors', 'row', 'column', 'multicolor', 'label',
'transparent'});
else if (arg == 'Menu')
oscout(0, '/Attributes', {arg, 'name', 'rect', 'color',
'items', 'scale', 'transparent',
'selection'});
else if (arg == 'Monitor')
oscout(0, '/Attributes', {arg, 'name', 'rect', 'color',
'label', 'precision', 'transparent', 'unit', 'value'});
else if (arg == 'MultiBall')
oscout(0, '/Attributes', {arg, 'name', 'rect', 'color',
'ball_enable', 'capture', 'colors', 'grid', 'grid_steps', 'ephemere',
'label', 'multicolor', 'multilabel', 'nbr', 'physic',
'polyphony', 'pressure', 'zoom',
'attraction', 'friction', 'speed', 'attack', 'decay', 'sustain', 'release', 'hold', 'holdX', 'holdY',
'x', 'y', 'z'});
else if (arg == 'MultiSlider')
oscout(0, '/Attributes', {arg, 'name', 'rect', 'color',
'bipolar', 'gradient', 'grid', 'grid_steps', 'horizontal',
'label', 'multicolor', 'nbr', 'physic',
'tension', 'friction', 'height',
'x'});
else Attributes2(OSC_ARGS);
Attributes2decl arg = OSC_ARGS[0];
if (arg == 'Pads')
oscout(0, '/Attributes', {arg, 'name', 'rect', 'color',
'capture', 'colors', 'column', 'label', 'labels',
'attack', 'decay', 'sustain', 'release', 'hold',
'row', 'multicolor', 'multilabel',
'x'});
else if (arg == 'Range')
oscout(0, '/Attributes', {arg, 'name', 'rect', 'color',
'capture', 'grid', 'grid_steps', 'horizontal',
'label', 'physic',
'tension', 'friction', 'min_height', 'max_height', 'drag',
'x'});
else if (arg == 'RingArea')
oscout(0, '/Attributes', {arg, 'name', 'rect', 'color',
'capture', 'label',
'attraction', 'friction', 'speed', 'attractor_x', 'attractor_y',
'x', 'y'});
else if (arg == 'SignalScope')
oscout(0, '/Attributes', {arg, 'name', 'rect', 'color',
'label', 'mode','transparent',
'x', 'y', 'timebase'});
else if (arg == 'SurfaceLCD')
oscout(0, '/Attributes', {arg, 'name', 'rect', 'color',
'diplay', 'target','transparent'});
else if (arg == 'Switches')
oscout(0, '/Attributes', {arg, 'name', 'rect', 'color',
'capture', 'colors', 'row', 'column', 'label', 'labels',
'multicolor', 'multilabel', 'paint', 'radio',
'x'});
else if (arg == 'Text')
oscout(0, '/Attributes', {arg, 'name', 'rect', 'color',
'content', 'transparent'});
else oscout(0, '/Attributes', {arg, '<not an object type>'});
My function Value to get / set a value is in early alpha. It should always return the current value of an attribute and it should set the attribute if a value is optionally supplied. At the moment this function looks at this:decl obj = findobject(OSC_ARGS[0]);
decl attr = OSC_ARGS[1];
decl val;
if (attr == 'rect')
val = getobjectrect(obj);
else
val = getattribute(obj, attr);
if (val != 0)
oscout(0, '/Value', {OSC_ARGS[0], attr, val});
else
oscout(0, '/Value', {OSC_ARGS[0], attr, getexpression(obj, OSC_ARGS[1])});
if (sizeof(OSC_ARGS) > 2)
{
oscout(0, 'Value set', OSC_ARGS[2]);
setexpression(obj, attr, OSC_ARGS[2]);
}
Cheers,Willem aka Xanadu
Hi
There is also a getattributelist(object) function that you may want to use to generate your data
Apart from that, thanks, it is interesting to see the different ways people program stuff
Cheers
MM
There is also a getattributelist(object) function that you may want to use to generate your data
Apart from that, thanks, it is interesting to see the different ways people program stuff
Cheers
MM
Talking about undocumented functions. What about the Gesture object? It's availabe in the Jazz Editor but not in the Lemur Editor.
I did a little test and voila, it's possible to create a Gesture object in the Jazz Editor, save it and the use in the Lemur Editro.
... and it works ... will this be available in a future update? is there any more documenation/information about this object?
Btw. there are existing templates and libs for the Lemur that use the Gesture object. E.g.the pinch value could be used to control zoom attributes.
Cheers,
BxSj
I did a little test and voila, it's possible to create a Gesture object in the Jazz Editor, save it and the use in the Lemur Editro.
... and it works ... will this be available in a future update? is there any more documenation/information about this object?
Btw. there are existing templates and libs for the Lemur that use the Gesture object. E.g.the pinch value could be used to control zoom attributes.
Cheers,
BxSj
The Gesture object has been taken out of the Editor indeed, there are no plans to bring it back for the time being.bxsj wrote:Talking about undocumented functions. What about the Gesture object? It's availabe in the Jazz Editor but not in the Lemur Editor.
I did a little test and voila, it's possible to create a Gesture object in the Jazz Editor, save it and the use in the Lemur Editro.
... and it works ... will this be available in a future update? is there any more documenation/information about this object?
Btw. there are existing templates and libs for the Lemur that use the Gesture object. E.g.the pinch value could be used to control zoom attributes.
Cheers,
BxSj
The Gesture control can also be created using the createobject function and it seems to work on the iPad. It is documented on page 129 of de JazzMutant Lemur 2.0 manual, which is still online at http://www.jazzmutant.com/download/Lemur_v2.0_Manual.pdf . I wonder why it's taken out of the editor. Is it flawed in any way?
I know of the getattributelist function. But from my iPad it only says 'bogus_string' for a couple of times, which is not very helpfull. Used inside the editor it can display a list of attributes for a control. It doesn't display the x, y and z variables, nor the behavior settings. That's why I made some documentation myself.
Cheers,
Xanadu
I know of the getattributelist function. But from my iPad it only says 'bogus_string' for a couple of times, which is not very helpfull. Used inside the editor it can display a list of attributes for a control. It doesn't display the x, y and z variables, nor the behavior settings. That's why I made some documentation myself.
Cheers,
Xanadu
Hi
Had meant to comment on this before when it was originally posted, sorry . . .
There is a reason that the 'getattributelist' function does not reveal x.y.z variables and some other info - they are expressions(variables), not attributes.
Unfortunately your scripts do not differentiate between the two datatypes and therefore does not function properly when mismatchs occur.
Your get/set function needs to know which is which and deal with them as needed - currently it only gets expressions, not attributes as planned . . .
Cheers
MM
Had meant to comment on this before when it was originally posted, sorry . . .
There is a reason that the 'getattributelist' function does not reveal x.y.z variables and some other info - they are expressions(variables), not attributes.
Unfortunately your scripts do not differentiate between the two datatypes and therefore does not function properly when mismatchs occur.
Your get/set function needs to know which is which and deal with them as needed - currently it only gets expressions, not attributes as planned . . .
Cheers
MM