Question for Controller..
Hello to everybody its my first time in the forum, and i am also nwebie in max/msp, so i would like to ask a question as concern the game controllers, i have connect a classic game controller in my patch and i want to control a slider with the button of the X-axis,
i have already done it, but when i press the button the slider only take one value that is the one that describes the button in my case number 15.. How is there any way to control the slider with the button of the X-axis??
Can anyone tell me about a detail tutorial about controllers?
Not sure how you want to control a slider (a range of values) with a button (one value)…? If you want it to rise or fall slowly while the button is pressed, a bit of logic and some [line] objects will do that:
button –> sel # (whatever the button # is)
to toggle (flips with bang)
sel 0 1 –> 0 makes it go down, 1 makes it go up, via [line]
There’s probably a "button off" code too, using the same button # and outputs a 1 rather than a 0. So you can use [route] for the two-element list and use the 0 or 1 that comes out to determine what the slider does.
Here is a better explanation about what i want to do..
I have a slider with a range of values 100, and i have a gamepad, and i want to use two buttons of it so i can go from the one side of the slider to the other slowly, value by value, what i want to say is when i press and hold the button with the value for example 3 i want the slider start going from 0 to 100 and the reverse when i press the button with the value 4 start abstract from 100 to 0..
can anyone explain how can i do this??
As always, there are many ways to do it…
You can use [metro] and [accum] to periodically increase or
decrease a value. Then you can simply route the [hi] list to
switch the metros on/off.
like this, for example:
----------begin_max5_patcher---------- 863.3ocyXtsbaBCDF9Z7SgJSuzwUG3j6c84nSlNXPMQc3fGPdZZyj28hVQbv oXiD1.4FXPFq8e+XOAOuxwcW4S7ZWzWQeG4377JGGXI0BNsW63lG+TRVbMba tIk447Bo6Z8uI4OIg0yD4hiqVbHu7fLiKg+Ctc08wxjGEEO7iJdhTaSV.cCd MhgCUmBCTGo3MXz8s+meVVHKhy4fM9VkHN6UaruhW2HjXonrn6N5uUuiQpS3 1CG2OQJrSk690cLVG4JJdUsjNVtV7WvxjFUpV8kUqTGVekrJNI4P9grXIeD. i.LJhdy.1I63EAFco.VJOohGWOBbEg0DBhF7itA35jc7h3hrT3RTLRbQITsy EZMt5533kxwq4YM9BZ2AorrvZumDAoSDO3oZ3MHXgPAdRXCFrPiVLlsmySsl UdTnpwV3HwGOtHEZ3T60+LqrYq628nWpLKCbOvu5w6z6h7O6456WYm3F1hb2 EW7fqkTXxaDUv+cig9uG8e5KHBFi2zOdHChGBQWmfXJerjK8W.kN4booBBRX cLCMBl7f54CCfP23ODTfXk0p50ViF7BEx73H3Rn2a4RlfkLQMjJYISH9SMSp yDo7JqyVnQP4eOhNooMcw+RHvsudDji4CG8CrBp84ziv6x400wOv6oopD8Yh 8dsG3mLOnEnm12iLyoM64MdgJOjjI1ivJ3OhPg12NAlzHfNbgSKgR+iQvlbl jykUkHp8DgomMhDwNyHm8W07JFf+DCdoYxBWn3qQyRZnu107t0rrCUBlZpbt 5P2QFavU6Kqo68b80fNWfEkY3aF5uTHjL1PpaLA6vBuEJIC9FLnQjiomigFA c27CFNGaDS2sPEwqZzNGwPd8SE1vUdXglV4AFvaDC4M1Y7.yzLZYw6+bmf2n V+TdUWdnJ4Uw1ZYD4nXS40RQATBny8zzw.8lO+nHMkWz8EoyEo6KahGZk.CC EpIgsSJEBYWpqP226SUazJd.sFXmVuVE4afjHypjnlRIxGKIENuRhYfjny6S NShkTiOMiRx6imjdm4NilleIQLPRyX7sAPJZVgTjIUJm2DNxDDJQ8wp1cr.8 WMiAsBO8JptwHc6V3iFcCZLZDasLMktMBbjVM25VpqtRwFXfX8l03fPCTj+U nnlKdY0+.Pyr32L -----------end_max5_patcher-----------
Thanks for the answer mudang, i have also a second question for controlling, i have a gswitch2 object and i would like to know if its possible to control it with one button of a gamepad, that is to say is when i press the button the gswitch2 change the output, but when i leave the button it comes back to its first situation because the output of the button again becomes 0, its possible somehow this not to be happen..???
yep, sure. that’s easy:
[route 4] (controller number)
[sel 1] (only let 1 thru, ignore 0)
PS: you might want to check out the max tutorials, that come with max
Thats works perfect thanks, but i have a question that might be stupid, the gswitch2 object it goes to right when it receives an 1 and to the left when it receives an 0, here we only let an 1 to pass, so how it goes from the one state to another?
The [select] object sends out a "bang" when the input matches the argument and this toggles the switch between open and closed, because you’re only sending this message on a "1" from your controller it works, you ignore all the 0s it sends when you release the button. I hope that explains things a bit better.