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 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #pragma once
  2. #include <vector>
  3. #include <common.hpp>
  4. #include <plugin/Plugin.hpp>
  5. #include <plugin/Model.hpp>
  6. namespace rack {
  7. /** Loads and manages Rack plugins */
  8. namespace plugin {
  9. PRIVATE void init();
  10. PRIVATE void destroy();
  11. PRIVATE void settingsMergeJson(json_t* rootJ);
  12. /** Finds a loaded Plugin by slug. */
  13. Plugin* getPlugin(const std::string& pluginSlug);
  14. /** Finds a loaded Plugin by slug, or a fallback plugin if exists. */
  15. Plugin* getPluginFallback(const std::string& pluginSlug);
  16. /** Finds a loaded Model by plugin and model slug. */
  17. Model* getModel(const std::string& pluginSlug, const std::string& modelSlug);
  18. /** Finds a loaded Model by plugin and model slug, or a fallback model if exists. */
  19. Model* getModelFallback(const std::string& pluginSlug, const std::string& modelSlug);
  20. /** Creates a Model from a JSON module object.
  21. Throws an Exception if the model is not found.
  22. */
  23. Model* modelFromJson(json_t* moduleJ);
  24. /** Checks that the slug contains only alphanumeric characters, "-", and "_" */
  25. bool isSlugValid(const std::string& slug);
  26. /** Returns a string containing only the valid slug characters. */
  27. std::string normalizeSlug(const std::string& slug);
  28. /** Path to plugins installation dir */
  29. extern std::string pluginsPath;
  30. extern std::vector<Plugin*> plugins;
  31. } // namespace plugin
  32. } // namespace rack