telling the difference between the same value on different joystick buttons

slatepipe's icon

hi there

i have progressed quite well with my current mfl patch which receives data from a game controller which i can then use to create music in Live. i been using the routepass object to decide which buttons or joysticks are being moved or pressed and it works fine.

there are two modes on the gamepad and you toggle between the two by pressing a mode button. at the moment the gamepad works on only one mode. however, to increase the functionality of the gamepad i would like to switch between the two modes.

when i press the mode button it gives a number to identify the button (0) and a value to identify the mode (32511 and 32767). i thought it would be quite easy to make a patch to switch between the two modes but unfortunately the mode button value of 0 is the same as some of the other button values in either mode, and the value to identify one mode (32511) is the same as the mid point value on one of the gamepad joysticks, so when i try and toggle between modes it gets confused and thinks i am pressing buttons or moving joysticks when i haven't.

so i need to first have the gamepad knowing which mode it is in then to act accordingly, i've enclosed a small patch to show what i've managed to come up with so far but i'm struggling with where to go next.

i'm sure it's got something to do with the two number values that the mode button gives but i can't figure it out

many thanks for any further help and advice

mode.maxpat
Max Patch