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.

120 lines
5.1KB

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