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.

65 lines
1.5KB

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