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.

68 lines
1.6KB

  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. /** The file path of the plugins directory */
  17. std::string path;
  18. /** OS-dependent library handle */
  19. void *handle = NULL;
  20. /** Optional metadata for the Add Module context menu */
  21. std::string homepageUrl;
  22. std::string manualUrl;
  23. };
  24. struct Model {
  25. virtual ~Model() {}
  26. Plugin *plugin;
  27. /** A unique identifier for the model in this plugin, e.g. "VCO" */
  28. std::string slug;
  29. /** Human readable name for your model, e.g. "Voltage Controlled Oscillator" */
  30. std::string name;
  31. virtual ModuleWidget *createModuleWidget() { return NULL; }
  32. };
  33. extern std::list<Plugin*> gPlugins;
  34. extern std::string gToken;
  35. void pluginInit();
  36. void pluginDestroy();
  37. void pluginLogIn(std::string email, std::string password);
  38. void pluginLogOut();
  39. void pluginRefresh();
  40. void pluginCancelDownload();
  41. bool pluginIsLoggedIn();
  42. bool pluginIsDownloading();
  43. float pluginGetDownloadProgress();
  44. std::string pluginGetDownloadName();
  45. std::string pluginGetLoginStatus();
  46. } // namespace rack
  47. ////////////////////
  48. // Implemented by plugin
  49. ////////////////////
  50. /** Called once to initialize and return the Plugin instance.
  51. */
  52. extern "C"
  53. void init(rack::Plugin *plugin);