Custom Max for Live UI object ability to MIDI learn

due_friday's icon

Hey everyone,

I have been trying to get my UI object working nicely with Ableton Live. Sorry if I missed any documentation on coding Max for Live objects, but the only example and resource I can find is the jslider in the SDK.

So far I have been able to get it to show the "Parameter Mode Enable" checkbox and working automation through Live using the "getvalueof" and "setvalueof" messages (as copied from the jslider).

The problem is, I cannot figure out how I can expose my object to Live to make it available for MIDI mapping or Key mapping. When I switch to MIDI map mode in Ableton Live, I should get a colored box overlaying my new UI object to select it, move a MIDI slider and complete the mapping, but it remains un-selectable for this mapping process.

I know there is the typedef enum PARAM_LEARNING_TYPE in ext_parameter.h, but I have no clue where/how to set a flag, nor if this will fix my problem. Unfortunately, I cannot get through the documentation to sufficiently understand how Live UI objects properly work, sorry! :(

I would be really great if I could get some help because my UI object is a bit useless without MIDI mapping. If there is source code of a simple Max for Live UI object available somewhere to learn from, that would be helpful as well!

Thanks a lot!

due_friday's icon

No one can help me with what is necessary to make my external UI object able to MIDI learn via the native Ableton Live functionality? :( Am I missing something obvious or is this information not in the SDK? Someone from Cycling 74 can comment on this?

S4racen's icon

As far as i'm aware what you're asking for is not possible...

Cheers
D

due_friday's icon

That would be too bad. I was hoping, since all the [live. ] UI objects can do it, that it must be possible somehow :(
Thx!

alfonso santimone's icon

Hi, sadly this is not possible. I don't know the technical reasons but i faced this limitation years ago as soon as M4L came up.
My solution is to have a separate tabbed bpatcher with standard live ui objects linked at my personal ui controls.
I just make my midi learn assigments on the standard live ui in the relevant tabbed bpatcher.
I tricky workaround but it works.
something in the line of this (attachment)
It works with external controller, but not with Live automation system (i don't know why)

a.

UI_Learn.amxd
amxd
due_friday's icon

Hey Alfonso, interesting solution! This would be even better, if the LOM would give me information if MIDI learn was activated by the user or not. You could automatically make the tab switch for the convenience of the user. (Max for Live feature request??)

I checked the automation and it works for me! Perhaps you need to scroll in the Y-axis to find the dotted line in the envelopes of your clip, since somehow they are scrolled off screen.

Also, you could make your objects appear directly in the envelopes by looking at the "jslider" example of the Max API, as I wrote above, and hide the MIDI learn dials from the envelopes tab, if you wanted to.

Yet, if anyone else has an idea to do get MIDI learn working directly in the C code of the external, please don't hesitate:)
(Cycling'74 Staff? Anyone?)

alfonso santimone's icon

Hi @DUE_FRIDAY,
in my example i can correctly assign MIDI CC to the two live knobs but if i record automation in the clip the 2 automation red squares turn gray and only one at a time can be activated. Where can i find the "jslider" example for the Max API?

many thanks

due_friday's icon

Hi Alfonso, I see your problem: the thing is, if you send either an X or Y to the [pictslider], the [pictslider] sends both X and Y values out its outlets. This triggers the set message to the [live.dial]s, which makes Ableton believe the dials were changed externally, turning off the automation, for this control. You should also prepend a set for the values to the [pictslider] so that no output occurs. The actual value can then either be read by the [pictslider] or the [live.dial]s, but since either one is only setting the other, you can be sure the values are never doubled. I tested it with the patch attached and it worked for me in a quick test.

If you download the Max SDK, you can find a UI example in the source folder called jslider. Look at the c file how the messages "getvalueof" and "setvalueof" are implemented. I have not tried if this works with multiple atoms though...

I wish an example of a [live. ...] object existed...

UI_Learn.amxd
amxd
alfonso santimone's icon

thanks! what a dumb i am!
thanks for the infos!
and i'd like to get live.* examples in SDK too!