Audio plugin host https://kx.studio/carla
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.

144 lines
5.7KB

  1. //------------------------------------------------------------------------
  2. // Project : VST SDK
  3. //
  4. // Category : Interfaces
  5. // Filename : pluginterfaces/vst/ivstparameterfunctionname.h
  6. // Created by : Steinberg, 03/2020
  7. // Description : VST Parameter Function Name Interface
  8. //
  9. //-----------------------------------------------------------------------------
  10. // This file is part of a Steinberg SDK. It is subject to the license terms
  11. // in the LICENSE file found in the top-level directory of this distribution
  12. // and at www.steinberg.net/sdklicenses.
  13. // No part of the SDK, including this file, may be copied, modified, propagated,
  14. // or distributed except according to the terms contained in the LICENSE file.
  15. //-----------------------------------------------------------------------------
  16. #pragma once
  17. #include "pluginterfaces/base/funknown.h"
  18. #include "pluginterfaces/vst/vsttypes.h"
  19. //------------------------------------------------------------------------
  20. #include "pluginterfaces/base/falignpush.h"
  21. //------------------------------------------------------------------------
  22. //------------------------------------------------------------------------
  23. namespace Steinberg {
  24. namespace Vst {
  25. namespace FunctionNameType {
  26. //--------------------------------------------------------------------
  27. const CString kCompGainReduction = "Comp:GainReduction"; /** */
  28. const CString kCompGainReductionMax = "Comp:GainReductionMax";
  29. const CString kCompGainReductionPeakHold = "Comp:GainReductionPeakHold";
  30. const CString kCompResetGainReductionMax = "Comp:ResetGainReductionMax";
  31. const CString kLowLatencyMode = "LowLatencyMode"; /** Useful for live situation where low
  32. latency is required:
  33. 0 means LowLatency disable,
  34. 1 means LowLatency enable */
  35. const CString kDryWetMix = "DryWetMix"; /** Allowing to mix the original (Dry) Signal with the processed one (Wet):
  36. 0.0 means Dry Signal only,
  37. 0.5 means 50% Dry Signal + 50% Wet Signal,
  38. 1.0 means Wet Signal only */
  39. const CString kRandomize = "Randomize"; /** Allow to assign some randomized values to some
  40. parameters in a controlled way*/
  41. } // FunctionNameType
  42. //------------------------------------------------------------------------
  43. /** Edit controller component interface extension: Vst::IParameterFunctionName
  44. \ingroup vstIPlug vst370
  45. - [plug imp]
  46. - [extends IEditController]
  47. - [released: 3.7.0]
  48. - [optional]
  49. This interface allows the host to get a parameter associated to a specific meaning (a functionName) for a given unit.
  50. The host can use this information, for example, for drawing a Gain Reduction meter in its own UI.
  51. In order to get the plain value of this parameter, the host should use the IEditController::normalizedParamToPlain.
  52. The host can automatically map parameters to dedicated UI controls, such as the wet-dry mix knob or Randomize button.
  53. \section IParameterFunctionNameExample Example
  54. \code{.cpp}
  55. //------------------------------------------------------------------------
  56. // here an example of how a VST3 plug-in could support this IParameterFunctionName interface.
  57. // we need to define somewhere the iids:
  58. in MyController class declaration
  59. class MyController : public Vst::EditController, public Vst::IParameterFunctionName
  60. {
  61. ...
  62. tresult PLUGIN_API getParameterIDFromFunctionName (UnitID unitID, FIDString functionName,
  63. Vst::ParamID& paramID) override;
  64. ...
  65. OBJ_METHODS (MyController, Vst::EditController)
  66. DEFINE_INTERFACES
  67. ...
  68. DEF_INTERFACE (Vst::IParameterFunctionName)
  69. END_DEFINE_INTERFACES (Vst::EditController)
  70. ...
  71. }
  72. #include "ivstparameterfunctionname.h"
  73. namespace Steinberg {
  74. namespace Vst {
  75. DEF_CLASS_IID (IParameterFunctionName)
  76. }
  77. }
  78. //------------------------------------------------------------------------
  79. tresult PLUGIN_API MyController::getParameterIDFromFunctionName (UnitID unitID, FIDString functionName,
  80. Vst::ParamID& paramID)
  81. {
  82. using namespace Vst;
  83. paramID = kNoParamId;
  84. if (unitID == kRootUnitId && FIDStringsEqual (functionName, kCompGainReduction))
  85. paramID = kMyGainReductionId;
  86. return (paramID != kNoParamId) ? kResultOk : kResultFalse;
  87. }
  88. //--- a host implementation example: --------------------
  89. ...
  90. FUnknownPtr<Vst::IParameterFunctionName> functionName (mEditController->getIEditController ());
  91. if (functionName)
  92. {
  93. Vst::ParamID paramID;
  94. if (functionName->getParameterIDFromFunctionName (Vst::FunctionNameType::kCompGainReduction, paramID) == kResultTrue)
  95. {
  96. // paramID could be cached for performance issue
  97. ParamValue norm = mEditController->getIEditController ()->getParamNormalized (paramID);
  98. ParamValue plain = mEditController->getIEditController ()->normalizedParamToPlain (paramID, norm);
  99. // plain is something like -6 (-6dB)
  100. }
  101. }
  102. \endcode
  103. */
  104. class IParameterFunctionName : public FUnknown
  105. {
  106. public:
  107. //------------------------------------------------------------------------
  108. /** Gets for the given unitID the associated paramID to a function Name.
  109. Returns kResultFalse when no found parameter (paramID is set to kNoParamId in this case). */
  110. virtual tresult PLUGIN_API getParameterIDFromFunctionName (UnitID unitID, FIDString functionName, ParamID& paramID) = 0;
  111. //------------------------------------------------------------------------
  112. static const FUID iid;
  113. };
  114. DECLARE_CLASS_IID (IParameterFunctionName, 0x6D21E1DC, 0x91199D4B, 0xA2A02FEF, 0x6C1AE55C)
  115. //------------------------------------------------------------------------
  116. } // namespace Vst
  117. } // namespace Steinberg
  118. //------------------------------------------------------------------------
  119. #include "pluginterfaces/base/falignpop.h"
  120. //------------------------------------------------------------------------