Loading a patch from plugin

I would like to load a patch file from a method in my plugin. PatchManager::load seems to be the method I want, but when I call it in my code:

APP->patch->load("/Users/adammalone/Desktop/basic-patch.vcv");

I get a compile-time error: error: member access into incomplete type 'rack::PatchManager'

src/lib/routes/Rack.cpp:47:5: error: member access into incomplete type 'rack::PatchManager'
  pm->load("/Users/adammalone/Desktop/basic-patch.vcv");
    ^
../../include/app.hpp:19:8: note: forward declaration of 'rack::PatchManager'
struct PatchManager;
       ^
1 error generated.
make[1]: *** [build/src/lib/routes/Rack.cpp.o] Error 1
make: *** [plugins] Error 2

Any help would be most appreciated!

You have to include patch.hpp.

But I have to say I tried the same not so long ago and couldn’t get it working reliable. The problem is that loading a patch from a module causes synchronization issues. My best guess is that whenever you initiate a load of a patch the engine threads or the app thread are in the middle of processing a sample or frame resp. and loading will interfere with that. Sometimes it worked for me but most of the time Rack crashed. I found no way to synchronize it…

You can look at my experiments you like:

1 Like

This looks like it’s been fixed. Tried this out myself and so far it works well. It also makes the Menu Bar extension work along with importable/exportable favourites list. No need for MB module!

1 Like