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.

78 lines
3.4KB

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