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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. //------------------------------------------------------------------------
  2. // Project : VST SDK
  3. // Version : 3.6.7
  4. //
  5. // Category : Interfaces
  6. // Filename : pluginterfaces/vst/ivstunits.h
  7. // Created by : Steinberg, 2005
  8. // Description : VST Units Interfaces
  9. //
  10. //-----------------------------------------------------------------------------
  11. // This file is part of a Steinberg SDK. It is subject to the license terms
  12. // in the LICENSE file found in the top-level directory of this distribution
  13. // and at www.steinberg.net/sdklicenses.
  14. // No part of the SDK, including this file, may be copied, modified, propagated,
  15. // or distributed except according to the terms contained in the LICENSE file.
  16. //-----------------------------------------------------------------------------
  17. #pragma once
  18. #include "pluginterfaces/base/funknown.h"
  19. #include "vsttypes.h"
  20. //------------------------------------------------------------------------
  21. #include "pluginterfaces/base/falignpush.h"
  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 doesn't 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.
  60. \ingroup vstIHost vst300
  61. - [host imp]
  62. - [extends IComponentHandler]
  63. - [released: 3.0.0]
  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. Host callback interface, used with IUnitInfo.
  89. Retrieve via queryInterface from IComponentHandler.
  90. \see \ref vst3Units, IUnitHandler */
  91. //------------------------------------------------------------------------
  92. class IUnitHandler2 : public FUnknown
  93. {
  94. public:
  95. //------------------------------------------------------------------------
  96. /** Tell host that assignment Unit-Bus defined by IUnitInfo::getUnitByBus has changed. */
  97. virtual tresult PLUGIN_API notifyUnitByBusChange () = 0;
  98. //------------------------------------------------------------------------
  99. static const FUID iid;
  100. };
  101. DECLARE_CLASS_IID (IUnitHandler2, 0xF89F8CDF, 0x699E4BA5, 0x96AAC9A4, 0x81452B01)
  102. //------------------------------------------------------------------------
  103. /** Edit controller extension to describe the Plug-in structure.
  104. \ingroup vstIPlug vst300
  105. - [plug imp]
  106. - [extends IEditController]
  107. - [released: 3.0.0]
  108. IUnitInfo describes the internal structure of the Plug-in.
  109. - The root unit is the component itself, so getUnitCount must return 1 at least.
  110. - The root unit id has to be 0 (kRootUnitId).
  111. - Each unit can reference one program list - this reference must not change.
  112. - Each unit using a program list, references one program of the list.
  113. \see \ref vst3Units, IUnitHandler */
  114. //------------------------------------------------------------------------
  115. class IUnitInfo: public FUnknown
  116. {
  117. public:
  118. //------------------------------------------------------------------------
  119. /** Returns the flat count of units. */
  120. virtual int32 PLUGIN_API getUnitCount () = 0;
  121. /** Gets UnitInfo for a given index in the flat list of unit. */
  122. virtual tresult PLUGIN_API getUnitInfo (int32 unitIndex, UnitInfo& info /*out*/) = 0;
  123. /** Component intern program structure. */
  124. /** Gets the count of Program List. */
  125. virtual int32 PLUGIN_API getProgramListCount () = 0;
  126. /** Gets for a given index the Program List Info. */
  127. virtual tresult PLUGIN_API getProgramListInfo (int32 listIndex, ProgramListInfo& info /*out*/) = 0;
  128. /** Gets for a given program list ID and program index its program name. */
  129. virtual tresult PLUGIN_API getProgramName (ProgramListID listId, int32 programIndex, String128 name /*out*/) = 0;
  130. /** Gets for a given program list ID, program index and attributeId the associated attribute value. */
  131. virtual tresult PLUGIN_API getProgramInfo (ProgramListID listId, int32 programIndex,
  132. CString attributeId /*in*/, String128 attributeValue /*out*/) = 0;
  133. /** Returns kResultTrue if the given program index of a given program list ID supports PitchNames. */
  134. virtual tresult PLUGIN_API hasProgramPitchNames (ProgramListID listId, int32 programIndex) = 0;
  135. /** Gets the PitchName for a given program list ID, program index and pitch.
  136. If PitchNames are changed the Plug-in should inform the host with IUnitHandler::notifyProgramListChange. */
  137. virtual tresult PLUGIN_API getProgramPitchName (ProgramListID listId, int32 programIndex,
  138. int16 midiPitch, String128 name /*out*/) = 0;
  139. // units selection --------------------
  140. /** Gets the current selected unit. */
  141. virtual UnitID PLUGIN_API getSelectedUnit () = 0;
  142. /** Sets a new selected unit. */
  143. virtual tresult PLUGIN_API selectUnit (UnitID unitId) = 0;
  144. /** Gets the according unit if there is an unambiguous relation between a channel or a bus and a unit.
  145. This method mainly is intended to find out which unit is related to a given MIDI input channel. */
  146. virtual tresult PLUGIN_API getUnitByBus (MediaType type, BusDirection dir, int32 busIndex,
  147. int32 channel, UnitID& unitId /*out*/) = 0;
  148. /** Receives a preset data stream.
  149. - If the component supports program list data (IProgramListData), the destination of the data
  150. stream is the program specified by list-Id and program index (first and second parameter)
  151. - If the component supports unit data (IUnitData), the destination is the unit specified by the first
  152. parameter - in this case parameter programIndex is < 0). */
  153. virtual tresult PLUGIN_API setUnitProgramData (int32 listOrUnitId, int32 programIndex, IBStream* data) = 0;
  154. //------------------------------------------------------------------------
  155. static const FUID iid;
  156. };
  157. DECLARE_CLASS_IID (IUnitInfo, 0x3D4BD6B5, 0x913A4FD2, 0xA886E768, 0xA5EB92C1)
  158. //------------------------------------------------------------------------
  159. /** Component extension to access program list data.
  160. \ingroup vstIPlug vst300
  161. - [plug imp]
  162. - [extends IComponent]
  163. - [released: 3.0.0]
  164. A component can either support program list data via this interface or
  165. unit preset data (IUnitData), but not both!
  166. \see \ref vst3UnitPrograms */
  167. //------------------------------------------------------------------------
  168. class IProgramListData: public FUnknown
  169. {
  170. public:
  171. //------------------------------------------------------------------------
  172. /** Returns kResultTrue if the given Program List ID supports Program Data. */
  173. virtual tresult PLUGIN_API programDataSupported (ProgramListID listId) = 0;
  174. /** Gets for a given program list ID and program index the program Data. */
  175. virtual tresult PLUGIN_API getProgramData (ProgramListID listId, int32 programIndex, IBStream* data) = 0;
  176. /** Sets for a given program list ID and program index a program Data. */
  177. virtual tresult PLUGIN_API setProgramData (ProgramListID listId, int32 programIndex, IBStream* data) = 0;
  178. //------------------------------------------------------------------------
  179. static const FUID iid;
  180. };
  181. DECLARE_CLASS_IID (IProgramListData, 0x8683B01F, 0x7B354F70, 0xA2651DEC, 0x353AF4FF)
  182. //------------------------------------------------------------------------
  183. /** Component extension to access unit data.
  184. \ingroup vstIPlug vst300
  185. - [plug imp]
  186. - [extends IComponent]
  187. - [released: 3.0.0]
  188. A component can either support unit preset data via this interface or
  189. program list data (IProgramListData), but not both!
  190. \see \ref vst3UnitPrograms */
  191. //------------------------------------------------------------------------
  192. class IUnitData: public FUnknown
  193. {
  194. public:
  195. //------------------------------------------------------------------------
  196. /** Returns kResultTrue if the specified unit supports export and import of preset data. */
  197. virtual tresult PLUGIN_API unitDataSupported (UnitID unitID) = 0;
  198. /** Gets the preset data for the specified unit. */
  199. virtual tresult PLUGIN_API getUnitData (UnitID unitId, IBStream* data) = 0;
  200. /** Sets the preset data for the specified unit. */
  201. virtual tresult PLUGIN_API setUnitData (UnitID unitId, IBStream* data) = 0;
  202. //------------------------------------------------------------------------
  203. static const FUID iid;
  204. };
  205. DECLARE_CLASS_IID (IUnitData, 0x6C389611, 0xD391455D, 0xB870B833, 0x94A0EFDD)
  206. //------------------------------------------------------------------------
  207. } // namespace Vst
  208. } // namespace Steinberg
  209. //------------------------------------------------------------------------
  210. #include "pluginterfaces/base/falignpop.h"
  211. //------------------------------------------------------------------------