Dynamically assign buffer~ & sfplay~ name

Apr 13, 2008 at 5:51pm

Dynamically assign buffer~ & sfplay~ name

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

#36893
Apr 13, 2008 at 6:34pm

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

#126994
Apr 13, 2008 at 6:37pm

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

#126995
Apr 13, 2008 at 6:39pm

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

Lou

#126996
Apr 29, 2008 at 8:24pm

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.

#126997
Apr 29, 2008 at 9:19pm

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

#126998

You must be logged in to reply to this topic.