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.

139 lines
5.6KB

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