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.

126 lines
5.1KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE 6 technical preview.
  4. Copyright (c) 2017 - ROLI Ltd.
  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. namespace juce
  14. {
  15. #if JUCE_MSVC
  16. #pragma warning (push, 0)
  17. // MSVC does not like it if you override a deprecated method even if you
  18. // keep the deprecation attribute. Other compilers are more forgiving.
  19. #pragma warning (disable: 4996)
  20. #endif
  21. //==============================================================================
  22. /**
  23. Base class for an active instance of a plugin.
  24. This derives from the AudioProcessor class, and adds some extra functionality
  25. that helps when wrapping dynamically loaded plugins.
  26. This class is not needed when writing plugins, and you should never need to derive
  27. your own sub-classes from it. The plugin hosting classes use it internally and will
  28. return AudioPluginInstance objects which wrap external plugins.
  29. @see AudioProcessor, AudioPluginFormat
  30. @tags{Audio}
  31. */
  32. class JUCE_API AudioPluginInstance : public AudioProcessor
  33. {
  34. public:
  35. //==============================================================================
  36. /** Destructor.
  37. Make sure that you delete any UI components that belong to this plugin before
  38. deleting the plugin.
  39. */
  40. ~AudioPluginInstance() override = default;
  41. //==============================================================================
  42. /** Fills-in the appropriate parts of this plugin description object. */
  43. virtual void fillInPluginDescription (PluginDescription&) const = 0;
  44. /** Returns a PluginDescription for this plugin.
  45. This is just a convenience method to avoid calling fillInPluginDescription.
  46. */
  47. PluginDescription getPluginDescription() const;
  48. /** Returns a pointer to some kind of platform-specific data about the plugin.
  49. E.g. For a VST, this value can be cast to an AEffect*. For an AudioUnit, it can be
  50. cast to an AudioUnit handle.
  51. */
  52. virtual void* getPlatformSpecificData();
  53. // Rather than using these methods you should call the corresponding methods
  54. // on the AudioProcessorParameter objects returned from getParameters().
  55. // See the implementations of the methods below for some examples of how to
  56. // do this.
  57. //
  58. // In addition to being marked as deprecated these methods will assert on
  59. // the first call.
  60. JUCE_DEPRECATED (String getParameterID (int index) override);
  61. JUCE_DEPRECATED (float getParameter (int parameterIndex) override);
  62. JUCE_DEPRECATED (void setParameter (int parameterIndex, float newValue) override);
  63. JUCE_DEPRECATED (const String getParameterName (int parameterIndex) override);
  64. JUCE_DEPRECATED (String getParameterName (int parameterIndex, int maximumStringLength) override);
  65. JUCE_DEPRECATED (const String getParameterText (int parameterIndex) override);
  66. JUCE_DEPRECATED (String getParameterText (int parameterIndex, int maximumStringLength) override);
  67. JUCE_DEPRECATED (int getParameterNumSteps (int parameterIndex) override);
  68. JUCE_DEPRECATED (bool isParameterDiscrete (int parameterIndex) const override);
  69. JUCE_DEPRECATED (bool isParameterAutomatable (int parameterIndex) const override);
  70. JUCE_DEPRECATED (float getParameterDefaultValue (int parameterIndex) override);
  71. JUCE_DEPRECATED (String getParameterLabel (int parameterIndex) const override);
  72. JUCE_DEPRECATED (bool isParameterOrientationInverted (int parameterIndex) const override);
  73. JUCE_DEPRECATED (bool isMetaParameter (int parameterIndex) const override);
  74. JUCE_DEPRECATED (AudioProcessorParameter::Category getParameterCategory (int parameterIndex) const override);
  75. protected:
  76. //==============================================================================
  77. /** Structure used to describe plugin parameters */
  78. struct Parameter : public AudioProcessorParameter
  79. {
  80. Parameter();
  81. ~Parameter() override;
  82. String getText (float value, int maximumStringLength) const override;
  83. float getValueForText (const String& text) const override;
  84. StringArray onStrings, offStrings;
  85. };
  86. AudioPluginInstance() = default;
  87. AudioPluginInstance (const BusesProperties& ioLayouts) : AudioProcessor (ioLayouts) {}
  88. template <size_t numLayouts>
  89. AudioPluginInstance (const short channelLayoutList[numLayouts][2]) : AudioProcessor (channelLayoutList) {}
  90. private:
  91. void assertOnceOnDeprecatedMethodUse() const noexcept;
  92. static bool deprecationAssertiontriggered;
  93. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (AudioPluginInstance)
  94. };
  95. #if JUCE_MSVC
  96. #pragma warning (pop)
  97. #endif
  98. } // namespace juce