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.

147 lines
5.1KB

  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. #ifndef DOXYGEN
  19. // Forward declarations to avoid leaking implementation details.
  20. namespace Steinberg::Vst
  21. {
  22. class IComponent;
  23. } // namespace Steinberg::Vst
  24. #endif
  25. //==============================================================================
  26. #if TARGET_OS_IPHONE
  27. struct OpaqueAudioComponentInstance;
  28. typedef struct OpaqueAudioComponentInstance* AudioComponentInstance;
  29. #else
  30. struct ComponentInstanceRecord;
  31. typedef struct ComponentInstanceRecord* AudioComponentInstance;
  32. #endif
  33. typedef AudioComponentInstance AudioUnit;
  34. //==============================================================================
  35. /* If you are including the VST headers inside a namespace this forward
  36. declaration may cause a collision with the contents of `aeffect.h`.
  37. If that is the case you can avoid the collision by placing a `struct AEffect;`
  38. forward declaration inside the namespace and before the inclusion of the VST
  39. headers, e.g. @code
  40. namespace Vst2
  41. {
  42. struct AEffect;
  43. #include <pluginterfaces/vst2.x/aeffect.h>
  44. #include <pluginterfaces/vst2.x/aeffectx.h>
  45. }
  46. @endcode
  47. */
  48. struct AEffect;
  49. //==============================================================================
  50. namespace juce
  51. {
  52. //==============================================================================
  53. /** Create a derived implementation of this class and pass it to
  54. AudioPluginInstance::getExtensions() to retrieve format-specific
  55. information about a plugin instance.
  56. Note that the references passed to the visit member functions are only
  57. guaranteed to live for the duration of the function call, so don't
  58. store pointers to these objects! If you need to store and reuse
  59. format-specific information, it is recommended to copy the result
  60. of the function calls that you care about. For example, you should
  61. store the result of VST::getAEffectPtr() rather than storing a pointer
  62. to the VST instance.
  63. @tags{Audio}
  64. */
  65. struct ExtensionsVisitor
  66. {
  67. /** Indicates that there is no platform specific information available. */
  68. struct Unknown {};
  69. /** Can be used to retrieve information about a VST3 that is wrapped by an AudioProcessor. */
  70. struct VST3Client
  71. {
  72. virtual ~VST3Client() = default;
  73. virtual Steinberg::Vst::IComponent* getIComponentPtr() const noexcept = 0;
  74. virtual MemoryBlock getPreset() const = 0;
  75. virtual bool setPreset (const MemoryBlock&) const = 0;
  76. };
  77. /** Can be used to retrieve information about an AudioUnit that is wrapped by an AudioProcessor. */
  78. struct AudioUnitClient
  79. {
  80. virtual ~AudioUnitClient() = default;
  81. virtual AudioUnit getAudioUnitHandle() const noexcept = 0;
  82. };
  83. /** Can be used to retrieve information about a VST that is wrapped by an AudioProcessor. */
  84. struct VSTClient
  85. {
  86. virtual ~VSTClient() = default;
  87. virtual AEffect* getAEffectPtr() const noexcept = 0;
  88. };
  89. /** Can be used to retrieve information about a plugin that provides ARA extensions. */
  90. struct ARAClient
  91. {
  92. virtual ~ARAClient() = default;
  93. virtual void createARAFactoryAsync (std::function<void (ARAFactoryWrapper)>) const = 0;
  94. };
  95. ExtensionsVisitor() = default;
  96. ExtensionsVisitor (const ExtensionsVisitor&) = default;
  97. ExtensionsVisitor (ExtensionsVisitor&&) = default;
  98. ExtensionsVisitor& operator= (const ExtensionsVisitor&) = default;
  99. ExtensionsVisitor& operator= (ExtensionsVisitor&&) = default;
  100. virtual ~ExtensionsVisitor() = default;
  101. /** Will be called if there is no platform specific information available. */
  102. virtual void visitUnknown (const Unknown&) {}
  103. /** Called with VST3-specific information. */
  104. virtual void visitVST3Client (const VST3Client&) {}
  105. /** Called with VST-specific information. */
  106. virtual void visitVSTClient (const VSTClient&) {}
  107. /** Called with AU-specific information. */
  108. virtual void visitAudioUnitClient (const AudioUnitClient&) {}
  109. /** Called with ARA-specific information. */
  110. virtual void visitARAClient (const ARAClient&) {}
  111. };
  112. } // namespace juce