Sharing data between module & VM instances?

Post Reply
User avatar
Captain
Posts: 91
Joined: Sat Aug 25, 2018 11:12 am

Sharing data between module & VM instances?

Post by Captain » Sun Jan 17, 2021 2:40 pm

I'm wondering if there's a way to share data between modules that run inside different VM plugin instances? I know static variables are automatically shared between modules if they run inside the same VM plugin, but I'd need the modules to talk across different VM plugin instances.

For example, say I have module X. I insert the VM plugin on audio channel 1 in my DAW, and add an instance of module X. Then I do the same on channel 2. Can these two instances of module X talk to each other? I can think of some ways (files, sockets, probably something else too), but ideally it would easy, zero-latency and low-overhead. Too much to ask, or maybe there's an easy and obvious way I'm missing? :mrgreen:

User avatar
honki-bobo
Posts: 111
Joined: Sat Nov 09, 2019 1:18 pm

Re: Sharing data between module & VM instances?

Post by honki-bobo » Sun Jan 17, 2021 3:13 pm

Hey Captain,

as far as I understand (but please, anybody, correct me if I'm wrong here) each instance of VM runs its own Java virtual machine, so there is no way to communicate between different instances of VM through variables.

I don't know of any "easy and obvious way" to make modules communicate between various instances of VM, but I would prefer sockets for this communication. They are easy to implement and use and I would think that latency is negligible. Haven't tried it myself, though. If you gain any experiences in making modules communicate between different instances of VM through sockets, please share them here ;)

Best regards,
Martin
Image
Monkey Business Audio
Modules - Forum

ColinP
Posts: 84
Joined: Mon Aug 03, 2020 7:46 pm

Re: Sharing data between module & VM instances?

Post by ColinP » Sun Jan 17, 2021 3:18 pm

Have you tried using VoltageModule's SetManufacturerProperty() and GetManufacturerProperty() methods?

Not sure if it would work but would be interested to find out.

User avatar
Captain
Posts: 91
Joined: Sat Aug 25, 2018 11:12 am

Re: Sharing data between module & VM instances?

Post by Captain » Sun Jan 17, 2021 3:41 pm

Thanks for the ideas! Yeah, my (amateur...) understanding also tells me that VM plugin instances run in their own JVM, so there aren't any "natural" ways to share data between them. Several "slow" methods would probably work, like files or the manufacturer properties, but I was actually mainly interested in streaming audio between the modules, which means it would have to be zero-latency, otherwise it's kind of useless. Which means the different VM instances would have to stay in sample-accurate sync... which might be impossible, I'm guessing. :D Anyway, let's see, maybe there exists some magical way to do this!

ColinP
Posts: 84
Joined: Mon Aug 03, 2020 7:46 pm

Re: Sharing data between module & VM instances?

Post by ColinP » Sun Jan 17, 2021 4:25 pm

Sockets might work at sample rate but the last time I used them (about twenty years ago) they had quite a lot of latency, if I remember correctly.

Another option is shared memory using java.nio.MappedByteBuffer which should give you RAM speeds but it's not exactly a plug and play solution.

Post Reply