Building an and/or switch with 3 toggles to send a midi cc

Learn about building and using Max for Live devices.
Post Reply
red33mer
Posts: 21
Joined: Sat Jan 28, 2006 6:07 pm
Location: Munich / Germany

Building an and/or switch with 3 toggles to send a midi cc

Post by red33mer » Tue May 11, 2010 4:54 pm

Hey Guys,

i am pretty much a max beginner (not a total n00b though) and have a problem i am stuck with.
Right now i am writing an editor for an external synth that is controlled via midi cc.

What i am trying to do is the following.

I have 3 toggles that toggle on/off the three filters of the synth via the same cc message (to a ctlout object).
The hardware implementation works as follows: bit 1 of the midi message turns on/off filter1, bit 2 turns on/off filter2 and bit 3 turns on/off filter3. That means toggle1 gives out the values 0/1, toggle2 0/2, toggle3 0/4. As long as only one filter is activated at a time that is not a very big deal but it get´s difficult when one or both of the other filters are already activated. In this case the value of the toggle must be added to the value(s) of the active toggle(s).

So i try to build a patch that has 3 toggles giving out the values 0/1, 0/2 and 0/4. Every toggle "checks" the status
of the others toggles and add its value to the total output to ctlout when one or both of them are activated.
i managed to come close with 2 toggles and gswitch objects but i am totally lost with 3...

may you could help me,
thank you
r.
Live 8.1.3, OSX 10.6.3

broc
Posts: 1151
Joined: Mon Jul 26, 2004 8:37 am

Re: Building an and/or switch with 3 toggles to send a midi cc

Post by broc » Tue May 11, 2010 6:43 pm

You could use 3 toggles with values 0/1 and on each change trigger the calculation t1+t2*2+t3*4.

Something like this.

<pre><code>
----------begin_max5_patcher----------
644.3oc6WE0aaBCD9YxuBKq9TWVD1oojr219aTEEYBWHdCrQXSV5p5+8AFCk
z5PIRKQQZ4Ea7cmu6ye9tS3WF4gCk6AEF8MzSHOuWF44YDUIvyt1Cmx1uNgo
LlgSAkhEC3w05zvdsQteiDQQJWj.Zi4TqvMRgVw+CTIi3Ow2JNioWukKhWkC
q00nXw7RsHp+iUSypLEQJ+FsztEdjIbxve9UR2XJKzMAkXkVKR+bFT6ZLt0K
U3QvRMJveOmyRP+PlDgqz95nQUCiGHgHfeWBlOvGZTnSFgbxLBwmZXApgRnO
XVL2Mkr3DYjPlH9RxJv9rbzcbxWtiSumVNN89GbRSSOcZhtnNYYlYxede7Tv
0PlSBeGLQKiiSZKm1wxacdG0OQW1axjC5fRLDvi0jxrlQWjwz9IiLVdIjzP9
JPvBSfARTJ1NHZESqy4gEZ3suTVJwxIUG5jBPtoQbi7tQVogLy9rI.uCVEo1
vK2rAOtbRzhiCsbelT.BCEQl3xWEBtVoe1dJcYQZ4c3w2eZ4siAmN01PTTG5
3kQtLapCI6xCpsxbsqTDrSWtiq383sTYTyogF3DwLgPpYZtTrpMptBUhTD2e
l6GBbeDUBW7qJ2o5C4xnidv3hMxihUYdDjercZR.N5VUY.DkvMoa90pME8MS
muN.jStC.I3gg1AfdqCvsN.mqN.jac.9WzA3jK+q+en.+Ou7mbq7+V4+Yp7+
+vZeSlWIGHd+KqMUoUxOrgfRVjuto9w95DzaEpQfRyElqfN1T83WDo0ns7nH
Pz4XgS4QYRtPaw.ZoytSCERSG.jVbfMmaDQu5PD4pCQKF.hBtnHZ5.QD8pJO
J3hVqQNy2ZkKdczeALRy0G.
-----------end_max5_patcher-----------
</code></pre>

red33mer
Posts: 21
Joined: Sat Jan 28, 2006 6:07 pm
Location: Munich / Germany

Re: Building an and/or switch with 3 toggles to send a midi cc

Post by red33mer » Wed May 12, 2010 8:18 am

hey broc,

thank you very much for your help, i´ve seen your post this night and planned to start reading on the zl object today.
now as you´ve edited it and attached a patch i try to learn it now. Might be i have another question on this issue...as for now im diving into it :-)
Live 8.1.3, OSX 10.6.3

broc
Posts: 1151
Joined: Mon Jul 26, 2004 8:37 am

Re: Building an and/or switch with 3 toggles to send a midi cc

Post by broc » Wed May 12, 2010 9:41 am

Yep. I've deleted my original post because I realized that using lists made no sense in this case.

But reading on the zl objects may be useful anyway as you will probably need it at some point..

Btw, here is a "polished" version taking advantage of the [bondo] object.

<pre><code>
----------begin_max5_patcher----------
655.3oc6W0saZCCE95vSgUTupighc.Bc2s8ZTgPF7AvaI1QwNL5p569hc9o.
0IMTUPSZbA1jyue9ymyQxOOvyeobOn7QeC8Hxy64AddVQFAdUe64mP2uJlpr
l4KfeKW9S+gkpzvdsU7RofIQg0xE4IbQLns9DVIbsTnU7+.FY3fQAUhSo5Ua
4hMKxfU5Rnfm7PgZDFGY1FW9wrQAn4U9vY1rVfjuN9fbJy0mlzRQ5mRgxP66
Or5WSvL3RPSrF3+8LNMF8CYLy2n8kACLKC6I6j.JEcC7F5IvIwPNah4gYFpf
DL0rMIvxKScyK3.2DCtUh4RPHsTt.6SyP2wwe4NN4dRwZ38i+rpcHkkKSmX2
Bl0UwSz+BbTLeGLRK2rItovYGMqI3Gn9QxbmrDtc5ffGaHfHrkFlTu5hLB6l
LRoYEPRCYK.AcYLzShRQ2ArETsNiuLWCu9OUEkTwIlCcbNHWWKtV9gYVogTq
eUE.m.q7jpzKWu1ziKEM33XK2mJEfvRQ3QthUtfqU5mpNktrHo3Nrc+SJtcr
3zo1Zhh3PGuHyEUSGPxthfZqLS6pDw2YH2wU7NhVhjUeZHQNQLUHjZplKEKZ
xpqTEKEa5tx8MItKhJlK9kIbptPtj05AiKVKaEqxLFj0lm1BfVcUkB.KlaK2
BJUaa5q2tbS.vm8D.bTXem.PtMA31DfK0D.7sI.eFS.N61+vx1ex629iu09e
q8+B09+eXuusxqfCDm9BaaWpQ9wCDTx7rU08OUuNA8ZiJCTZtvdEbfMlm4gv
MFskyXf3fikeBmkJ4BcEFPycNcpuPp3UZHx6.onir4ZfHbOPz0kiB5AhBtZH
JrGHZ7U8VizSDc8t0v8DQezashOdYveAStR0V.
-----------end_max5_patcher-----------
</code></pre>

Post Reply