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.

88 lines
2.3KB

  1. #pragma once
  2. #include <common.hpp>
  3. #include <jansson.h>
  4. #include <list>
  5. namespace rack {
  6. namespace plugin {
  7. struct Model;
  8. // Subclass this and return a pointer to a new one when init() is called
  9. struct Plugin {
  10. /** List of models contained in this plugin.
  11. Add with addModel().
  12. */
  13. std::list<Model*> models;
  14. /** The file path to the plugin's directory.
  15. */
  16. std::string path;
  17. /** OS-dependent library handle.
  18. */
  19. void* handle = NULL;
  20. /** Must be unique. Used for saving patches. Never change this after releasing your plugin.
  21. To guarantee uniqueness, it is a good idea to prefix the slug by your "company name" if available, e.g. "MyCompany-MyPlugin"
  22. */
  23. std::string slug;
  24. /** Your plugin's latest version, using the guidelines at https://github.com/VCVRack/Rack/issues/266. Do not include the "v" prefix.
  25. */
  26. std::string version;
  27. /** The license type of your plugin. Use "proprietary" if all rights are reserved. If your license is in the [SPDX license list](https://spdx.org/licenses/), use its abbreviation in the "Identifier" column.
  28. */
  29. std::string license;
  30. /** Human-readable display name for your plugin. You can change this on a whim, unlike slugs.
  31. */
  32. std::string name;
  33. /** Prefix of each module name in the Module Browser.
  34. If blank, `name` is used.
  35. */
  36. std::string brand;
  37. /** A one-line summary of the plugin's purpose.
  38. If your plugin doesn't follow a theme, it’s probably best to omit this.
  39. */
  40. std::string description;
  41. /** Your name, company, alias, or GitHub username.
  42. */
  43. std::string author;
  44. /** Your email address for support inquiries.
  45. */
  46. std::string authorEmail;
  47. /** Homepage of the author.
  48. */
  49. std::string authorUrl;
  50. /** Homepage featuring the plugin itself.
  51. */
  52. std::string pluginUrl;
  53. /** The manual of your plugin. HTML, PDF, or GitHub readme/wiki are fine.
  54. */
  55. std::string manualUrl;
  56. /** The source code homepage. E.g. GitHub repo.
  57. */
  58. std::string sourceUrl;
  59. /** Link to donation page for users who wish to donate. E.g. PayPal URL.
  60. */
  61. std::string donateUrl;
  62. /** Link to the changelog of the plugin.
  63. */
  64. std::string changelogUrl;
  65. /** Last modified timestamp of the plugin directory.
  66. */
  67. double modifiedTimestamp = -INFINITY;
  68. ~Plugin();
  69. void addModel(Model* model);
  70. Model* getModel(const std::string& slug);
  71. void fromJson(json_t* rootJ);
  72. std::string getBrand();
  73. };
  74. } // namespace plugin
  75. } // namespace rack