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.

ivstunits.h 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. //------------------------------------------------------------------------
  2. // Project : VST SDK
  3. //
  4. // Category : Interfaces
  5. // Filename : pluginterfaces/vst/ivstunits.h
  6. // Created by : Steinberg, 2005
  7. // Description : VST Units Interfaces
  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 "vsttypes.h"
  19. //------------------------------------------------------------------------
  20. #include "pluginterfaces/base/falignpush.h"
  21. //------------------------------------------------------------------------
  22. namespace Steinberg {
  23. class IBStream;
  24. //------------------------------------------------------------------------
  25. namespace Vst {
  26. //------------------------------------------------------------------------
  27. /** Special UnitIDs for UnitInfo */
  28. static const UnitID kRootUnitId = 0; ///< identifier for the top level unit (root)
  29. static const UnitID kNoParentUnitId = -1; ///< used for the root unit which doesn't have a parent.
  30. //------------------------------------------------------------------------
  31. /** Special ProgramListIDs for UnitInfo */
  32. static const ProgramListID kNoProgramListId = -1; ///< no programs are used in the unit.
  33. //------------------------------------------------------------------------
  34. /** Basic Unit Description.
  35. \see IUnitInfo */
  36. //------------------------------------------------------------------------
  37. struct UnitInfo
  38. {
  39. UnitID id; ///< unit identifier
  40. UnitID parentUnitId; ///< identifier of parent unit (kNoParentUnitId: does not apply, this unit is the root)
  41. String128 name; ///< name, optional for the root component, required otherwise
  42. ProgramListID programListId; ///< id of program list used in unit (kNoProgramListId = no programs used in this unit)
  43. };
  44. //------------------------------------------------------------------------
  45. /** Basic Program List Description.
  46. \see IUnitInfo */
  47. //------------------------------------------------------------------------
  48. struct ProgramListInfo
  49. {
  50. ProgramListID id; ///< program list identifier
  51. String128 name; ///< name of program list
  52. int32 programCount; ///< number of programs in this list
  53. };
  54. //------------------------------------------------------------------------
  55. /** Special programIndex value for IUnitHandler::notifyProgramListChange */
  56. static const int32 kAllProgramInvalid = -1; ///< all program information is invalid
  57. //------------------------------------------------------------------------
  58. /** Host callback for unit support.
  59. \ingroup vstIHost vst300
  60. - [host imp]
  61. - [extends IComponentHandler]
  62. - [released: 3.0.0]
  63. - [optional]
  64. Host callback interface, used with IUnitInfo.
  65. Retrieve via queryInterface from IComponentHandler.
  66. \see \ref vst3Units, IUnitInfo */
  67. //------------------------------------------------------------------------
  68. class IUnitHandler: public FUnknown
  69. {
  70. public:
  71. //------------------------------------------------------------------------
  72. /** Notify host when a module is selected in Plug-in GUI. */
  73. virtual tresult PLUGIN_API notifyUnitSelection (UnitID unitId) = 0;
  74. /** Tell host that the Plug-in controller changed a program list (rename, load, PitchName changes).
  75. \param listId is the specified program list ID to inform.
  76. \param programIndex : when kAllProgramInvalid, all program information is invalid, otherwise only the program of given index. */
  77. virtual tresult PLUGIN_API notifyProgramListChange (ProgramListID listId, int32 programIndex) = 0;
  78. //------------------------------------------------------------------------
  79. static const FUID iid;
  80. };
  81. DECLARE_CLASS_IID (IUnitHandler, 0x4B5147F8, 0x4654486B, 0x8DAB30BA, 0x163A3C56)
  82. //------------------------------------------------------------------------
  83. /** Host callback for extended unit support.
  84. \ingroup vstIHost vst365
  85. - [host imp]
  86. - [extends IUnitHandler]
  87. - [released: 3.6.5]
  88. - [optional]
  89. Host callback interface, used with IUnitInfo.
  90. Retrieve via queryInterface from IComponentHandler.
  91. \see \ref vst3Units, IUnitHandler */
  92. //------------------------------------------------------------------------
  93. class IUnitHandler2 : public FUnknown
  94. {
  95. public:
  96. //------------------------------------------------------------------------
  97. /** Tell host that assignment Unit-Bus defined by IUnitInfo::getUnitByBus has changed. */
  98. virtual tresult PLUGIN_API notifyUnitByBusChange () = 0;
  99. //------------------------------------------------------------------------
  100. static const FUID iid;
  101. };
  102. DECLARE_CLASS_IID (IUnitHandler2, 0xF89F8CDF, 0x699E4BA5, 0x96AAC9A4, 0x81452B01)
  103. //------------------------------------------------------------------------
  104. /** Edit controller extension to describe the Plug-in structure.
  105. \ingroup vstIPlug vst300
  106. - [plug imp]
  107. - [extends IEditController]
  108. - [released: 3.0.0]
  109. - [optional]
  110. IUnitInfo describes the internal structure of the Plug-in.
  111. - The root unit is the component itself, so getUnitCount must return 1 at least.
  112. - The root unit id has to be 0 (kRootUnitId).
  113. - Each unit can reference one program list - this reference must not change.
  114. - Each unit using a program list, references one program of the list.
  115. \see \ref vst3Units, IUnitHandler */
  116. //------------------------------------------------------------------------
  117. class IUnitInfo: public FUnknown
  118. {
  119. public:
  120. //------------------------------------------------------------------------
  121. /** Returns the flat count of units. */
  122. virtual int32 PLUGIN_API getUnitCount () = 0;
  123. /** Gets UnitInfo for a given index in the flat list of unit. */
  124. virtual tresult PLUGIN_API getUnitInfo (int32 unitIndex, UnitInfo& info /*out*/) = 0;
  125. /** Component intern program structure. */
  126. /** Gets the count of Program List. */
  127. virtual int32 PLUGIN_API getProgramListCount () = 0;
  128. /** Gets for a given index the Program List Info. */
  129. virtual tresult PLUGIN_API getProgramListInfo (int32 listIndex, ProgramListInfo& info /*out*/) = 0;
  130. /** Gets for a given program list ID and program index its program name. */
  131. virtual tresult PLUGIN_API getProgramName (ProgramListID listId, int32 programIndex, String128 name /*out*/) = 0;
  132. /** Gets for a given program list ID, program index and attributeId the associated attribute value. */
  133. virtual tresult PLUGIN_API getProgramInfo (ProgramListID listId, int32 programIndex,
  134. CString attributeId /*in*/, String128 attributeValue /*out*/) = 0;
  135. /** Returns kResultTrue if the given program index of a given program list ID supports PitchNames. */
  136. virtual tresult PLUGIN_API hasProgramPitchNames (ProgramListID listId, int32 programIndex) = 0;
  137. /** Gets the PitchName for a given program list ID, program index and pitch.
  138. If PitchNames are changed the Plug-in should inform the host with IUnitHandler::notifyProgramListChange. */
  139. virtual tresult PLUGIN_API getProgramPitchName (ProgramListID listId, int32 programIndex,
  140. int16 midiPitch, String128 name /*out*/) = 0;
  141. // units selection --------------------
  142. /** Gets the current selected unit. */
  143. virtual UnitID PLUGIN_API getSelectedUnit () = 0;
  144. /** Sets a new selected unit. */
  145. virtual tresult PLUGIN_API selectUnit (UnitID unitId) = 0;
  146. /** Gets the according unit if there is an unambiguous relation between a channel or a bus and a unit.
  147. This method mainly is intended to find out which unit is related to a given MIDI input channel. */
  148. virtual tresult PLUGIN_API getUnitByBus (MediaType type, BusDirection dir, int32 busIndex,
  149. int32 channel, UnitID& unitId /*out*/) = 0;
  150. /** Receives a preset data stream.
  151. - If the component supports program list data (IProgramListData), the destination of the data
  152. stream is the program specified by list-Id and program index (first and second parameter)
  153. - If the component supports unit data (IUnitData), the destination is the unit specified by the first
  154. parameter - in this case parameter programIndex is < 0). */
  155. virtual tresult PLUGIN_API setUnitProgramData (int32 listOrUnitId, int32 programIndex, IBStream* data) = 0;
  156. //------------------------------------------------------------------------
  157. static const FUID iid;
  158. };
  159. DECLARE_CLASS_IID (IUnitInfo, 0x3D4BD6B5, 0x913A4FD2, 0xA886E768, 0xA5EB92C1)
  160. //------------------------------------------------------------------------
  161. /** Component extension to access program list data.
  162. \ingroup vstIPlug vst300
  163. - [plug imp]
  164. - [extends IComponent]
  165. - [released: 3.0.0]
  166. - [optional]
  167. A component can either support program list data via this interface or
  168. unit preset data (IUnitData), but not both!
  169. \see \ref vst3UnitPrograms */
  170. //------------------------------------------------------------------------
  171. class IProgramListData: public FUnknown
  172. {
  173. public:
  174. //------------------------------------------------------------------------
  175. /** Returns kResultTrue if the given Program List ID supports Program Data. */
  176. virtual tresult PLUGIN_API programDataSupported (ProgramListID listId) = 0;
  177. /** Gets for a given program list ID and program index the program Data. */
  178. virtual tresult PLUGIN_API getProgramData (ProgramListID listId, int32 programIndex, IBStream* data) = 0;
  179. /** Sets for a given program list ID and program index a program Data. */
  180. virtual tresult PLUGIN_API setProgramData (ProgramListID listId, int32 programIndex, IBStream* data) = 0;
  181. //------------------------------------------------------------------------
  182. static const FUID iid;
  183. };
  184. DECLARE_CLASS_IID (IProgramListData, 0x8683B01F, 0x7B354F70, 0xA2651DEC, 0x353AF4FF)
  185. //------------------------------------------------------------------------
  186. /** Component extension to access unit data.
  187. \ingroup vstIPlug vst300
  188. - [plug imp]
  189. - [extends IComponent]
  190. - [released: 3.0.0]
  191. - [optional]
  192. A component can either support unit preset data via this interface or
  193. program list data (IProgramListData), but not both!
  194. \see \ref vst3UnitPrograms */
  195. //------------------------------------------------------------------------
  196. class IUnitData: public FUnknown
  197. {
  198. public:
  199. //------------------------------------------------------------------------
  200. /** Returns kResultTrue if the specified unit supports export and import of preset data. */
  201. virtual tresult PLUGIN_API unitDataSupported (UnitID unitID) = 0;
  202. /** Gets the preset data for the specified unit. */
  203. virtual tresult PLUGIN_API getUnitData (UnitID unitId, IBStream* data) = 0;
  204. /** Sets the preset data for the specified unit. */
  205. virtual tresult PLUGIN_API setUnitData (UnitID unitId, IBStream* data) = 0;
  206. //------------------------------------------------------------------------
  207. static const FUID iid;
  208. };
  209. DECLARE_CLASS_IID (IUnitData, 0x6C389611, 0xD391455D, 0xB870B833, 0x94A0EFDD)
  210. //------------------------------------------------------------------------
  211. } // namespace Vst
  212. } // namespace Steinberg
  213. //------------------------------------------------------------------------
  214. #include "pluginterfaces/base/falignpop.h"
  215. //------------------------------------------------------------------------