Using chowdsp_foleys with PGM

Hi could anyone tell me how to implement items from the chowdsp_foleys into my project. I have the modules in JUCE with the correct dependancies
Screenshot 2022-06-12 at 17.16.06

I have spent all day trying to work out how to use the presetsItem with foleys but can’t find any information.

Could someone point me in the right direction please?

Hi there!

The way that I typically do that is something like this:

class MyPlugin : public juce::AudioProcessor
{
public:
  MyPlugin() {
    presetManager = std::make_unique<chowdsp::PresetManager>(...);
  }

  auto& getPresetManager() { return *presetManager }

  auto* createEditor() {
    auto builder = std::make_unique<foleys::MagicGUIBuilder>(magicState);
    builder->registerJUCEFactories();
    builder->registerFactory("PresetsItem", &chowdsp::PresetsItem<MyPlugin>::factory);
    ...
  }

private:
  std::unique_ptr<chowdsp::PresetManager> presetManager;
};

Or, if you’re using chowdsp::PluginBase<>, then it’s a little bit simpler:

class MyPlugin : public chowdsp::PluginBase<MyPlugin>
{
public:
  MyPlugin() {
    presetManager = std::make_unique<chowdsp::PresetManager>(...);
  }

  auto* createEditor() {
    auto builder = std::make_unique<foleys::MagicGUIBuilder>(magicState);
    builder->registerJUCEFactories();
    builder->registerFactory("PresetsItem", &chowdsp::PresetsItem<MyPlugin>::factory);
    ...
  }
};

There’s a couple other tricks if you want to have some custom behaviour in the presets manager, or presets component, but that should be enough to get everything started!

Hi Jatin,

Thank you so much for chiming in.
I just realise that a couple of versions back I introduced the foleys::MagicProcessor, which is also an intermediate class that implements things for the juce::AudioProcessor, including setStateInformation and getStateInformation, adding a foleys::MagicPluginState etc.

Did you see that? Is that compatible with your chowdsp::PluginBase?