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.

125 lines
4.3KB

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