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.

61 lines
1.3KB

  1. #pragma once
  2. #include <common.hpp>
  3. #include <plugin/Plugin.hpp>
  4. #include <jansson.h>
  5. #include <set>
  6. namespace rack {
  7. namespace app {
  8. struct ModuleWidget;
  9. } // namespace app
  10. namespace engine {
  11. struct Module;
  12. } // namespace engine
  13. namespace plugin {
  14. struct Model {
  15. Plugin* plugin = NULL;
  16. std::vector<std::string> presetPaths;
  17. /** Must be unique. Used for saving patches. Never change this after releasing your module.
  18. The model slug must be unique within your plugin, but it doesn't need to be unique among different plugins.
  19. */
  20. std::string slug;
  21. /** Human readable name for your model, e.g. "Voltage Controlled Oscillator" */
  22. std::string name;
  23. /** List of tag IDs representing the function(s) of the module.
  24. Tag IDs are not part of the ABI and may change at any time.
  25. */
  26. std::vector<int> tags;
  27. /** A one-line summary of the module's purpose */
  28. std::string description;
  29. virtual ~Model() {}
  30. /** Creates a headless Module */
  31. virtual engine::Module* createModule() {
  32. return NULL;
  33. }
  34. /** Creates a ModuleWidget with a Module attached */
  35. virtual app::ModuleWidget* createModuleWidget() {
  36. return NULL;
  37. }
  38. /** Creates a ModuleWidget with no Module, useful for previews */
  39. virtual app::ModuleWidget* createModuleWidgetNull() {
  40. return NULL;
  41. }
  42. void fromJson(json_t* rootJ);
  43. };
  44. } // namespace plugin
  45. } // namespace rack