Dynamically change size of rslider?

foldh's icon

Pretty new to Max and am looking for a little help with the following...

I'm using rslider to set loop start and end points in a groove object. I know how to change the maximum size to match the length of the sample using the Inspector. What I am wondering though is if there is a way to automate this so that when loading a new file into a buffer the max value of the rslider is changed to match this?

Paul

ch's icon

Hi Paul.

To get the length of the buffer, you can use [info~].
to dynamically change the size of [rslider], you can send it the messages
"min $1" to set the minimum value, and "size $1" to set its range.

ch's icon

by the way, to know which message you have to send to set an attribute that you see in the inspector, you can simply drag and drop the attribute from the inspector to the patcher.

commathe's icon

What you could do, that might be a whole lot easier, is use a scale object. Then all you need to do is feed it the length of the buffer as the "output max" value when the buffer changes. Might be much easier than modifying the rslider directly.

foldh's icon

Many thanks to you both for the info. Hadn't realised messeges could be sent directly to an Inspector, very useful to know!

I will also give the scale method a go.

Paul