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.

69 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. std::string version;
  24. };
  25. struct Model {
  26. virtual ~Model() {}
  27. Plugin *plugin;
  28. /** A unique identifier for the model in this plugin, e.g. "VCO" */
  29. std::string slug;
  30. /** Human readable name for your model, e.g. "Voltage Controlled Oscillator" */
  31. std::string name;
  32. virtual ModuleWidget *createModuleWidget() { return NULL; }
  33. };
  34. extern std::list<Plugin*> gPlugins;
  35. extern std::string gToken;
  36. void pluginInit();
  37. void pluginDestroy();
  38. void pluginLogIn(std::string email, std::string password);
  39. void pluginLogOut();
  40. void pluginRefresh();
  41. void pluginCancelDownload();
  42. bool pluginIsLoggedIn();
  43. bool pluginIsDownloading();
  44. float pluginGetDownloadProgress();
  45. std::string pluginGetDownloadName();
  46. std::string pluginGetLoginStatus();
  47. } // namespace rack
  48. ////////////////////
  49. // Implemented by plugin
  50. ////////////////////
  51. /** Called once to initialize and return the Plugin instance.
  52. */
  53. extern "C"
  54. void init(rack::Plugin *plugin);