combining keys / controller buttons

May 21, 2009 at 6:59pm

combining keys / controller buttons

Hello,

How can I combine two keyboard keys to create a specific function? I have a patch with four buffers, and what I’m trying to do is to use the ‘c’ key, in conjunction with numbers 1, 2, 3 or 4 4, to clear the audio in one of the numbered buffers. So when the keys ‘c’ AND ’1′ are depressed at the same time the relevant bang occurs to wipe buffer one, and so forth…This must be so straightforward but I can’t work it out!

Something else I’m trying to do is much the same but for the data output by my game controller via the HI object. How would I combine the effects of two trigger buttons, so an action is only done when both are pressed at the same time? I know how to route this data, scale it etc but no idea how to do the above.

Any help much appreciated
Cheers

#44027
May 21, 2009 at 7:13pm

using Key and Keyup, you can make it so pressing “c” sends a 1 and releasing c sends a 0. use a “sel 99″ and trigger a message saying “1″ or “0″. (i think c is 99, from memory) use those to open and close a gate object. (put a toggle in between for your visual comfort!) make keys 1 2 3 4 come through that gate so they only do what they do when c is down.

“hi” outputs 1s and 0s already, rather than different objects for press and release, so it’s the same principle but even easier!

hope that helps

#158138
May 21, 2009 at 9:12pm

Thanks man, think I’m on the right track now – I’ve got it so the number keys only do something when C is down. I’m still unsure as to how to use this gated info, as all that passes through the gate is a bang through its one outlet. Do I need to use more gate outlets or something? Because I’d need one bang message going to each buffer section if you know what I mean. So I tried 4 outlets but only the first sends out a bang

I’ve attached what I’ve got so far from what you suggested. Which reminds me – how do you export a patch into code so you can paste it onto this forum? When I save a patch as text it doesn’t resemble what people post here..its far longer and doesn’t end with end_patcher or whatever…

Cheers

#158139
May 21, 2009 at 9:16pm

Moving the [select] to the other side of the [gate] should do the trick.

lh

– Pasted Max Patch, click to expand. –
#158140
May 21, 2009 at 9:23pm

select all then choose copy compressed from the edit menu instead of using apple-c

#158141
May 22, 2009 at 9:22am

Ahhh, all seems clear now. Thanks fellas

#158142

You must be logged in to reply to this topic.