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.

228 lines
8.3KB

  1. //------------------------------------------------------------------------
  2. // Project : VST SDK
  3. // Version : 3.6.7
  4. //
  5. // Category : Interfaces
  6. // Filename : pluginterfaces/vst/ivstchannelcontextinfo.h
  7. // Created by : Steinberg, 02/2014
  8. // Description : VST Channel Context Info Interface
  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/vst/vsttypes.h"
  19. #include "pluginterfaces/vst/ivstattributes.h"
  20. //------------------------------------------------------------------------
  21. #include "pluginterfaces/base/falignpush.h"
  22. //------------------------------------------------------------------------
  23. //------------------------------------------------------------------------
  24. namespace Steinberg {
  25. namespace Vst {
  26. /** For Channel Context Info Interface */
  27. namespace ChannelContext {
  28. //------------------------------------------------------------------------
  29. //------------------------------------------------------------------------
  30. //------------------------------------------------------------------------
  31. //------------------------------------------------------------------------
  32. //------------------------------------------------------------------------
  33. /** Channel Context Interface.
  34. \ingroup vstIHost vst365
  35. - [plug imp]
  36. - [extends IEditController]
  37. - [released: 3.6.5]
  38. - [optional]
  39. Allows the host to inform the Plug-in about the context in which the Plug-in is instantiated,
  40. mainly channel based info (color, name, index,...). Index could be defined inside a namespace
  41. (for example index start from 1 to N for Type Input/Output Channel (Index namespace) and index
  42. start from 1 to M for Type Audio Channel).\n
  43. As soon as the Plug-in provides this IInfoListener interface, the host will call setChannelContextInfos
  44. for each change occurring to this channel (new name, new color, new indexation,...)
  45. \section IChannelContextExample Example
  46. \code
  47. tresult PLUGIN_API MyPlugin::setChannelContextInfos (IAttributeList* list)
  48. {
  49. if (list)
  50. {
  51. // optional we can ask for the Channel Name Length
  52. int64 length;
  53. if (list->getInt (ChannelContext::kChannelNameLengthKey, length) == kResultTrue)
  54. {
  55. ...
  56. }
  57. // get the Channel Name where we, as Plug-in, are instantiated
  58. String128 name;
  59. if (list->getString (ChannelContext::kChannelNameKey, name, sizeof (name)) == kResultTrue)
  60. {
  61. ...
  62. }
  63. // get the Channel UID
  64. if (list->getString (ChannelContext::kChannelUIDKey, name, sizeof (name)) == kResultTrue)
  65. {
  66. ...
  67. }
  68. // get Channel Index
  69. int64 index;
  70. if (list->getInt (ChannelContext::kChannelIndexKey, index) == kResultTrue)
  71. {
  72. ...
  73. }
  74. // get the Channel Color
  75. int64 color;
  76. if (list->getInt (ChannelContext::kChannelColorKey, color) == kResultTrue)
  77. {
  78. uint32 channelColor = (uint32)color;
  79. String str;
  80. str.printf ("%x%x%x%x", ChannelContext::GetAlpha (channelColor),
  81. ChannelContext::GetRed (channelColor),
  82. ChannelContext::GetGreen (channelColor),
  83. ChannelContext::GetBlue (channelColor));
  84. String128 string128;
  85. Steinberg::UString (string128, 128).fromAscii (str);
  86. ...
  87. }
  88. // get Channel Index Namespace Order of the current used index namespace
  89. if (list->getInt (ChannelContext::kChannelIndexNamespaceOrderKey, index) == kResultTrue)
  90. {
  91. ...
  92. }
  93. // get the channel Index Namespace Length
  94. if (list->getInt (ChannelContext::kChannelIndexNamespaceLengthKey, length) == kResultTrue)
  95. {
  96. ...
  97. }
  98. // get the channel Index Namespace
  99. String128 namespaceName;
  100. if (list->getString (ChannelContext::kChannelIndexNamespaceKey, namespaceName, sizeof (namespaceName)) == kResultTrue)
  101. {
  102. ...
  103. }
  104. // get Plug-in Channel Location
  105. int64 location;
  106. if (list->getInt (ChannelContext::kChannelPluginLocationKey, location) == kResultTrue)
  107. {
  108. String128 string128;
  109. switch (location)
  110. {
  111. case ChannelContext::kPreVolumeFader:
  112. Steinberg::UString (string128, 128).fromAscii ("PreVolFader");
  113. break;
  114. case ChannelContext::kPostVolumeFader:
  115. Steinberg::UString (string128, 128).fromAscii ("PostVolFader");
  116. break;
  117. case ChannelContext::kUsedAsPanner:
  118. Steinberg::UString (string128, 128).fromAscii ("UsedAsPanner");
  119. break;
  120. default: Steinberg::UString (string128, 128).fromAscii ("unknown!");
  121. break;
  122. }
  123. }
  124. // do not forget to call addRef () if you want to keep this list
  125. }
  126. }
  127. \endcode */
  128. //------------------------------------------------------------------------
  129. class IInfoListener: public FUnknown
  130. {
  131. public:
  132. /** Receive the channel context infos from host. */
  133. virtual tresult PLUGIN_API setChannelContextInfos (IAttributeList* list) = 0;
  134. static const FUID iid;
  135. };
  136. DECLARE_CLASS_IID (IInfoListener, 0x0F194781, 0x8D984ADA, 0xBBA0C1EF, 0xC011D8D0)
  137. //------------------------------------------------------------------------
  138. /** Values used for kChannelPluginLocationKey */
  139. //------------------------------------------------------------------------
  140. enum ChannelPluginLocation
  141. {
  142. kPreVolumeFader = 0,
  143. kPostVolumeFader,
  144. kUsedAsPanner
  145. };
  146. //------------------------------------------------------------------------
  147. //------------------------------------------------------------------------
  148. // Colors
  149. typedef uint32 ColorSpec; ///< ARGB (Alpha-Red-Green-Blue)
  150. typedef uint8 ColorComponent;
  151. inline ColorComponent GetBlue (ColorSpec cs) {return (ColorComponent)(cs & 0x000000FF); }
  152. inline ColorComponent GetGreen (ColorSpec cs) {return (ColorComponent)((cs >> 8) & 0x000000FF); }
  153. inline ColorComponent GetRed (ColorSpec cs) {return (ColorComponent)((cs >> 16) & 0x000000FF); }
  154. inline ColorComponent GetAlpha (ColorSpec cs) {return (ColorComponent)((cs >> 24) & 0x000000FF); }
  155. //------------------------------------------------------------------------
  156. /** Keys used as AttrID (Attribute ID) in the return IAttributeList of
  157. * IInfoListener::setChannelContextInfos */
  158. //------------------------------------------------------------------------
  159. /** string (TChar) [optional]: unique id string used to identify a channel */
  160. const CString kChannelUIDKey = "channel uid";
  161. /** integer (int64) [optional]: number of characters in kChannelUIDKey */
  162. const CString kChannelUIDLengthKey = "channel uid length";
  163. /** string (TChar) [optional]: name of the channel like displayed in the mixer */
  164. const CString kChannelNameKey = "channel name";
  165. /** integer (int64) [optional]: number of characters in kChannelNameKey */
  166. const CString kChannelNameLengthKey = "channel name length";
  167. /** color (ColorSpec) [optional]: used color for the channel in mixer or track */
  168. const CString kChannelColorKey = "channel color";
  169. /** integer (int64) [optional]: index of the channel in a channel index namespace, start with 1 not * 0! */
  170. const CString kChannelIndexKey = "channel index";
  171. /** integer (int64) [optional]: define the order of the current used index namespace, start with 1 not 0!
  172. For example:
  173. index namespace is "Input" -> order 1,
  174. index namespace is "Channel" -> order 2,
  175. index namespace is "Output" -> order 3 */
  176. const CString kChannelIndexNamespaceOrderKey = "channel index namespace order";
  177. /** string (TChar) [optional]: name of the channel index namespace for example "Input", "Output", "Channel", ... */
  178. const CString kChannelIndexNamespaceKey = "channel index namespace";
  179. /** integer (int64) [optional]: number of characters in kChannelIndexNamespaceKey */
  180. const CString kChannelIndexNamespaceLengthKey = "channel index namespace length";
  181. /** PNG image representation as binary [optional] */
  182. const CString kChannelImageKey = "channel image";
  183. /** integer (int64) [optional]: routing position of the Plug-in in the channel (see ChannelPluginLocation) */
  184. const CString kChannelPluginLocationKey = "channel plugin location";
  185. //------------------------------------------------------------------------
  186. } // namespace ChannelContext
  187. } // namespace Vst
  188. } // namespace Steinberg
  189. //------------------------------------------------------------------------
  190. #include "pluginterfaces/base/falignpop.h"
  191. //------------------------------------------------------------------------