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.

373 lines
15KB

  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 = 0, char8* _version = 0, char8* _host = 0)
  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.
  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 and structure, group Plug-ins parameters for a specific remote (could be hardware or software rack (like quickcontrols)).
  73. \n
  74. It allows to describe more precisely each parameter (what is the best matching to a knob, different titles 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 are 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 (an 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. //------------------------------------------------------------------------
  166. class IXmlRepresentationController: public FUnknown
  167. {
  168. public:
  169. /** Retrieves a stream containing a XmlRepresentation for a wanted representation info */
  170. virtual tresult PLUGIN_API getXmlRepresentationStream (RepresentationInfo& info /*in*/, 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. //------------------------------------------------------------------------
  234. namespace LayerType
  235. {
  236. enum
  237. {
  238. kKnob = 0, ///< a knob (encoder or not)
  239. kPressedKnob, ///< a knob which is used by pressing and turning
  240. kSwitchKnob, ///< knob could be pressed to simulate a switch
  241. kSwitch, ///< a "on/off" button
  242. kLED, ///< LED like VU-meter or display around a knob
  243. kLink, ///< indicates that this layer is a folder linked to an another INode (page)
  244. kDisplay, ///< only for text display (not really a control)
  245. kFader, ///< a fader
  246. kEndOfLayerType
  247. };
  248. /** FIDString variant of the LayerType */
  249. static const FIDString layerTypeFIDString[] = {
  250. "knob"
  251. ,"pressedKnob"
  252. ,"switchKnob"
  253. ,"switch"
  254. ,"LED"
  255. ,"link"
  256. ,"display"
  257. ,"fader"
  258. ,0
  259. };
  260. };
  261. //------------------------------------------------------------------------
  262. /** Curve Types used in a VST XML Representation */
  263. //------------------------------------------------------------------------
  264. namespace CurveType
  265. {
  266. const CString kSegment = "segment"; ///<
  267. const CString kValueList = "valueList"; ///<
  268. };
  269. //------------------------------------------------------------------------
  270. /** Attributes used to defined a Layer in a VST XML Representation */
  271. //------------------------------------------------------------------------
  272. namespace Attributes
  273. {
  274. const CString kStyle = ATTR_STYLE; ///< string attribute : See AttributesStyle for available string value
  275. const CString kLEDStyle = ATTR_LEDSTYLE; ///< string attribute : See AttributesStyle for available string value
  276. const CString kSwitchStyle = ATTR_SWITCHSTYLE; ///< string attribute : See AttributesStyle for available string value
  277. const CString kKnobTurnsPerFullRange = ATTR_TURNSPERFULLRANGE; ///< float attribute
  278. const CString kFunction = ATTR_FUNCTION; ///< string attribute : See AttributesFunction for available string value
  279. const CString kFlags = ATTR_FLAGS; ///< string attribute : See AttributesFlags for available string value
  280. };
  281. //------------------------------------------------------------------------
  282. /** Attributes Function used to defined the function of a Layer in a VST XML Representation */
  283. //------------------------------------------------------------------------
  284. namespace AttributesFunction
  285. {
  286. /// Global Style
  287. const CString kPanPosCenterXFunc = "PanPosCenterX"; ///< Gravity point X-axis (L-R) (for stereo: middle between left and right)
  288. const CString kPanPosCenterYFunc = "PanPosCenterY"; ///< Gravity point Y-axis (Front-Rear)
  289. const CString kPanPosFrontLeftXFunc = "PanPosFrontLeftX"; ///< Left channel Position in X-axis
  290. const CString kPanPosFrontLeftYFunc = "PanPosFrontLeftY"; ///< Left channel Position in Y-axis
  291. const CString kPanPosFrontRightXFunc = "PanPosFrontRightX"; ///< Right channel Position in X-axis
  292. const CString kPanPosFrontRightYFunc = "PanPosFrontRightY"; ///< Right channel Position in Y-axis
  293. const CString kPanRotationFunc = "PanRotation"; ///< Rotation around the Center (gravity point)
  294. const CString kPanLawFunc = "PanLaw"; ///< Panning Law
  295. const CString kPanMirrorModeFunc = "PanMirrorMode"; ///< Panning Mirror Mode
  296. const CString kPanLfeGainFunc = "PanLfeGain"; ///< Panning LFE Gain
  297. const CString kGainReductionFunc = "GainReduction"; ///< Gain Reduction for compressor
  298. const CString kSoloFunc = "Solo"; ///< Solo
  299. const CString kMuteFunc = "Mute"; ///< Mute
  300. const CString kVolumeFunc = "Volume"; ///< Volume
  301. };
  302. //------------------------------------------------------------------------
  303. /** Attributes Style associated a specific Layer Type in a VST XML Representation */
  304. //------------------------------------------------------------------------
  305. namespace AttributesStyle
  306. {
  307. /// Global Style
  308. const CString kInverseStyle = "inverse"; ///< the associated layer should use the inverse value of parameter (1 - x).
  309. /// LED Style
  310. const CString kLEDWrapLeftStyle = "wrapLeft"; ///< |======>----- (the default one if not specified)
  311. const CString kLEDWrapRightStyle = "wrapRight"; ///< -------<====|
  312. const CString kLEDSpreadStyle = "spread"; ///< ---<==|==>---
  313. const CString kLEDBoostCutStyle = "boostCut"; ///< ------|===>--
  314. const CString kLEDSingleDotStyle = "singleDot"; ///< --------|----
  315. /// Switch Style
  316. const CString kSwitchPushStyle = "push"; ///< Apply only when pressed, unpressed will reset the value to min.
  317. const CString kSwitchPushIncLoopedStyle = "pushIncLooped"; ///< Push will increment the value. When the max is reached it will restart with min.
  318. ///< The default one if not specified (with 2 states values it is a OnOff switch).
  319. const CString kSwitchPushDecLoopedStyle = "pushDecLooped"; ///< Push will decrement the value. When the min is reached it will restart with max.
  320. const CString kSwitchPushIncStyle = "pushInc"; ///< Increment after each press (delta depends of the curve).
  321. const CString kSwitchPushDecStyle = "pushDec"; ///< Decrement after each press (delta depends of the curve).
  322. const CString kSwitchLatchStyle = "latch"; ///< Each push-release will change the value between min and max.
  323. ///< A timeout between push and release could be used to simulate a push style (if timeout is reached).
  324. };
  325. //------------------------------------------------------------------------
  326. /** Attributes Flags defining a Layer in a VST XML Representation */
  327. //------------------------------------------------------------------------
  328. namespace AttributesFlags
  329. {
  330. 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
  331. };
  332. //------------------------------------------------------------------------
  333. } // namespace Vst
  334. } // namespace Steinberg
  335. //------------------------------------------------------------------------
  336. #include "pluginterfaces/base/falignpop.h"
  337. //------------------------------------------------------------------------