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

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