Sharing real-time data between app's
Posted: Sun Jun 22, 2014 4:28 am
Hi All,
As I've hinted at in a few other recent posts, I've been working on a way to share data in real time between different VST instances and different applications - and finally I have a little something to show you.
Be warned, it takes a little bit of setting up with these prototypes - I've just rebuilt from scratch following the bad news that the Ruby Win32API is rather broken at the moment. But that's been kind of cool - I just built my first ever C++ dll, so I'm rather pleased with myself.
First, here are the files that you sill need...
Unfortunately because of the way this works, there's no way to embed the .dll file within the schematic or exports - the apps that want to share data have to share the same copy of the .dll. So here's how to go about trying it out...
1) Unzip the zip file.
2) Put the "FS_MappedFile.dll" in a safe location, and make a note of where. (Ignore the other files - they're just the original C++ source code so that the 'C++ gurus' can have a bit of a laugh!)
3) Now open the Flowstone file.
4) At the top is a 'DLL location' string box - you need to put the full path to the .dll file into here. This then gets memorised by all the other nodules (would be easier with the 'Folder' primitives, but I really need to go and get some sleep!).
5) On the module "Shared Memory" click the 'open' button - a very large number should appear in the 'address' box.
6) Near the bottom are "Test RX" and "Test TX" - export both of these as EXEs.
7) Now open the two EXE's that you just exported and have a play (keep FS open too for even more, erm, "fun").
8) With any luck, you should see the bar-graphs in the receivers move with the transmitter's knobs - and also inside FlowStone.
Not the most exciting example, and a lot of refinement to do yet. The .dll will always need installing by anyone you share exports with, unfortunately - but if I understand how all this .dll stuff works, there's really no way to avoid that (the same would be true if it had been done the Ruby way).
But lots of scope for exciting things. If you look inside, you'll see that the data is accessed by the .dll using Ruby audio frames. Even my previous Win32API version was able to handle audio, and the C++ .dll should be faster still. Sharing audio would work properly only for plugins inside the same VST host, as there would have to be a shared audio clock - but for asynchronous data, you would be able to share between applications too, as in the example.
WARNING - do not try to put the modules into your toolbox! This crashes Flowstone - not sure why yet, but it's probably just my beginner's level C++ code doing something odd!
Lots to do yet, though.
I'd be glad to hear from anyone who can critique my C++ code, or is savvy about concurrency, mutexes and all that malarky, as I realise that different app's sharing will need a way to avoid tripping over each other - so I'm throwing this open to anyone who fancies contributing.
Happy Flowstoning
Trog.
As I've hinted at in a few other recent posts, I've been working on a way to share data in real time between different VST instances and different applications - and finally I have a little something to show you.
Be warned, it takes a little bit of setting up with these prototypes - I've just rebuilt from scratch following the bad news that the Ruby Win32API is rather broken at the moment. But that's been kind of cool - I just built my first ever C++ dll, so I'm rather pleased with myself.
First, here are the files that you sill need...
Unfortunately because of the way this works, there's no way to embed the .dll file within the schematic or exports - the apps that want to share data have to share the same copy of the .dll. So here's how to go about trying it out...
1) Unzip the zip file.
2) Put the "FS_MappedFile.dll" in a safe location, and make a note of where. (Ignore the other files - they're just the original C++ source code so that the 'C++ gurus' can have a bit of a laugh!)
3) Now open the Flowstone file.
4) At the top is a 'DLL location' string box - you need to put the full path to the .dll file into here. This then gets memorised by all the other nodules (would be easier with the 'Folder' primitives, but I really need to go and get some sleep!).
5) On the module "Shared Memory" click the 'open' button - a very large number should appear in the 'address' box.
6) Near the bottom are "Test RX" and "Test TX" - export both of these as EXEs.
7) Now open the two EXE's that you just exported and have a play (keep FS open too for even more, erm, "fun").
8) With any luck, you should see the bar-graphs in the receivers move with the transmitter's knobs - and also inside FlowStone.
Not the most exciting example, and a lot of refinement to do yet. The .dll will always need installing by anyone you share exports with, unfortunately - but if I understand how all this .dll stuff works, there's really no way to avoid that (the same would be true if it had been done the Ruby way).
But lots of scope for exciting things. If you look inside, you'll see that the data is accessed by the .dll using Ruby audio frames. Even my previous Win32API version was able to handle audio, and the C++ .dll should be faster still. Sharing audio would work properly only for plugins inside the same VST host, as there would have to be a shared audio clock - but for asynchronous data, you would be able to share between applications too, as in the example.
WARNING - do not try to put the modules into your toolbox! This crashes Flowstone - not sure why yet, but it's probably just my beginner's level C++ code doing something odd!
Lots to do yet, though.
I'd be glad to hear from anyone who can critique my C++ code, or is savvy about concurrency, mutexes and all that malarky, as I realise that different app's sharing will need a way to avoid tripping over each other - so I'm throwing this open to anyone who fancies contributing.
Happy Flowstoning
Trog.