Forums > MaxMSP

Dynamically assign buffer~ & sfplay~ name


ctb
April 13, 2008 | 5:51 pm

Hi,

I’m currently using multiple versions of the same patch in one host match, (think multiple bpatchers of an external max project file), these seperate instances of projects all use a buffer and sfplay to trigger samples, the problem is when three bpatcher’s are loaded they all use the same buffer because the name’s the same. I’m trying to dynamically assign a new name to each instance of buffer/sfplay.

I’ve tried sending "set $s" but to no avail, the buffer just gets named "$s", not the name incoming to the ‘set’ mesagebox.

Can anyone recommend a way of assigning a new name to each buffer?

Thanks
Lou


April 13, 2008 | 6:34 pm

You can use # style arguments…

if you name a buffer like this it will work…

buffer~ #0_buffername

—when loaded in a bpatcher or as abstraction,- the #0_ will turn into a semi-random unique number, and will thus look something like this

buffer~ 1234_buffername



ctb
April 13, 2008 | 6:37 pm

This looks like it’s the answer, one quick question though. Will this work using both buffer & sfplay so the correct buffer is played back by sfplay?

Lou



ctb
April 13, 2008 | 6:39 pm

Just checked myself and it seems it does the trick. Thanks for the help!

Lou


April 29, 2008 | 8:24 pm

yes, it is a general thing in max.

if you start an argument with a #0, a random token is generated

if you start an argument with a #1, #2, … #9, the corresponding argument is passed down from the abstraction itself.


April 29, 2008 | 9:19 pm

Quote: ctb wrote on Sun, 13 April 2008 13:51
—————————————————-
> I’ve tried sending "set $s" but to no avail, the buffer just gets named "$s", not the name incoming to the ‘set’ mesagebox.

seems you have a solution already, but it’s not "set $s", it’s "set $1" that passes the name to the set messagebox.

cheers,
/ed


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