Dynamically assign buffer~ & sfplay~ name
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?
You can use # style arguments…
if you name a buffer like this it will work…
—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
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?
Just checked myself and it seems it does the trick. Thanks for the help!
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.
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.