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.

ivstchannelcontextinfo.h 8.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. //------------------------------------------------------------------------
  2. // Project : VST SDK
  3. //
  4. // Category : Interfaces
  5. // Filename : pluginterfaces/vst/ivstchannelcontextinfo.h
  6. // Created by : Steinberg, 02/2014
  7. // Description : VST Channel Context Info 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/vst/vsttypes.h"
  18. #include "pluginterfaces/vst/ivstattributes.h"
  19. //------------------------------------------------------------------------
  20. #include "pluginterfaces/base/falignpush.h"
  21. //------------------------------------------------------------------------
  22. //------------------------------------------------------------------------
  23. namespace Steinberg {
  24. namespace Vst {
  25. /** For Channel Context Info Interface */
  26. namespace ChannelContext {
  27. //------------------------------------------------------------------------
  28. //------------------------------------------------------------------------
  29. //------------------------------------------------------------------------
  30. //------------------------------------------------------------------------
  31. //------------------------------------------------------------------------
  32. /** Channel context interface: Vst::IInfoListener
  33. \ingroup vstIHost vst365
  34. - [plug imp]
  35. - [extends IEditController]
  36. - [released: 3.6.5]
  37. - [optional]
  38. Allows the host to inform the plug-in about the context in which the plug-in is instantiated,
  39. mainly channel based info (color, name, index,...). Index can be defined inside a namespace
  40. (for example, index start from 1 to N for Type Input/Output Channel (Index namespace) and index
  41. start from 1 to M for Type Audio Channel).\n
  42. As soon as the plug-in provides this IInfoListener interface, the host will call setChannelContextInfos
  43. for each change occurring to this channel (new name, new color, new indexation,...)
  44. \section IChannelContextExample Example
  45. \code{.cpp}
  46. //------------------------------------------------------------------------
  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. enum ChannelPluginLocation
  140. {
  141. kPreVolumeFader = 0,
  142. kPostVolumeFader,
  143. kUsedAsPanner
  144. };
  145. //------------------------------------------------------------------------
  146. //------------------------------------------------------------------------
  147. // Colors
  148. //------------------------------------------------------------------------
  149. /** \defgroup vst3typedef VST 3 Data Types */
  150. /*@{*/
  151. //------------------------------------------------------------------------
  152. /** ARGB (Alpha-Red-Green-Blue) */
  153. typedef uint32 ColorSpec;
  154. typedef uint8 ColorComponent;
  155. /*@}*/
  156. /** Returns the Blue part of the given ColorSpec */
  157. inline ColorComponent GetBlue (ColorSpec cs) {return (ColorComponent)(cs & 0x000000FF); }
  158. /** Returns the Green part of the given ColorSpec */
  159. inline ColorComponent GetGreen (ColorSpec cs) {return (ColorComponent)((cs >> 8) & 0x000000FF); }
  160. /** Returns the Red part of the given ColorSpec */
  161. inline ColorComponent GetRed (ColorSpec cs) {return (ColorComponent)((cs >> 16) & 0x000000FF); }
  162. /** Returns the Alpha part of the given ColorSpec */
  163. inline ColorComponent GetAlpha (ColorSpec cs) {return (ColorComponent)((cs >> 24) & 0x000000FF); }
  164. //------------------------------------------------------------------------
  165. /** Keys used as AttrID (Attribute ID) in the return IAttributeList of
  166. * IInfoListener::setChannelContextInfos */
  167. //------------------------------------------------------------------------
  168. /** string (TChar) [optional]: unique id string used to identify a channel */
  169. const CString kChannelUIDKey = "channel uid";
  170. /** integer (int64) [optional]: number of characters in kChannelUIDKey */
  171. const CString kChannelUIDLengthKey = "channel uid length";
  172. /** string (TChar) [optional]: name of the channel like displayed in the mixer */
  173. const CString kChannelNameKey = "channel name";
  174. /** integer (int64) [optional]: number of characters in kChannelNameKey */
  175. const CString kChannelNameLengthKey = "channel name length";
  176. /** color (ColorSpec) [optional]: used color for the channel in mixer or track */
  177. const CString kChannelColorKey = "channel color";
  178. /** integer (int64) [optional]: index of the channel in a channel index namespace, start with 1 not * 0! */
  179. const CString kChannelIndexKey = "channel index";
  180. /** integer (int64) [optional]: define the order of the current used index namespace, start with 1 not 0!
  181. For example:
  182. index namespace is "Input" -> order 1,
  183. index namespace is "Channel" -> order 2,
  184. index namespace is "Output" -> order 3 */
  185. const CString kChannelIndexNamespaceOrderKey = "channel index namespace order";
  186. /** string (TChar) [optional]: name of the channel index namespace for example "Input", "Output", "Channel", ... */
  187. const CString kChannelIndexNamespaceKey = "channel index namespace";
  188. /** integer (int64) [optional]: number of characters in kChannelIndexNamespaceKey */
  189. const CString kChannelIndexNamespaceLengthKey = "channel index namespace length";
  190. /** PNG image representation as binary [optional] */
  191. const CString kChannelImageKey = "channel image";
  192. /** integer (int64) [optional]: routing position of the plug-in in the channel (see ChannelPluginLocation) */
  193. const CString kChannelPluginLocationKey = "channel plugin location";
  194. //------------------------------------------------------------------------
  195. } // namespace ChannelContext
  196. } // namespace Vst
  197. } // namespace Steinberg
  198. //------------------------------------------------------------------------
  199. #include "pluginterfaces/base/falignpop.h"
  200. //------------------------------------------------------------------------