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.

Plugin.hpp 2.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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.
  25. Do not include the "v" prefix.
  26. */
  27. std::string version;
  28. /** 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.
  29. */
  30. std::string license;
  31. /** Human-readable display name for your plugin. You can change this on a whim, unlike slugs.
  32. */
  33. std::string name;
  34. /** Prefix of each module name in the Module Browser.
  35. If blank, `name` is used.
  36. */
  37. std::string brand;
  38. /** A one-line summary of the plugin's purpose.
  39. If your plugin doesn't follow a theme, it’s probably best to omit this.
  40. */
  41. std::string description;
  42. /** Your name, company, alias, or GitHub username.
  43. */
  44. std::string author;
  45. /** Your email address for support inquiries.
  46. */
  47. std::string authorEmail;
  48. /** Homepage of the author.
  49. */
  50. std::string authorUrl;
  51. /** Homepage featuring the plugin itself.
  52. */
  53. std::string pluginUrl;
  54. /** The manual of your plugin. HTML, PDF, or GitHub readme/wiki are fine.
  55. */
  56. std::string manualUrl;
  57. /** The source code homepage. E.g. GitHub repo.
  58. */
  59. std::string sourceUrl;
  60. /** Link to donation page for users who wish to donate. E.g. PayPal URL.
  61. */
  62. std::string donateUrl;
  63. /** Link to the changelog of the plugin.
  64. */
  65. std::string changelogUrl;
  66. /** Last modified timestamp of the plugin directory.
  67. */
  68. double modifiedTimestamp = -INFINITY;
  69. ~Plugin();
  70. void addModel(Model* model);
  71. Model* getModel(const std::string& slug);
  72. void fromJson(json_t* rootJ);
  73. void modulesFromJson(json_t* rootJ);
  74. std::string getBrand();
  75. };
  76. } // namespace plugin
  77. } // namespace rack