Multiple instances of a device sharing a universal coll

Learn about building and using Max for Live devices.
Post Reply
cyclone975
Posts: 25
Joined: Sun May 31, 2015 7:22 am

Multiple instances of a device sharing a universal coll

Post by cyclone975 » Sat Nov 21, 2015 11:13 pm

Hi all,

I am curious if anyone can help me sort this out.

I have a device that contains at its heart a coll. This coll should always start out a certain way for usability (e.g., "state 1"), but will change dynamically (e.g., state 2). The coll state gets saved by a pattr as blob storage and is recalled with the Live set.

I also want to be able to use multiple instances of this device, and each instance shares this coll.

The problem is, once I make the first instance how I like it, then drag a new instance of it into a track, all instances revert back to "state 1." Changing one instance back to "state 2" changes them all, but I would like to not have to do this.

This is also a bummer because when I get all instances right again, and I save and close my set and open it back up again, it goes back to "state 1." (long boring explanation of why I think this is: If device 1 gets set to state 2, then device 2 gets created, both go back to state 1. This gets fixed by putting device 1 back to state 2. Then this symptom happens. If I had changed device 2 to state 2, fixing both, the save-close-reopen step doesn't cause any problems. So I believe the pattr from device 2 never gets "fixed" when I change "device 1" back to "state 2" above.)

I would essentially like my device to be more generous with the shared coll and pattr storage.

Any thoughts??
Super boring problem I know... thanks for making it this far.

doubleUG
Posts: 249
Joined: Sun Apr 24, 2011 7:19 am

Re: Multiple instances of a device sharing a universal coll

Post by doubleUG » Sun Nov 22, 2015 9:41 am

you could perhaps make a local Coll an dump the values per global send to the other local Colls,
so nothing is overwritten unles you want it.
copy the text, open Live > drag in empty M4L device > open Max editor > paste > save M4L device
https://docs.cycling74.com/max8/vignett ... ng_patches

https://doubleUG.bandcamp.com/releases

cyclone975
Posts: 25
Joined: Sun May 31, 2015 7:22 am

Re: Multiple instances of a device sharing a universal coll

Post by cyclone975 » Mon Nov 23, 2015 8:40 pm

That global send idea has got me thinking. The challenge is, I want device 2 to initialize in state 2. Not sure if I made that clear.

dataf1ow
Posts: 230
Joined: Wed Oct 08, 2008 4:28 pm

Re: Multiple instances of a device sharing a universal coll

Post by dataf1ow » Mon Nov 23, 2015 9:49 pm

How about if you made a check that looks to see if another of the same device is already loaded. If not, then initialize state 1, if there is, then don't initialize state 1, and the coll remains as you set it in the previous device.

cyclone975
Posts: 25
Joined: Sun May 31, 2015 7:22 am

Re: Multiple instances of a device sharing a universal coll

Post by cyclone975 » Tue Nov 24, 2015 2:53 am

dataf1ow wrote:How about if you made a check that looks to see if another of the same device is already loaded. If not, then initialize state 1, if there is, then don't initialize state 1, and the coll remains as you set it in the previous device.
That sounds exactly like what I need to do, but I have no idea how to perform either the check or the altering of the initializing. Could you point me in the right direction? My guess is digging into the live API for the check and setting the "initial enable" mode based on the check, however I don't know how I'd get to that before the device initialized itself...
Thanks for your help!

RadioOnMars
Posts: 36
Joined: Tue Oct 13, 2015 9:06 am

Re: Multiple instances of a device sharing a universal coll

Post by RadioOnMars » Tue Nov 24, 2015 11:57 am

the beatseeker device uses a "check if another instance of the same device is loaded somwhere else in the set already" method. Let me know if you need.

and you're this local messaging [send ---myMessage] ? (I don't quite follow why the initialize problem happens)

dataf1ow
Posts: 230
Joined: Wed Oct 08, 2008 4:28 pm

Re: Multiple instances of a device sharing a universal coll

Post by dataf1ow » Tue Nov 24, 2015 4:15 pm

Here's my quick attempt. I didn't mess with any of the API stuff, I thought it would be more efficient (and easier) to just assign each device an ID on startup, and then query all other IDs. If there aren't any other devices, it will alert you that it's using the initial state. If there are other devices every device will no alert you that they are using the current state. Hope that's what you were getting at?

Code: Select all

----------begin_max5_patcher----------
1237.3oc4YkziaaCF8r8uBBc10fKZsnWRZJJBPN0kSIAAxRzdXfVLnnbloAo
+1qDo7xLiVnTzBxzKRVTzheuGeeaRec8Jico2SyL.+L38fUq955UqjCUNvpp
qWYD6eePjelbZFIzujt6yFaT2RPuWHGl6mDlFCPPH778RyEQTg3giT0y2fkT
L2OVc2i9hf6XIG9DmFHTSvzlrEtAPP1kmbvkGwvsvK+mj7XVRwyTZI3pAYgR
Cnvn9IDw35LUKubpnpQyDODIMFCixA9150kG178g7P5dJOJ8KMBacvrEDJO0
AlQ0fY7Bf4i7x8xlQkqkmbmz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5
jcvym8f0wdlOeqxugQmaWkui3alzjaOc5c40g8DyBOlxRDUAjMcvkuWbh5qb
YiToVd7Up7M1V1xYZdaE2iH5zIxJY9hcnk8HY6YxdP5XOn4KSnmFdGj4KZFR
GuC7LxO5jZ9ItzSp8nSzU7LVIkN5Yq40b5rPy4KY3SpRZwSFpytEdVsFjFVy
PRLq5Yw+3wSTdV0iTZHEM58YU63NajWxRTWJehFb5I144aKGwmWz4lnnssbt
p0n6sUuvSi3zPJOImU8hhJV4us9+.4H4.yC
-----------end_max5_patcher-----------


cyclone975
Posts: 25
Joined: Sun May 31, 2015 7:22 am

Re: Multiple instances of a device sharing a universal coll

Post by cyclone975 » Tue Nov 24, 2015 7:34 pm

RadioOnMars wrote:the beatseeker device uses a "check if another instance of the same device is loaded somwhere else in the set already" method. Let me know if you need.

and you're this local messaging [send ---myMessage] ? (I don't quite follow why the initialize problem happens)
I got that patch from the other thread you just posted in, thank you! I'm going to take a look at it when I get home. The initialize problem is happening because I am saving the info in my coll using a pattr with blob storage. I have the pattr set to an initial state of "state 1," so every time I open up a new instance of the device the coll gets written to "state 1", which is shared globally among the devices.

cyclone975
Posts: 25
Joined: Sun May 31, 2015 7:22 am

Re: Multiple instances of a device sharing a universal coll

Post by cyclone975 » Tue Nov 24, 2015 7:36 pm

dataf1ow wrote:Here's my quick attempt. I didn't mess with any of the API stuff, I thought it would be more efficient (and easier) to just assign each device an ID on startup, and then query all other IDs. If there aren't any other devices, it will alert you that it's using the initial state. If there are other devices every device will no alert you that they are using the current state. Hope that's what you were getting at?

Code: Select all

----------begin_max5_patcher----------
1237.3oc4YkziaaCF8r8uBBc10fKZsnWRZJJBPN0kSIAAxRzdXfVLnnbloAo
+1qDo7xLiVnTzBxzKRVTzheuGeeaRec8Jico2SyL.+L38fUq955UqjCUNvpp
qWYD6eePjelbZFIzujt6yFaT2RPuWHGl6mDlFCPPH778RyEQTg3giT0y2fkT
L2OVc2i9hf6XIG9DmFHTSvzlrEtAPP1kmbvkGwv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9x2RTUN9ioxrhFEBNyImaNEft.sPZlfkb4MV+9qeLZvU7eMF7YnG
xx72EQkXEV6lZurGXW1i4rYODcLGmYybrzwbfyG63pg8LehmxujTmhYq40b5
jcvym8f0wdlOeqxugQmaWkui3alzjaOc5c40g8DyBOlxRDUAjMcvkuWbh5qb
YiToVd7Up7M1V1xYZdaE2iH5zIxJY9hcnk8HY6YxdP5XOn4KSnmFdGj4KZFR
GuC7LxO5jZ9ItzSp8nSzU7LVIkN5Yq40b5rPy4KY3SpRZwSFpytEdVsFjFVy
PRLq5Yw+3wSTdV0iTZHEM58YU63NajWxRTWJehFb5I144aKGwmWz4lnnssbt
p0n6sUuvSi3zPJOImU8hhJV4us9+.4H4.yC
-----------end_max5_patcher-----------

Thank you so much for the code! This really helps and I never would have thought of it, haha.

dataf1ow
Posts: 230
Joined: Wed Oct 08, 2008 4:28 pm

Re: Multiple instances of a device sharing a universal coll

Post by dataf1ow » Wed Nov 25, 2015 3:49 pm

No worries! Glad you found it helpful.

Post Reply