(Probably easy) Beginners Question about Objects and Arguments

Apr 3, 2009 at 12:16pm

(Probably easy) Beginners Question about Objects and Arguments

Dear all,

I have a, probably, easy question. If I want to give an object, let’s take the play~ object, certain arguments in its box but want to leave others open, how do you do that? For instance, I want to tell the play~ object to have 2 channels, but I don’t want to define a buffer name to play for it from the beginning. The problem here is that the channel argument is on 2nd place so I have to tell Max that this is supposed to be the channel argument by mentioning a placeholder name as the buffer argument.

Is there a more elegant way to do this?

Thanks a lot in advance!

Andre

#43179
Apr 3, 2009 at 12:19pm

Nope, you cannot do that. When using arguments, the place/order are fixed. The more flexible way is attributes. Jitter objects use them by default, but not all Max objects use attributes.
In the case of [play~], you can see in the reference that the buffer~ name is mandatory, though.
J-F.

#154807
Apr 3, 2009 at 12:29pm

Thanks J-F.

That’s annoying. The point is that I definitely know the number of channels play is supposed to have, but the buffer will be defined at runtime via the set (buffer) message. I cannot define the number of channels via a message. Mhmpf.

#154808
Apr 3, 2009 at 12:43pm

So just use a placeholder/dummy value for the argument you don’t care about. Whatever the default value is will do nicely.

You’ll see dozens of examples where this is done.

It’s not costing you anything more than typing a few characters. Is that a big deal?

#154809
Apr 3, 2009 at 1:09pm

No, it’s not a big deal. I am doing that at this moment. If you would’ve read my post more carefully it would’ve been clear that I was asking for an elegant way.

#154810
Apr 5, 2009 at 2:26pm

The alternative is attributes, to the extent that the object you want to use is attribute-savvy.

Whether or not that is more ‘elegant’ is a different question.

Those are all the options you get, though.

#154811

You must be logged in to reply to this topic.