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.

ivstparameterchanges.h 5.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. //------------------------------------------------------------------------
  2. // Project : VST SDK
  3. // Version : 3.6.7
  4. //
  5. // Category : Interfaces
  6. // Filename : pluginterfaces/vst/ivstparameterchanges.h
  7. // Created by : Steinberg, 09/2005
  8. // Description : VST Parameter Change Interfaces
  9. //
  10. //-----------------------------------------------------------------------------
  11. // This file is part of a Steinberg SDK. It is subject to the license terms
  12. // in the LICENSE file found in the top-level directory of this distribution
  13. // and at www.steinberg.net/sdklicenses.
  14. // No part of the SDK, including this file, may be copied, modified, propagated,
  15. // or distributed except according to the terms contained in the LICENSE file.
  16. //-----------------------------------------------------------------------------
  17. #pragma once
  18. #include "pluginterfaces/base/funknown.h"
  19. #include "vsttypes.h"
  20. //------------------------------------------------------------------------
  21. #include "pluginterfaces/base/falignpush.h"
  22. //------------------------------------------------------------------------
  23. //----------------------------------------------------------------------
  24. namespace Steinberg {
  25. namespace Vst {
  26. //----------------------------------------------------------------------
  27. /** Queue of changes for a specific parameter.
  28. \ingroup vstIHost vst300
  29. - [host imp]
  30. - [released: 3.0.0]
  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. This interface is used to transmit any changes that shall be applied to paramaters
  91. in the current processing block. A change can be caused by GUI interaction as
  92. well as automation. They are transmitted as a list of queues (IParamValueQueue)
  93. containing only queues for paramaters that actually did change.
  94. \see IParamValueQueue, ProcessData */
  95. //----------------------------------------------------------------------
  96. class IParameterChanges: public FUnknown
  97. {
  98. public:
  99. //------------------------------------------------------------------------
  100. /** Returns count of Parameter changes in the list. */
  101. virtual int32 PLUGIN_API getParameterCount () = 0;
  102. /** Returns the queue at a given index. */
  103. virtual IParamValueQueue* PLUGIN_API getParameterData (int32 index) = 0;
  104. /** Adds a new parameter queue with a given ID at the end of the list,
  105. returns it and its index in the parameter changes list. */
  106. virtual IParamValueQueue* PLUGIN_API addParameterData (const Vst::ParamID& id, int32& index /*out*/) = 0;
  107. //------------------------------------------------------------------------
  108. static const FUID iid;
  109. };
  110. DECLARE_CLASS_IID (IParameterChanges, 0xA4779663, 0x0BB64A56, 0xB44384A8, 0x466FEB9D)
  111. //------------------------------------------------------------------------
  112. } // namespace Vst
  113. } // namespace Steinberg
  114. //------------------------------------------------------------------------
  115. #include "pluginterfaces/base/falignpop.h"
  116. //------------------------------------------------------------------------