Forums > MaxMSP

Setting initial value of a number box or a slider/knob?

August 7, 2009 | 2:17 pm

I can’t seem to find anything like "current value" from the attributes of a number box or a slider, so I can’t freeze it.

So far the only way I found to do this is to loadbang a message, which will then set the value of a number box.

However, is there any way to set the initial value within the number box or a slider/knob element to make the patch cleaner and to avoid using loadbang?


August 7, 2009 | 2:42 pm

did you know about pattr objects?
they have lots of features for getting and setting values to numberboxes/sliders/knobs…

cheers!
j


August 7, 2009 | 5:20 pm

hi,
quickest way: just place [autopattr @autoname 1] in your patch like this and it will save the actual state with the patch:

– Pasted Max Patch, click to expand. –

without the autoname attribute of autopattr you have to name your objects manualy like this:

– Pasted Max Patch, click to expand. –

greatz,
johann


August 7, 2009 | 5:26 pm

(whats wrong with sending messages?)

you can of course use the objects suggested above or even the
good old [preset] object.

but you might hate that later when you biuld bigger projects,
because you can not really control the load order with those.

-110

.


August 7, 2009 | 7:13 pm
Roman Thilenius wrote on Fri, 07 August 2009 19:26
(whats wrong with sending messages?)

you can of course use the objects suggested above or even the
good old [preset] object.

but you might hate that later when you biuld bigger projects,
because you can not really control the load order with those.

-110

.

Thanks guys, I’ll check it out.

The only thing wrong with messages (and probably with the other solutions above too) is that they take space. I was looking if there was some way to set the initial value as an attribute. It’s weird, since for example sliders have "min value" and "max value". Why not initial value? Same with number box – since they all have attributes, why not allow setting initial value there to save space.


August 7, 2009 | 7:18 pm

i think you can control the load order in pattrstorage setting priorities…


August 7, 2009 | 7:51 pm

I was just checking out the Live objects that will be available with Max4Live – in fact they seem to have initial value (http://www.cycling74.com/images/articles/creatingdevices_dz/ss5.png) Maybe it’ll come to native objects as well.


August 7, 2009 | 8:33 pm
posssu wrote on Fri, 07 August 2009 21:13
It’s weird, since for example sliders have "min value" and "max value". Why not initial value?

good point here.

my guess is that the idea has always been that an application
or bigger patch will either have no default setting or some
kind of custom automation/ presets.
and if it had custom automation/presets there is no need
for an initial state for individual objects and so they just
made all gui objects using the low limit as initial.

another thing is that gui objects can not take arguments,
and this is basically what you are aksing for, because a
init value via inspector brakes some rules about how the
inspector is intended to work.

[i] can be initialised by [i 5], [flonum] can not.

then again, [bpatcher] does take arguments, a bit a
different thing, but yeah, then why not also for flonum …

if you have a faster computer and dont need max4 backwards
compatibility, putting flonum into a bpatcher would be the
easiest and fastest way to build a custom flonum which can
be initialised, is that an option for you?

-110

,


August 7, 2009 | 9:40 pm

The reason why live GUI objects from MfL will have an initial attribute is that they’re linked to the automation. So basically they have a preset mechanism associated.
That’s not the case of regular Max objects, so I would rather use (auto)pattr/preset or a simple loadmess to initialize the value to whatever you want.


Viewing 9 posts - 1 through 9 (of 9 total)