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.

128 lines
4.5KB

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