Forums > MaxMSP

(Probably easy) Beginners Question about Objects and Arguments

April 3, 2009 | 12:16 pm

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


April 3, 2009 | 12:19 pm

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.


April 3, 2009 | 12:29 pm

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.


April 3, 2009 | 12:43 pm

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?


April 3, 2009 | 1:09 pm

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.


April 5, 2009 | 2:26 pm

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.


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