The JUCE cross-platform C++ framework, with DISTRHO/KXStudio specific changes
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.

85 lines
3.7KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2022 - Raw Material Software Limited
  5. JUCE is an open source library subject to commercial or open-source
  6. licensing.
  7. By using JUCE, you agree to the terms of both the JUCE 7 End-User License
  8. Agreement and JUCE Privacy Policy.
  9. End User License Agreement: www.juce.com/juce-7-licence
  10. Privacy Policy: www.juce.com/juce-privacy-policy
  11. Or: You may also use this code under the terms of the GPL v3 (see
  12. www.gnu.org/licenses).
  13. JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
  14. EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
  15. DISCLAIMED.
  16. ==============================================================================
  17. */
  18. #pragma once
  19. #include "PluginGraph.h"
  20. //==============================================================================
  21. /**
  22. Manages the internal plugin types.
  23. */
  24. class InternalPluginFormat : public AudioPluginFormat
  25. {
  26. public:
  27. //==============================================================================
  28. InternalPluginFormat();
  29. //==============================================================================
  30. const std::vector<PluginDescription>& getAllTypes() const;
  31. //==============================================================================
  32. static String getIdentifier() { return "Internal"; }
  33. String getName() const override { return getIdentifier(); }
  34. bool fileMightContainThisPluginType (const String&) override { return true; }
  35. FileSearchPath getDefaultLocationsToSearch() override { return {}; }
  36. bool canScanForPlugins() const override { return false; }
  37. bool isTrivialToScan() const override { return true; }
  38. void findAllTypesForFile (OwnedArray<PluginDescription>&, const String&) override {}
  39. bool doesPluginStillExist (const PluginDescription&) override { return true; }
  40. String getNameOfPluginFromIdentifier (const String& fileOrIdentifier) override { return fileOrIdentifier; }
  41. bool pluginNeedsRescanning (const PluginDescription&) override { return false; }
  42. StringArray searchPathsForPlugins (const FileSearchPath&, bool, bool) override { return {}; }
  43. private:
  44. class InternalPluginFactory
  45. {
  46. public:
  47. using Constructor = std::function<std::unique_ptr<AudioPluginInstance>()>;
  48. explicit InternalPluginFactory (const std::initializer_list<Constructor>& constructorsIn);
  49. const std::vector<PluginDescription>& getDescriptions() const { return descriptions; }
  50. std::unique_ptr<AudioPluginInstance> createInstance (const String& name) const;
  51. private:
  52. const std::vector<Constructor> constructors;
  53. const std::vector<PluginDescription> descriptions;
  54. };
  55. //==============================================================================
  56. void createPluginInstance (const PluginDescription&,
  57. double initialSampleRate, int initialBufferSize,
  58. PluginCreationCallback) override;
  59. std::unique_ptr<AudioPluginInstance> createInstance (const String& name);
  60. bool requiresUnblockedMessageThreadDuringCreation (const PluginDescription&) const override;
  61. InternalPluginFactory factory;
  62. };