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.

143 lines
5.9KB

  1. //------------------------------------------------------------------------
  2. // Project : VST SDK
  3. //
  4. // Category : Interfaces
  5. // Filename : pluginterfaces/vst/ivstparameterchanges.h
  6. // Created by : Steinberg, 09/2005
  7. // Description : VST Parameter Change Interfaces
  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 "vsttypes.h"
  19. //------------------------------------------------------------------------
  20. #include "pluginterfaces/base/falignpush.h"
  21. //------------------------------------------------------------------------
  22. //----------------------------------------------------------------------
  23. namespace Steinberg {
  24. namespace Vst {
  25. //----------------------------------------------------------------------
  26. /** Queue of changes for a specific parameter.
  27. \ingroup vstIHost vst300
  28. - [host imp]
  29. - [released: 3.0.0]
  30. - [mandatory]
  31. The change queue can be interpreted as segment of an automation curve. For each
  32. processing block a segment with the size of the block is transmitted to the processor.
  33. The curve is expressed as sampling points of a linear approximation of
  34. the original automation curve. If the original already is a linear curve it can
  35. be transmitted precisely. A non-linear curve has to be converted to a linear
  36. approximation by the host. Every point of the value queue defines a linear
  37. section of the curve as a straight line from the previous point of a block to
  38. the new one. So the Plug-in can calculate the value of the curve for any sample
  39. position in the block.
  40. <b>Implicit Points:</b> \n
  41. In each processing block the section of the curve for each parameter is transmitted.
  42. In order to reduce the amount of points, the point at block position 0 can be omitted.
  43. - If the curve has a slope of 0 over a period of multiple blocks, only one point is
  44. transmitted for the block where the constant curve section starts. The queue for the following
  45. blocks will be empty as long as the curve slope is 0.
  46. - If the curve has a constant slope other than 0 over the period of several blocks, only
  47. the value for the last sample of the block is transmitted. In this case the last valid point
  48. is at block position -1. The processor can calculate the value for each sample in the block
  49. by using a linear interpolation:
  50. \code
  51. double x1 = -1; // position of last point related to current buffer
  52. double y1 = currentParameterValue; // last transmitted value
  53. int32 pointTime = 0;
  54. ParamValue pointValue = 0;
  55. IParamValueQueue::getPoint (0, pointTime, pointValue);
  56. double x2 = pointTime;
  57. double y2 = pointValue;
  58. double slope = (y2 - y1) / (x2 - x1);
  59. double offset = y1 - (slope * x1);
  60. double curveValue = (slope * bufferTime) + offset; // bufferTime is any position in buffer
  61. \endcode
  62. <b>Jumps:</b> \n
  63. A jump in the automation curve has to be transmitted as two points: one with the
  64. old value and one with the new value at the next sample position.
  65. \image html "automation.jpg"
  66. \see IParameterChanges, ProcessData
  67. */
  68. //----------------------------------------------------------------------
  69. class IParamValueQueue: public FUnknown
  70. {
  71. public:
  72. //------------------------------------------------------------------------
  73. /** Returns its associated ID. */
  74. virtual ParamID PLUGIN_API getParameterId () = 0;
  75. /** Returns count of points in the queue. */
  76. virtual int32 PLUGIN_API getPointCount () = 0;
  77. /** Gets the value and offset at a given index. */
  78. virtual tresult PLUGIN_API getPoint (int32 index, int32& sampleOffset /*out*/, ParamValue& value /*out*/) = 0;
  79. /** Adds a new value at the end of the queue, its index is returned. */
  80. virtual tresult PLUGIN_API addPoint (int32 sampleOffset, ParamValue value, int32& index /*out*/) = 0;
  81. //------------------------------------------------------------------------
  82. static const FUID iid;
  83. };
  84. DECLARE_CLASS_IID (IParamValueQueue, 0x01263A18, 0xED074F6F, 0x98C9D356, 0x4686F9BA)
  85. //----------------------------------------------------------------------
  86. /** All parameter changes of a processing block.
  87. \ingroup vstIHost vst300
  88. - [host imp]
  89. - [released: 3.0.0]
  90. - [mandatory]
  91. This interface is used to transmit any changes that shall be applied to parameters
  92. in the current processing block. A change can be caused by GUI interaction as
  93. well as automation. They are transmitted as a list of queues (IParamValueQueue)
  94. containing only queues for parameters that actually did change.
  95. \see IParamValueQueue, ProcessData */
  96. //----------------------------------------------------------------------
  97. class IParameterChanges: public FUnknown
  98. {
  99. public:
  100. //------------------------------------------------------------------------
  101. /** Returns count of Parameter changes in the list. */
  102. virtual int32 PLUGIN_API getParameterCount () = 0;
  103. /** Returns the queue at a given index. */
  104. virtual IParamValueQueue* PLUGIN_API getParameterData (int32 index) = 0;
  105. /** Adds a new parameter queue with a given ID at the end of the list,
  106. returns it and its index in the parameter changes list. */
  107. virtual IParamValueQueue* PLUGIN_API addParameterData (const Vst::ParamID& id, int32& index /*out*/) = 0;
  108. //------------------------------------------------------------------------
  109. static const FUID iid;
  110. };
  111. DECLARE_CLASS_IID (IParameterChanges, 0xA4779663, 0x0BB64A56, 0xB44384A8, 0x466FEB9D)
  112. //------------------------------------------------------------------------
  113. } // namespace Vst
  114. } // namespace Steinberg
  115. //------------------------------------------------------------------------
  116. #include "pluginterfaces/base/falignpop.h"
  117. //------------------------------------------------------------------------