breaking the default knob functionality on an apc40

Learn about building and using Max for Live devices.
amounra93
Posts: 432
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 4:38 am

Ok, I see what you are talking about. It only works in edit mode, and only AFTER the js has also been loaded somewhere.

The js isn't doing anything, its just sitting there.

And yeah, I never actually checked it out of edit, I just assumed it worked and that I had given you wrong information at first, but you are right.

Still, it DOES work under the conditions that I saw it work in, which obliges me to believe that it will work somehow...this is one of the more bizarre mysteries that I have encountered with the Python scripts.

I am more determined to figure out what is going on now. Mind you, I don't need to use this, but that's not the point...someday, well, someday...I just might lol.
http://www.aumhaa.com for Monomod and other m4l goodies.

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

Re: breaking the default knob functionality on an apc40

Post by neuromodulator » Thu Sep 02, 2010 5:15 am

I think I found a solution. It works for me, I think, anyways.

I'm using the APC40 knobs with remote mapping, and mapping them to live.dials that I dynamically reassign the targets of. This remote mapping keeps the association whether the entire apc40 is enabled or not, and the LEDs update automatically.

This means I would have to do a bunch of "selected_track" and "selected_device" stuff if I were concerned with rebuilding the default functions..but I'm not sure that I am, anyway.

Thanks very much for your efforts, amounra93.

amounra93
Posts: 432
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 6:07 am

Cool, I'm glad you found a workaround.

I built a little script that does what you need (and actually works out of edit mode), and in so doing, I think I found out why the pureMax version wasn't working: you have to assign a listener to the ring_mode_buttons as well, somehow it keeps them from getting id 0'd when you turn the component off. I'll post my findings for everyone else when I get it done.

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

amounra93
Posts: 432
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 6:29 am

Ok, here ya go. This works for all 8 knobs of the device control, I tested it with a coupla different setups.

Code: Select all

<pre><code>
----------begin_max5_patcher----------
1111.3oc2Z0tbiZCE82NOEpz9SuYQevWc5zYZeM5rSFYP1lrXIOHb1jcm8cu
RWL65zX.YGaY6lIQDjEhy4.2qtGve6tIAyTOKzAneG8OnIS91cSl.cY6Xx18
mDrh+bdEWCCKHWsZkP1DLs8yZDO2.8uh+YARuoVfZVVpQleWWwyEEnRI5E0l
ZzZdS9xoHsxL.AhutDol8nHuQi3lC5qhZkYveYo.FNJuRoEvHgi6iZkbwu.+
zclqJkhb0FIb5Ya6TtYkZSSknA.a31dmsHWUopaoI99vonvezX1E8osiatR1
nK+pvNPr8Sa6FPPobwC0F31NIwrT6AGSgofkY2DQ1YpJK.UwPwOPYA6L+R9J
X9C9q5RdE5uUUEA+D7kxNris8886ty1L0wqMqDZMeg3MWaJJ0ZU0Shf8pR3A
TIbXVZHa2+yA8pctadYsnctBB9wQrGoLJkYOWYvUiH37hi6QIoGiRRNBkTJ9
h4D9FgbdsPLiKWboDR3b6fXFGChY6cmo8HljiQLCOBwruTF+wGr+fLnWT9j.
8YoZF5Id0FSBoACmcOLMJFhLwjDXCkMnff8UbZgYFG9Vn2bkedkh2L7kdZZK
WgMjnt18QUL85lKrrH24B6JmKaCCcgKjnqbtfCcmKwW2bgF6d7BI4JmKD2iW
HoW2bgjd.wKYW4bg4d7BM7jwkdpdQutl+BJc+rL8Pqoa5.+4hlDBpA0TqWT+
qIi81ZxiTjhVHKP0FlbpqPIg0Uwqoc6ldDijKsVHj7YUhOZrSX2BtyJDy4ap
ZPyDK4OUZ84Ykq+bulznGnIM76zjFDzsMaRHLYL79U13KsxB2dY0ybC.pUUO
XbRO2XeF8qmF8L7d16WOwsRIz1VfVe54E2wa3A3P6v0lCyfaWTMDnSIP5tdL
3RXWXCtqqEqs2JlqupDv1kJ.ubwC5giP+egGNpC1dxtMrv4.UHg2FN3bgJ3a
CCbtPExsg+MWhUtQru4BUtQbu4BUhO2FdluQJEU843AefqQUUpcxsGyIiMG0
SeM8HzlF0hEUG7i9e+Km+FMoT1LxR2PPZBrzMIrqcuJR3YupvV+KneCeZTiS
TwMsOa5PHhIJdn2+QpupN7r9vPbH0Pz4NyviZTiP27.ec9CVW85z6eTeZRS3
hFz9VZvgYC99HdukxBSJXY7+7FdAfY6+0Bm1XeOuiFc1QP+DaEFEqTxaJUxc
GD8UCZYYQgPtqQzUkEqUlDEaAA5S68xnqXxV26nXxlcEk3MLYKf0MLE6OLgc
ESQ9CSDWwDye2Ok3Jln9CSothIh+vTrqXB6MLE4Jj7X5IWREj5UHQcQkv9Uk
vuJ+bOXh5eLEOFlX9GSQis.bj+wDaLLE6eLQGCSI9GSjwvTp+wDdLLk4eLMV
9IZnewjKEp32zSTmfjmwD8zKSQYT34lfIfe3DR6KFc28ZaIrL6.Sfu0kuuxR
OCz.SXcn6TB0zyARaePUse43HcOJxc2aXVX14628uHRHHvB
-----------end_max5_patcher-----------
</code></pre>
....and the js....

Code: Select all

autowatch=1;

var knob=[];
var ring=[];
var device;

function init(cs_num)
{
	for(var i=0;i<8;i++)
	{
    	ring[i]=new LiveAPI(this.patcher, "control_surfaces", cs_num, "controls", 107+(i*3));
	    ring[i].property="value";
		ring[i].n="ring";
		ring[i].num=i;
	    knob[i]=new LiveAPI(this.patcher, callback, "control_surfaces", cs_num, "controls", 108+(i*3));
	    knob[i].property="value";
		knob[i].n="knob";
		knob[i].num=i;
	}
    device=new LiveAPI(this.patcher, callback, "control_surfaces", cs_num, "components", 67);
    post("test_apc_rings loaded");
}

function callback(args)
{
	switch(this.n)
	{
		case "knob":
			outlet(0, this.num, args[1]);
			break;
	}
}

function enable(val)
{
    device.call("set_enabled", val);
    switch (val)
    {
        case 0:
			for(var num in ring)
			{
            	ring[num].call("turn_on");
	            ring[num].call("send_value", 0);
				list(num, 0);
			}
            break;
    }        
}

function list(num, val)
{
    ring[num].call("send_value", 1);
    knob[num].call("send_value", val);
}


function cs(num)
{
	init(num);
}

function dissolve()
{
	for(var i in knob)
	{
		knob[i].property=0;
		knob[i].id=0;
	}
	for(var j in ring)
	{
		ring[i].property=0;
		ring[i].id=0;
	}
	device.id=0;
	post("test_apc_rings dissolved!\n");
}
Please let me know if there are any issues.

I'll try to post a pureMax version later if I have time....I know what wasn't working now.

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

amounra93
Posts: 432
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 6:44 am

And finally, here's the Max version of the same thing (its only for one knob, but you can figure out what to do with it, I'm sure):

Code: Select all

<pre><code>
----------begin_max5_patcher----------
2121.3oc6bssjahCD8YOeEZo1GmLK5B21ZeY2eiTobgs0XSBFbAxNIap7uuf
ZgMXyEAi8.rURkBFt5Vm9zsZ0pQ+3oEFqh+FO0.8mnOhVr3GOsXg7T4mXg53
EF68+15P+T4sYrNd+ddjv3Y3ZB92DxyugeJXMGkc4CwQY2.JN5Ohe80h6KLH
huN9Xj7lopSdHgmlcq9hf3nk0dGQG2GeTDxExebS0YeMNRjF7u77ygMewrtW
WBes.ZWdtY2Axhlu01NeKC+hI5SEOkuX8tfnskdBrIN+1HNxGw51GozOjTFT
mOXiDJhW84OvXFkD1H+8Rg03uSB7CQ+Sb3FiKsvfnhFHN+b+7omx27rlJjH9
Wy9AuQeb.4eX8xuDEuxnVrD2NVB2o36G3.jXXzJf4j+jHLVBuXFStysDjUBZ
nVCAZnk+04IJ.QgHYupfP9IdRZUMxBiKxnTBkarYxcLWyKBXFJuMLd8W3aJQ
zVjwpeU+2P7AdTc2cwlp2YPz0znx+p9GCEKKqa7do1K+p+ZdiOaUr0n3V1lD
rINJWFp7j4mt3WKSkJo84auH1x6Hx+PMOrHNNbkexofzfUg7JpfL5qeTvdeA
WD.xCw77yEr+PR.Xye9b7H+r2wtz0IwggUdUvUNUyU.2OeMXiXm7ccAsp3gq
DkohgUky2lAVUiLAZExDsp70pZkQKck5szp2ZakezVim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x0HxiWjb0UlvuaxDVaYZnp
trC94S+mA6Fhc
-----------end_max5_patcher-----------
</code></pre>
http://www.aumhaa.com for Monomod and other m4l goodies.

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

Re: breaking the default knob functionality on an apc40

Post by S4racen » Thu Sep 02, 2010 7:26 am

neuromodulator wrote:I think I found a solution. It works for me, I think, anyways.

I'm using the APC40 knobs with remote mapping, and mapping them to live.dials that I dynamically reassign the targets of. This remote mapping keeps the association whether the entire apc40 is enabled or not, and the LEDs update automatically.

This means I would have to do a bunch of "selected_track" and "selected_device" stuff if I were concerned with rebuilding the default functions..but I'm not sure that I am, anyway.

Thanks very much for your efforts, amounra93.
Thats what i've done....

However i will love the script above when i get a chance, it's just what i've been looking for! and will stop any glitchiness of timings...

CHeers
D

Mudo
Posts: 141
Joined: Fri Oct 30, 2009 6:58 pm

Re: breaking the default knob functionality on an apc40

Post by Mudo » Thu Sep 02, 2010 2:58 pm

...

Maybe someday Ableton will release a full documented and open APi for remote scripting and you can override the necessary part by yourself without make conflicts between Remote Script and max code.


...

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

Re: breaking the default knob functionality on an apc40

Post by neuromodulator » Thu Sep 02, 2010 4:50 pm

I think Ableton would be willing and Cycling74 would be willing but it's Akai who would raise a fuss, probably because they don't understand that being open source is a selling point, and not someone hacking their box. Just guessing.

Anyway, thanks for your continued work on the problem, amounra93! I'll try this tonight.

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

Re: breaking the default knob functionality on an apc40

Post by S4racen » Thu Sep 02, 2010 5:36 pm

The control surface stuff is having a very focused effort on producing the help documentation at the moment!

Cheers
D

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

Re: breaking the default knob functionality on an apc40

Post by neuromodulator » Fri Sep 03, 2010 1:58 am

Works like a charm. My eternal gratitude. You're the man (or woman).

fyi you don't need to bang the "call send_value 2" to 107 every time you send a value to 108. Once is enough.

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

Re: breaking the default knob functionality on an apc40

Post by amounra93 » Fri Sep 03, 2010 5:09 am

Cool :) I'll ammend the patches I posted most recently to reflect what you found out...I thought I disconnected that connection at one point and it wouldn't work like that (had me scratching my head...didn't seem like it would need it every time). Let me know if you end up with any problems if you use it...I had a couple of crashes when I was working on it, but I think they were from not zeroing out the API objects before resaving the scripts.

Cheers.

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

Mudo
Posts: 141
Joined: Fri Oct 30, 2009 6:58 pm

Re: breaking the default knob functionality on an apc40

Post by Mudo » Fri Sep 03, 2010 10:58 am

...
S4racen wrote:The control surface stuff is having a very focused effort on producing the help documentation at the moment!

Cheers
D
Oficial or NativeKontrol?


...

hoffman2k
Posts: 14718
Joined: Tue Jun 15, 2004 6:40 pm
Location: Belgium
Contact:

Re: breaking the default knob functionality on an apc40

Post by hoffman2k » Fri Sep 03, 2010 11:21 am

Mudo wrote:...
S4racen wrote:The control surface stuff is having a very focused effort on producing the help documentation at the moment!

Cheers
D
Oficial or NativeKontrol?


...
NativeKontrol is a Bomes (pc) thing.

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

Re: breaking the default knob functionality on an apc40

Post by S4racen » Fri Sep 03, 2010 1:17 pm

Mudo wrote:...
S4racen wrote:The control surface stuff is having a very focused effort on producing the help documentation at the moment!

Cheers
D
Oficial or NativeKontrol?


...
Official!! ;-)

Cheers
D

Post Reply