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.

132 lines
4.6KB

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