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.

135 lines
2.8KB

  1. #pragma once
  2. #include <string>
  3. #include <list>
  4. namespace rack {
  5. enum ModelTag {
  6. AMPLIFIER_TAG,
  7. ATTENUATOR_TAG,
  8. BLANK_TAG,
  9. CLOCK_TAG,
  10. CONTROLLER_TAG,
  11. DELAY_TAG,
  12. DIGITAL_TAG,
  13. DISTORTION_TAG,
  14. DRUM_TAG,
  15. DUAL_TAG,
  16. DYNAMICS_TAG,
  17. EFFECT_TAG,
  18. ENVELOPE_FOLLOWER_TAG,
  19. ENVELOPE_GENERATOR_TAG,
  20. EQUALIZER_TAG,
  21. EXTERNAL_TAG,
  22. FILTER_TAG,
  23. FUNCTION_GENERATOR_TAG,
  24. GRANULAR_TAG,
  25. LFO_TAG,
  26. LOGIC_TAG,
  27. LOW_PASS_GATE_TAG,
  28. MIDI_TAG,
  29. MIXER_TAG,
  30. MULTIPLE_TAG,
  31. NOISE_TAG,
  32. OSCILLATOR_TAG,
  33. PANNING_TAG,
  34. QUAD_TAG,
  35. QUANTIZER_TAG,
  36. RANDOM_TAG,
  37. REVERB_TAG,
  38. RING_MODULATOR_TAG,
  39. SAMPLE_AND_HOLD_TAG,
  40. SAMPLER_TAG,
  41. SEQUENCER_TAG,
  42. SLEW_LIMITER_TAG,
  43. SWITCH_TAG,
  44. SYNTH_VOICE_TAG,
  45. TUNER_TAG,
  46. UTILITY_TAG,
  47. VISUAL_TAG,
  48. WAVESHAPER_TAG,
  49. NUM_TAGS
  50. };
  51. struct ModuleWidget;
  52. struct Model;
  53. // Subclass this and return a pointer to a new one when init() is called
  54. struct Plugin {
  55. /** A list of the models available by this plugin, add with addModel() */
  56. std::list<Model*> models;
  57. /** The file path of the plugin's directory */
  58. std::string path;
  59. /** OS-dependent library handle */
  60. void *handle = NULL;
  61. /** Used when syncing plugins with the API */
  62. std::string slug;
  63. // Optional plugin metadata
  64. /** The version of your plugin
  65. Plugins should follow the versioning scheme described at https://github.com/VCVRack/Rack/issues/266
  66. Do not include the "v" in "v1.0" for example.
  67. */
  68. std::string version;
  69. /** URL for plugin homepage */
  70. std::string website;
  71. /** URL for plugin manual */
  72. std::string manual;
  73. virtual ~Plugin();
  74. void addModel(Model *model);
  75. };
  76. struct Model {
  77. Plugin *plugin = NULL;
  78. /** An identifier for the model, e.g. "VCO". Used for saving patches. The slug, manufacturerSlug pair must be unique. */
  79. std::string slug;
  80. /** Human readable name for your model, e.g. "Voltage Controlled Oscillator" */
  81. std::string name;
  82. /** An identifier for the manufacturer, e.g. "foo". Used for saving patches. */
  83. std::string manufacturerSlug;
  84. /** Human readable name for the manufacturer, e.g. "Foo Modular" */
  85. std::string manufacturerName;
  86. /** List of tags representing the function(s) of the module */
  87. std::list<ModelTag> tags;
  88. virtual ~Model() {}
  89. virtual ModuleWidget *createModuleWidget() { return NULL; }
  90. };
  91. void pluginInit();
  92. void pluginDestroy();
  93. void pluginLogIn(std::string email, std::string password);
  94. void pluginLogOut();
  95. void pluginRefresh();
  96. void pluginCancelDownload();
  97. bool pluginIsLoggedIn();
  98. bool pluginIsDownloading();
  99. float pluginGetDownloadProgress();
  100. std::string pluginGetDownloadName();
  101. std::string pluginGetLoginStatus();
  102. extern std::list<Plugin*> gPlugins;
  103. extern std::string gToken;
  104. extern std::string gTagNames[NUM_TAGS];
  105. } // namespace rack
  106. ////////////////////
  107. // Implemented by plugin
  108. ////////////////////
  109. /** Called once to initialize and return the Plugin instance.
  110. You must implement this in your plugin
  111. */
  112. extern "C"
  113. void init(rack::Plugin *plugin);