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.

43 lines
1.3KB

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