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.

365 lines
14KB

  1. //------------------------------------------------------------------------
  2. // Project : VST SDK
  3. //
  4. // Category : Interfaces
  5. // Filename : pluginterfaces/vst/ivstrepresentation.h
  6. // Created by : Steinberg, 08/2010
  7. // Description : VST Representation 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. class IBStream;
  25. namespace Vst {
  26. //------------------------------------------------------------------------
  27. /** RepresentationInfo is the structure describing a representation
  28. This structure is used in the function \see IXmlRepresentationController::getXmlRepresentationStream.
  29. \see IXmlRepresentationController
  30. */
  31. struct RepresentationInfo
  32. {
  33. RepresentationInfo ()
  34. {
  35. memset (vendor, 0, kNameSize);
  36. memset (name, 0, kNameSize);
  37. memset (version, 0, kNameSize);
  38. memset (host, 0, kNameSize);
  39. }
  40. RepresentationInfo (char8* _vendor, char8* _name = nullptr, char8* _version = nullptr, char8* _host = nullptr)
  41. {
  42. memset (vendor, 0, kNameSize);
  43. if (_vendor)
  44. strcpy (vendor, _vendor);
  45. memset (name, 0, kNameSize);
  46. if (_name)
  47. strcpy (name, _name);
  48. memset (version, 0, kNameSize);
  49. if (_version)
  50. strcpy (version, _version);
  51. memset (host, 0, kNameSize);
  52. if (_host)
  53. strcpy (host, _host);
  54. }
  55. enum
  56. {
  57. kNameSize = 64
  58. };
  59. char8 vendor[kNameSize]; ///< Vendor name of the associated representation (remote) (eg. "Yamaha").
  60. char8 name[kNameSize]; ///< Representation (remote) Name (eg. "O2").
  61. char8 version[kNameSize]; ///< Version of this "Remote" (eg. "1.0").
  62. char8 host[kNameSize]; ///< Optional: used if the representation is for a given host only (eg. "Nuendo").
  63. };
  64. //------------------------------------------------------------------------
  65. //------------------------------------------------------------------------
  66. /** Extended plug-in interface IEditController for a component: Vst::IXmlRepresentationController
  67. \ingroup vstIPlug vst350
  68. - [plug imp]
  69. - [extends IEditController]
  70. - [released: 3.5.0]
  71. - [optional]
  72. A representation based on XML is a way to export, structure, and group plug-ins parameters for a specific remote (hardware or software rack (such as quick controls)).
  73. \n
  74. It allows to describe each parameter more precisely (what is the best matching to a knob, different title lengths matching limited remote display,...).\n See an \ref Example.
  75. \n\n
  76. - A representation is composed of pages (this means that to see all exported parameters, the user has to navigate through the pages).
  77. - A page is composed of cells (for example 8 cells per page).
  78. - A cell is composed of layers (for example a cell could have a knob, a display, and a button, which means 3 layers).
  79. - A layer is associated to a plug-in parameter using the ParameterID as identifier:
  80. - it could be a knob with a display for title and/or value, this display uses the same parameterId, but it could an another one.
  81. - switch
  82. - link which allows to jump directly to a subpage (another page)
  83. - more... See Vst::LayerType
  84. .
  85. \n
  86. This representation is implemented as XML text following the Document Type Definition (DTD): http://dtd.steinberg.net/VST-Remote-1.1.dtd
  87. \section Example
  88. Here an example of what should be passed in the stream of getXmlRepresentationStream:
  89. \code
  90. <?xml version="1.0" encoding="utf-8"?>
  91. <!DOCTYPE vstXML PUBLIC "-//Steinberg//DTD VST Remote 1.1//EN" "http://dtd.steinberg.net/VST-Remote-1.1.dtd">
  92. <vstXML version="1.0">
  93. <plugin classID="341FC5898AAA46A7A506BC0799E882AE" name="Chorus" vendor="Steinberg Media Technologies" />
  94. <originator>My name</originator>
  95. <date>2010-12-31</date>
  96. <comment>This is an example for 4 Cells per Page for the Remote named ProductRemote
  97. from company HardwareCompany.</comment>
  98. <!-- ===================================== -->
  99. <representation name="ProductRemote" vendor="HardwareCompany" version="1.0">
  100. <page name="Root">
  101. <cell>
  102. <layer type="knob" parameterID="0">
  103. <titleDisplay>
  104. <name>Mix dry/wet</name>
  105. <name>Mix</name>
  106. </titleDisplay>
  107. </layer>
  108. </cell>
  109. <cell>
  110. <layer type="display"></layer>
  111. </cell>
  112. <cell>
  113. <layer type="knob" parameterID="3">
  114. <titleDisplay>
  115. <name>Delay</name>
  116. <name>Dly</name>
  117. </titleDisplay>
  118. </layer>
  119. </cell>
  120. <cell>
  121. <layer type="knob" parameterID="15">
  122. <titleDisplay>
  123. <name>Spatial</name>
  124. <name>Spat</name>
  125. </titleDisplay>
  126. </layer>
  127. </cell>
  128. </page>
  129. <page name="Page 2">
  130. <cell>
  131. <layer type="LED" ledStyle="spread" parameterID="2">
  132. <titleDisplay>
  133. <name>Width +</name>
  134. <name>Widt</name>
  135. </titleDisplay>
  136. </layer>
  137. <!--this is the switch for shape A/B-->
  138. <layer type="switch" switchStyle="pushIncLooped" parameterID="4"></layer>
  139. </cell>
  140. <cell>
  141. <layer type="display"></layer>
  142. </cell>
  143. <cell>
  144. <layer type="LED" ledStyle="singleDot" parameterID="17">
  145. <titleDisplay>
  146. <name>Sync Note +</name>
  147. <name>Note</name>
  148. </titleDisplay>
  149. </layer>
  150. <!--this is the switch for sync to tempo on /off-->
  151. <layer type="switch" switchStyle="pushIncLooped" parameterID="16"></layer>
  152. </cell>
  153. <cell>
  154. <layer type="knob" parameterID="1">
  155. <titleDisplay>
  156. <name>Rate</name>
  157. </titleDisplay>
  158. </layer>
  159. </cell>
  160. </page>
  161. </representation>
  162. </vstXML>
  163. \endcode
  164. */
  165. class IXmlRepresentationController : public FUnknown
  166. {
  167. public:
  168. /** Retrieves a stream containing a XmlRepresentation for a wanted representation info */
  169. virtual tresult PLUGIN_API getXmlRepresentationStream (RepresentationInfo& info /*in*/,
  170. IBStream* stream /*out*/) = 0;
  171. //------------------------------------------------------------------------
  172. static const FUID iid;
  173. };
  174. DECLARE_CLASS_IID (IXmlRepresentationController, 0xA81A0471, 0x48C34DC4, 0xAC30C9E1, 0x3C8393D5)
  175. //------------------------------------------------------------------------
  176. /** Defines for XML representation Tags and Attributes */
  177. #define ROOTXML_TAG "vstXML"
  178. #define COMMENT_TAG "comment"
  179. #define CELL_TAG "cell"
  180. #define CELLGROUP_TAG "cellGroup"
  181. #define CELLGROUPTEMPLATE_TAG "cellGroupTemplate"
  182. #define CURVE_TAG "curve"
  183. #define CURVETEMPLATE_TAG "curveTemplate"
  184. #define DATE_TAG "date"
  185. #define LAYER_TAG "layer"
  186. #define NAME_TAG "name"
  187. #define ORIGINATOR_TAG "originator"
  188. #define PAGE_TAG "page"
  189. #define PAGETEMPLATE_TAG "pageTemplate"
  190. #define PLUGIN_TAG "plugin"
  191. #define VALUE_TAG "value"
  192. #define VALUEDISPLAY_TAG "valueDisplay"
  193. #define VALUELIST_TAG "valueList"
  194. #define REPRESENTATION_TAG "representation"
  195. #define SEGMENT_TAG "segment"
  196. #define SEGMENTLIST_TAG "segmentList"
  197. #define TITLEDISPLAY_TAG "titleDisplay"
  198. #define ATTR_CATEGORY "category"
  199. #define ATTR_CLASSID "classID"
  200. #define ATTR_ENDPOINT "endPoint"
  201. #define ATTR_INDEX "index"
  202. #define ATTR_FLAGS "flags"
  203. #define ATTR_FUNCTION "function"
  204. #define ATTR_HOST "host"
  205. #define ATTR_LEDSTYLE "ledStyle"
  206. #define ATTR_LENGTH "length"
  207. #define ATTR_LINKEDTO "linkedTo"
  208. #define ATTR_NAME "name"
  209. #define ATTR_ORDER "order"
  210. #define ATTR_PAGE "page"
  211. #define ATTR_PARAMID "parameterID"
  212. #define ATTR_STARTPOINT "startPoint"
  213. #define ATTR_STYLE "style"
  214. #define ATTR_SWITCHSTYLE "switchStyle"
  215. #define ATTR_TEMPLATE "template"
  216. #define ATTR_TURNSPERFULLRANGE "turnsPerFullRange"
  217. #define ATTR_TYPE "type"
  218. #define ATTR_UNITID "unitID"
  219. #define ATTR_VARIABLES "variables"
  220. #define ATTR_VENDOR "vendor"
  221. #define ATTR_VERSION "version"
  222. //------------------------------------------------------------------------
  223. /** Defines some predefined Representation Remote Names */
  224. #define GENERIC "Generic"
  225. #define GENERIC_4_CELLS "Generic 4 Cells"
  226. #define GENERIC_8_CELLS "Generic 8 Cells"
  227. #define GENERIC_12_CELLS "Generic 12 Cells"
  228. #define GENERIC_24_CELLS "Generic 24 Cells"
  229. #define GENERIC_N_CELLS "Generic %d Cells"
  230. #define QUICK_CONTROL_8_CELLS "Quick Controls 8 Cells"
  231. //------------------------------------------------------------------------
  232. /** Layer Types used in a VST XML Representation */
  233. namespace LayerType
  234. {
  235. enum
  236. {
  237. kKnob = 0, ///< a knob (encoder or not)
  238. kPressedKnob, ///< a knob which is used by pressing and turning
  239. kSwitchKnob, ///< knob could be pressed to simulate a switch
  240. kSwitch, ///< a "on/off" button
  241. kLED, ///< LED like VU-meter or display around a knob
  242. kLink, ///< indicates that this layer is a folder linked to an another INode (page)
  243. kDisplay, ///< only for text display (not really a control)
  244. kFader, ///< a fader
  245. kEndOfLayerType
  246. };
  247. /** FIDString variant of the LayerType */
  248. static const FIDString layerTypeFIDString[] = {
  249. "knob"
  250. ,"pressedKnob"
  251. ,"switchKnob"
  252. ,"switch"
  253. ,"LED"
  254. ,"link"
  255. ,"display"
  256. ,"fader"
  257. ,nullptr
  258. };
  259. };
  260. //------------------------------------------------------------------------
  261. /** Curve Types used in a VST XML Representation */
  262. namespace CurveType
  263. {
  264. const CString kSegment = "segment"; ///<
  265. const CString kValueList = "valueList"; ///<
  266. };
  267. //------------------------------------------------------------------------
  268. /** Attributes used to defined a Layer in a VST XML Representation */
  269. namespace Attributes
  270. {
  271. const CString kStyle = ATTR_STYLE; ///< string attribute : See AttributesStyle for available string value
  272. const CString kLEDStyle = ATTR_LEDSTYLE; ///< string attribute : See AttributesStyle for available string value
  273. const CString kSwitchStyle = ATTR_SWITCHSTYLE; ///< string attribute : See AttributesStyle for available string value
  274. const CString kKnobTurnsPerFullRange = ATTR_TURNSPERFULLRANGE; ///< float attribute
  275. const CString kFunction = ATTR_FUNCTION; ///< string attribute : See AttributesFunction for available string value
  276. const CString kFlags = ATTR_FLAGS; ///< string attribute : See AttributesFlags for available string value
  277. };
  278. //------------------------------------------------------------------------
  279. /** Attributes Function used to defined the function of a Layer in a VST XML Representation */
  280. namespace AttributesFunction
  281. {
  282. /// Global Style
  283. const CString kPanPosCenterXFunc = "PanPosCenterX"; ///< Gravity point X-axis (L-R) (for stereo: middle between left and right)
  284. const CString kPanPosCenterYFunc = "PanPosCenterY"; ///< Gravity point Y-axis (Front-Rear)
  285. const CString kPanPosFrontLeftXFunc = "PanPosFrontLeftX"; ///< Left channel Position in X-axis
  286. const CString kPanPosFrontLeftYFunc = "PanPosFrontLeftY"; ///< Left channel Position in Y-axis
  287. const CString kPanPosFrontRightXFunc = "PanPosFrontRightX"; ///< Right channel Position in X-axis
  288. const CString kPanPosFrontRightYFunc = "PanPosFrontRightY"; ///< Right channel Position in Y-axis
  289. const CString kPanRotationFunc = "PanRotation"; ///< Rotation around the Center (gravity point)
  290. const CString kPanLawFunc = "PanLaw"; ///< Panning Law
  291. const CString kPanMirrorModeFunc = "PanMirrorMode"; ///< Panning Mirror Mode
  292. const CString kPanLfeGainFunc = "PanLfeGain"; ///< Panning LFE Gain
  293. const CString kGainReductionFunc = "GainReduction"; ///< Gain Reduction for compressor
  294. const CString kSoloFunc = "Solo"; ///< Solo
  295. const CString kMuteFunc = "Mute"; ///< Mute
  296. const CString kVolumeFunc = "Volume"; ///< Volume
  297. };
  298. //------------------------------------------------------------------------
  299. /** Attributes Style associated a specific Layer Type in a VST XML Representation */
  300. namespace AttributesStyle
  301. {
  302. /// Global Style
  303. const CString kInverseStyle = "inverse"; ///< the associated layer should use the inverse value of parameter (1 - x).
  304. /// LED Style
  305. const CString kLEDWrapLeftStyle = "wrapLeft"; ///< |======>----- (the default one if not specified)
  306. const CString kLEDWrapRightStyle = "wrapRight"; ///< -------<====|
  307. const CString kLEDSpreadStyle = "spread"; ///< ---<==|==>---
  308. const CString kLEDBoostCutStyle = "boostCut"; ///< ------|===>--
  309. const CString kLEDSingleDotStyle = "singleDot"; ///< --------|----
  310. /// Switch Style
  311. const CString kSwitchPushStyle = "push"; ///< Apply only when pressed, unpressed will reset the value to min.
  312. const CString kSwitchPushIncLoopedStyle = "pushIncLooped"; ///< Push will increment the value. When the max is reached it will restart with min.
  313. ///< The default one if not specified (with 2 states values it is a OnOff switch).
  314. const CString kSwitchPushDecLoopedStyle = "pushDecLooped"; ///< Push will decrement the value. When the min is reached it will restart with max.
  315. const CString kSwitchPushIncStyle = "pushInc"; ///< Increment after each press (delta depends of the curve).
  316. const CString kSwitchPushDecStyle = "pushDec"; ///< Decrement after each press (delta depends of the curve).
  317. const CString kSwitchLatchStyle = "latch"; ///< Each push-release will change the value between min and max.
  318. ///< A timeout between push and release could be used to simulate a push style (if timeout is reached).
  319. };
  320. //------------------------------------------------------------------------
  321. /** Attributes Flags defining a Layer in a VST XML Representation */
  322. namespace AttributesFlags
  323. {
  324. const CString kHideableFlag = "hideable"; ///< the associated layer marked as hideable allows a remote to hide or make it not usable a parameter when the associated value is inactive
  325. };
  326. //------------------------------------------------------------------------
  327. } // namespace Vst
  328. } // namespace Steinberg
  329. //------------------------------------------------------------------------
  330. #include "pluginterfaces/base/falignpop.h"
  331. //------------------------------------------------------------------------