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.

40 lines
968B

  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 plugins
  8. */
  9. namespace plugin {
  10. void init();
  11. void destroy();
  12. /** Finds a loaded Plugin by slug. */
  13. Plugin* getPlugin(const std::string& pluginSlug);
  14. /** Finds a loaded Model by plugin and model slug. */
  15. Model* getModel(const std::string& pluginSlug, const std::string& modelSlug);
  16. /** Creates a Model from a JSON module object.
  17. Throws an Exception if the model is not found.
  18. */
  19. Model* modelFromJson(json_t* moduleJ);
  20. /** Checks that the slug contains only alphanumeric characters, "-", and "_" */
  21. bool isSlugValid(const std::string& slug);
  22. /** Returns a string containing only the valid slug characters. */
  23. std::string normalizeSlug(const std::string& slug);
  24. /** Path to plugins installation dir */
  25. extern std::string pluginsPath;
  26. extern std::vector<Plugin*> plugins;
  27. } // namespace plugin
  28. } // namespace rack