You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1019B

  1. #pragma once
  2. #include <string>
  3. #include <list>
  4. namespace rack {
  5. struct ModuleWidget;
  6. struct Model;
  7. // Subclass this and return a pointer to a new one when init() is called
  8. struct Plugin {
  9. virtual ~Plugin();
  10. // A unique identifier for your plugin, e.g. "foo"
  11. std::string slug;
  12. // Human readable name for your plugin, e.g. "Foo Modular"
  13. std::string name;
  14. /** A list of the models made available by this plugin */
  15. std::list<Model*> models;
  16. };
  17. struct Model {
  18. virtual ~Model() {}
  19. Plugin *plugin;
  20. // A unique identifier for the model in this plugin, e.g. "vco"
  21. std::string slug;
  22. // Human readable name for your model, e.g. "VCO"
  23. std::string name;
  24. virtual ModuleWidget *createModuleWidget() { return NULL; }
  25. };
  26. extern std::list<Plugin*> gPlugins;
  27. void pluginInit();
  28. void pluginDestroy();
  29. } // namespace rack
  30. ////////////////////
  31. // Implemented by plugin
  32. ////////////////////
  33. /** Called once to initialize and return Plugin.
  34. Plugin is destructed when Rack closes
  35. */
  36. extern "C"
  37. rack::Plugin *init();