breaking the default knob functionality on an apc40

Questions and discussion about building and using Max for Live devices
neuromodulator
Posts: 84
Joined: Mon Dec 07, 2009 6:05 am

breaking the default knob functionality on an apc40

Post by neuromodulator » Tue Aug 31, 2010 5:22 am

I'm banging my head against a wall here. Any help would be greatly appreciated.

What message can you send to what path to a) turn off the default functionality of the apc40 knobs but b) still have their LEDs respond to messages?

I can send "call send_value X" to "path control_surfaces Y controls Z" to update their LEDs. No problem.

And I can send "call enable_0" to "path control_surfaces Y" to break their default mapping, but this turns their LEDs off until I "enable_1" again. I've found different levels further down to disable them (via components, etc.), but in each case, severing the connection prevents the LED messages from working. The other elements (i.e. the matrix) don't work this way - I can send LED messages to the matrix while it is disabled and the LEDs are updated appropriately.

I know there's a message X to live.object Y that will do it, but I can't find it. It's driving me crazy.

I know there is scripting that can do it, but I'd like to do it with messages to live.objects.

S4racen
Posts: 5270
Joined: Fri Aug 24, 2007 4:08 pm
Location: Dunstable
Contact:

Re: breaking the default knob functionality on an apc40

Post by S4racen » Tue Aug 31, 2010 7:39 am

I'm with you on this one, i can disable them but then i lose them!

Help !

Cheers
D

amounra93
Posts: 431
Joined: Sat Jan 24, 2009 8:16 pm
Location: Arcata, CA
Contact:

Re: breaking the default knob functionality on an apc40

Post by amounra93 » Tue Aug 31, 2010 6:21 pm

I'm working on my APC scripts presently, but don't have an actual APC device in front of me. When I get home tonight I'll spend a few minutes and see if I can find a way to do what you want, since its fresh on my mind.

Cheers.
http://www.aumhaa.com for Monomod and other m4l goodies.

neuromodulator
Posts: 84
Joined: Mon Dec 07, 2009 6:05 am

Re: breaking the default knob functionality on an apc40

Post by neuromodulator » Tue Aug 31, 2010 6:50 pm

Oh thank you thank you. I actually don't mind if I "permanently" lose their default functionality, I just want them to transmit knob turns and respond to LED updates.

amounra93
Posts: 431
Joined: Sat Jan 24, 2009 8:16 pm
Location: Arcata, CA
Contact:

Re: breaking the default knob functionality on an apc40

Post by amounra93 » Wed Sep 01, 2010 10:02 am

It can be done.

The short of it (cause I should've been in bed...well...two days ago hehe):

If you are using the stock script:

Component 67 is Device_Component.

Turn it off. (call set_enabled 0);

(I'm only doing one knob now, you can sort the rest of them)

Control 107 is Device_Control_0_Ring_Mode_Button. (this changes the way the encoder displays stuff, and device control turns it to zero when you disable it-you have to turn it back on).

So turn it on: (call send_value > 0)

Control 108 is the knob. (Device_Control_0)

Turn it: (call send_value [however many twists you feel like turning it].

When you turn device control back on (component 67, call set_enabled 1), it will update everything back to where it was.

Hope this helps. If that's too cryptic, I'll be around tomorrow for more abuse ;)

Cheers.
http://www.aumhaa.com for Monomod and other m4l goodies.

neuromodulator
Posts: 84
Joined: Mon Dec 07, 2009 6:05 am

Re: breaking the default knob functionality on an apc40

Post by neuromodulator » Wed Sep 01, 2010 2:23 pm

No, that's clear. Unfortunately, it does not work. Does it work for you? Did you try it in Max, I mean, or were you just crafting your theory from the script? Because it was precisely what I was trying and I would expect it work...but as soon as I disable the component, no message to 107 and 108 will cause anything to light up.

I don't want to waste your time on it, though. I think I'll go MIDI and rebuild the default functionality myself (the parts of it I want, anyway). Thanks very much for trying; I really appreciate it.

amounra93
Posts: 431
Joined: Sat Jan 24, 2009 8:16 pm
Location: Arcata, CA
Contact:

Re: breaking the default knob functionality on an apc40

Post by amounra93 » Wed Sep 01, 2010 3:59 pm

Dude, try again. I wouldn't steeer you wrong. I had it working...I was skeptical about it at first too. Here is the script I used (but you don't need a script...I'm not using anything that you don't have in pure max, I just don't like having to spend 30 minutes drawing cables with a trackpad).

Are you getting errors?

Are you sure you're changing the ring mode button after you disable component 67? If you can't get it to work in max I'll write you a simple script that will do it if need be, but try again...it should work.

edit:: you may have to send the ring mode value everytime you send the device_control a value...that's the only difference I see in between what I told you and what I did in the script. If you look at the script, its basically the order that i did things.

Code: Select all

autowatch=1;

function init()
{
	ring=new LiveAPI(this.patcher, callback, "control_surfaces", 0, "controls", 107);
	ring.property="value";
	knob=new LiveAPI(this.patcher, callback, "control_surfaces", 0, "controls", 108);
	knob.property="value";
	device=new LiveAPI(this.patcher, callback, "control_surfaces", 0, "components", 67);
}

function callback(args)
{
	post(args, "\n");
}

function enable(val)
{
	device.call("set_enabled", val);
	switch (val)
	{
		case 0:
			ring.call("turn_on");
			ring.call("send_value", 0);
			break;
	}		
}

function ringer(val)
{
	ring.call("send_value", 1);
	knob.call("send_value", val);
}

init();
http://www.aumhaa.com for Monomod and other m4l goodies.

neuromodulator
Posts: 84
Joined: Mon Dec 07, 2009 6:05 am

Re: breaking the default knob functionality on an apc40

Post by neuromodulator » Wed Sep 01, 2010 5:36 pm

I'm at work, but I did check again this morning to make sure I was doing precisely what you said.

Here's what's happening in my patch: the path to the control surface is being sent out when the patch is opened to prime three live.objects. One of them is set to the Device_Component, one to control 107 and one to control 108.

I'm fairly certain that all objects are being set properly because:

a) I have read "getinfo" dumps on all of them.
b) I can successfully disable the device_component object
c) I can successfully send_values to the ring LEDs (while the component is enabled)
d) I'm getting no error messages when messages are sent (like "improper syntax", etc.)
e) the 107 object does report errors when I send it negative values (I have a number box attached to it that doesn't have a "minimum 0" attribute set). So the positive values are being received by something that does not reject them.

So the possibilities seem to me to be:

1) I have 107 routed incorrectly (there are live.objects for all ring_encoder_mode destinations, and it's possible I have something cross-patched, and am routing my control messages to Device_Control_0 but the ring mode messages to Device_Control_Ring_Mode 1, or something similar.) I'll triple check tonight, but with the number of hours I've spent trying to figure this out, I would be surprised if I hadn't noticed this by now. Doesn't mean it's not possible.

2) When the "call set_enable 0" goes to the Device_Control component, the path to the controls are changed, so my live.objects that were set while the component was enabled no longer point to the right place. This doesn't seem right, though because they're set by what I believe to be the canonical path ("path control_surfaces 1 controls 108"), and if they were no longer pointing to a valid object, I would expect an error message when I send them a value.

3) There's some weird thing about the way Max interfaces with the script that keeps it from working the same way as your scripted solution?

amounra93
Posts: 431
Joined: Sat Jan 24, 2009 8:16 pm
Location: Arcata, CA
Contact:

Re: breaking the default knob functionality on an apc40

Post by amounra93 » Wed Sep 01, 2010 7:23 pm

Well, it sounds like something is screwy, that's for sure.

I was very tired last night when I tested it....there's maybe 5% chance that I DIDNT get it working, but that I had no device selected at the moment when I was testing it, so the Rings weren't reflecting anything. I don't think so, though. I will check again when I get home from work, we can go from there.

Cheers.
http://www.aumhaa.com for Monomod and other m4l goodies.

neuromodulator
Posts: 84
Joined: Mon Dec 07, 2009 6:05 am

Re: breaking the default knob functionality on an apc40

Post by neuromodulator » Wed Sep 01, 2010 7:36 pm

What do you mean about "no device selected"? I'm expecting there to be no device selected once the component is disabled, so I'm confused as to what you're referring to, there. If the rings weren't reflecting anything, that's fine, as long as they still transmit a value when moved and light up and when i tell 'em to...

amounra93
Posts: 431
Joined: Sat Jan 24, 2009 8:16 pm
Location: Arcata, CA
Contact:

Re: breaking the default knob functionality on an apc40

Post by amounra93 » Wed Sep 01, 2010 7:53 pm

No, I meant that maybe somehow I didn't have a device selected in Live....I don't think this was the case, though. All speculation till I get back home in front of an APC.
http://www.aumhaa.com for Monomod and other m4l goodies.

amounra93
Posts: 431
Joined: Sat Jan 24, 2009 8:16 pm
Location: Arcata, CA
Contact:

Re: breaking the default knob functionality on an apc40

Post by amounra93 » Thu Sep 02, 2010 1:27 am

Here you go guys. I missed a step when I gave you instructions earlier....you also have to call("turn_on") to the ring_mode_button to get it to work. Hope this helps:

edit:: a little later I ammended something, there was an extra unnecessary connection that I've now removed.

Code: Select all

<pre><code>
----------begin_max5_patcher----------
1411.3oc4Z0sbiZCF8ZmmBMd5kIon+.QmdS6qQmLYvFYG1Ei7.xoY6N66dQ5
CRHIFPXSjS2lKfQJR3iNbz2ehue0hkqTOIqVh9MzegVr36WsXgsKSGKZZuX4
tjmVmmTYG1x0pc6jE5kWC+Os7Iss+e+l5+PnGSxOHQZEBUlUrscTEG1oNnyk
Z6yHno2MpBcU1+HM8gCtss68kxp5egDclp39R4ZM.ONkWODDlGYtEzbAcW6r
Rzqen9mryLn7P6LXB6MBydSzYRYoVrqV8ka3AK6.qhjcVXs7OJyRxQ+oJOsy
ZIqncofM88iqtxb454jA2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P1bgCkMs3SR
kedgVwdXqYTDTmRgXbF5rMZYenVKyu4qOxBLS+ul1pTGJW2tLZKOG5ErkJqz
YEVURmAYhNryfdHKMUVz8Do2kktWUGkPCHnA1SRkHXsoV01Bc2Qe85JZMeNG
ih12rjFEsmKlvNfIJ1uXh3.lLeND9DStnzXdlmBcAS9UOYNwuw03rogoXRfM
1bp0QHChW+0sHXHjh5L14Ms7xJgdRqDJTNQN7MaXa4CzZBy7DPKoo3y0Qfz1
5LQK2EvNQQRj.+7qdy4kIlKg.1ks9zIh1F7gA2s7nt0EkECNfLsNSrShcQDO
QyVbAvsw7tn0z5bQafqtywSvcdiIA3rmo3nma4CzZ93YNczxHyFZwtD7wa77
5EG83wde6YGXBWczi8FlHbWUZ9imbR8S398cGyELE5eLMlFmD6WL4R.1Tpe0
Sge.dpNWL4jdJvuXxovR8qcbBw02c9ylo0swX667q4ImBjzuVwEe.AhetrD0
UL4QwjSIrbNFLqa7iq9W.OTxypB
-----------end_max5_patcher-----------
</code></pre>
Cheers
Last edited by amounra93 on Thu Sep 02, 2010 2:07 am, edited 1 time in total.
http://www.aumhaa.com for Monomod and other m4l goodies.

amounra93
Posts: 431
Joined: Sat Jan 24, 2009 8:16 pm
Location: Arcata, CA
Contact:

Re: breaking the default knob functionality on an apc40

Post by amounra93 » Thu Sep 02, 2010 1:57 am

BTW I was rereading your posts and realized I may still not be giving you exactly what you need, but I still think it can be done:

This doesn't break the relationship between the position of the dial and the value its displaying on the encoder ring, but it does make it functional (i.e. it sends a value through the live.observer) and it allows the ring to be set through the api. You'd have to do some further work to actually disconnect the two completely within one of the modules, I think.

Anyway, lemme know if I can help further...I need to do this anyway for some other stuff I haven't gotten around to yet.

Cheers.
http://www.aumhaa.com for Monomod and other m4l goodies.

neuromodulator
Posts: 84
Joined: Mon Dec 07, 2009 6:05 am

Re: breaking the default knob functionality on an apc40

Post by neuromodulator » Thu Sep 02, 2010 2:18 am

Damndest thing. Your patch doesn't work for me. That is, it's doing exactly what my patch does: if the component is enabled, I can set values. If it's disabled, nothing will light up. I've tried manually banging both messages to 107, too, to make absolutely certain they've fired. I've tried it with the patch in edit mode and with the toggle and knob added to presentation and the patch closed.

a) Are you running the default APC40 scripts?

b) Can you check your preferences and tell me what your takeover mode is for the control surface? I can't seem to get it working with any option, but I'd still like to make sure we're on the same page.

I've also double checked that our controls are numbered the same: Device_Control_0_Ring_Mode_Button is 107 on my setup too. But I have the feeling, somehow, that this is the culprit, since I can see evidence that the other two live.objects are working.

The only thing running is your clip and some dummy default effects for the device to grab.

The weirdest thing is it sounds like Darren is in the same boat.

neuromodulator
Posts: 84
Joined: Mon Dec 07, 2009 6:05 am

Re: breaking the default knob functionality on an apc40

Post by neuromodulator » Thu Sep 02, 2010 2:35 am

Also, I just took your patch into a brand new set to make sure there wasn't something corrupt hanging around my set. Still the same. STILL THE SAME. I'M LOSING MY MIND.

I'ma send you an email.

Post Reply