getting a unique ID per device instance
In general I'm confused about the diffrerence between --- and #0. It appears that #0 doesn't work in m4l?
I'm succesfully using [s ---foo] in my patch but am unable to use [f #0] in order to retrieve a unique ID. I get 0.000000 from this - which was unexpected.
Is there a way I can retrieve the value of --- so I can use it in various ways?
Ultimately my goal is to gather, route, and display sorted data coming from all of the other instances of my M4L device, so maybe there's another approach I'm not considering...
Not sure..
...but if you dont use "---" at all, all the data you choose to send by this way can be share with all the instances of your device..
(Edit: i was thinking of parallele sending without --- to avoid conflict between the different instances of your device)
Maybe you can also use udpsend/udpreceive with appropriate formatting..
It depends what you want to do..
There is surely other ways...
Yes it can be shared, but I need a unique identifier so I can tell which message came from which instance. Normally in max I would use #0 to generate these. In other programming languages maybe some sort of UID function. I suppose I could make a random number generator in a seperate abstraction and keep track of what ID's I'm giving out.. but I think this is already built into max with --- or #0.
The only problem I have with using --- I guess is that I can't figure out how to get the underlying number into a message.
Still not sure but maybe udpsend/udpreceive is your objects..
Yeah, I could definitely use those -- but the problem I'm trying to solve is how to retrieve the #0 value or the --- value in a max4live patch. It feels like this must be something people do. In Pure Data this is done by sending a bang to [f $0] - but sending a bang into an object in max that is [f #0] does not return the generated number in a max4live instance like I hoped. (it just returns 0.0) And I can't seem to even create an object [f ---]. Anyone know how to do this?
Maybe you can format message in each device by something unique like the track number where you device is (and another number if you use several instance per track)
A very easy way to get a unique numeric id for a device instance is just to use [live.path this_device].
If you want to do --- method you need to be careful (IIRC) in case the first resolved number of the three is zero. It should always be treated as a symbol, even though it looks numeric. So I don't think storing in a [f] object will work the way you expect.
<pre><code> ----------begin_max5_patcher---------- 1156.3ocuW0ziaaCD8r8uBBcJAvdqHkjkTtUf1CKP2K8iSYKVPKQ6koTjFhT N1aP9u2gjR1R1dS75nVfEdsFQ9l4MyaFR+koSBVp1wzAnOf9HZxjuLcxDmIq gIsOOInhtqPP0tkETnppXRSvL+6LrcFm8egUojZSM0vPqYFCWtFYdlgL07MB 17Rp9YTIaKufg3v5nR6WJAj3q3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W6CnPU7OrxqJRGTK7QZReuMD3Uvkx5zuP+1OC281njn+fJ0nG fDTSE52YqaDz5imPPKJfT5fHYwvLjSAzVW8oIun3aQwCyLF.b7A8gEGWlO9b 0VLtel3jhASvpNMdSiFzW3zdmUjNiA8Q0dx8vN3SigqyzEw7ItzNYiMhXaKz Z9KsPh6OhYXl4bwZx4xrjSrz2SZHgWX6GOe.2EPJ63jHvwcidldrOEDF0P4y M30MsqcvZELU0MaNr2QBt6YY0y5Ms+LC20wl90o+K9Zjfe. -----------end_max5_patcher----------- </code></pre>
...you can actually just make a message box with --- in it, too. But again, it's a symbol.
put --- in a messagebox and bang it with live.thisdevice