1 //------------------------------------------------------------------------
4 // Category : Interfaces
5 // Filename : pluginterfaces/vst/ivstunits.h
6 // Created by : Steinberg, 2005
7 // Description : VST Units Interfaces
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 //-----------------------------------------------------------------------------
19 #include "pluginterfaces/base/funknown.h"
20 #include "pluginterfaces/vst/vsttypes.h"
22 //------------------------------------------------------------------------
23 #include "pluginterfaces/base/falignpush.h"
24 //------------------------------------------------------------------------
26 //------------------------------------------------------------------------
29 //------------------------------------------------------------------------
31 //------------------------------------------------------------------------
32 /** Special UnitIDs for UnitInfo */
33 static const UnitID kRootUnitId
= 0; ///< identifier for the top level unit (root)
34 static const UnitID kNoParentUnitId
= -1; ///< used for the root unit which does not have a parent.
36 //------------------------------------------------------------------------
37 /** Special ProgramListIDs for UnitInfo */
38 static const ProgramListID kNoProgramListId
= -1; ///< no programs are used in the unit.
40 //------------------------------------------------------------------------
41 /** Basic Unit Description.
46 UnitID id
; ///< unit identifier
47 UnitID parentUnitId
; ///< identifier of parent unit (kNoParentUnitId: does not apply, this unit is the root)
48 String128 name
; ///< name, optional for the root component, required otherwise
49 ProgramListID programListId
; ///< id of program list used in unit (kNoProgramListId = no programs used in this unit)
52 //------------------------------------------------------------------------
53 /** Basic Program List Description.
56 struct ProgramListInfo
58 ProgramListID id
; ///< program list identifier
59 String128 name
; ///< name of program list
60 int32 programCount
; ///< number of programs in this list
63 //------------------------------------------------------------------------
64 /** Special programIndex value for IUnitHandler::notifyProgramListChange */
65 static const int32 kAllProgramInvalid
= -1; ///< all program information is invalid
67 //------------------------------------------------------------------------
68 /** Host callback for unit support: Vst::IUnitHandler
69 \ingroup vstIHost vst300
71 - [extends IComponentHandler]
75 Host callback interface, used with IUnitInfo.
76 Retrieve via queryInterface from IComponentHandler.
78 \see \ref vst3Units, IUnitInfo
80 class IUnitHandler
: public FUnknown
83 //------------------------------------------------------------------------
84 /** Notify host when a module is selected in plug-in GUI. */
85 virtual tresult PLUGIN_API
notifyUnitSelection (UnitID unitId
) = 0;
87 /** Tell host that the plug-in controller changed a program list (rename, load, PitchName changes).
88 \param listId is the specified program list ID to inform.
89 \param programIndex : when kAllProgramInvalid, all program information is invalid, otherwise only the program of given index. */
90 virtual tresult PLUGIN_API
notifyProgramListChange (ProgramListID listId
, int32 programIndex
) = 0;
92 //------------------------------------------------------------------------
93 static const FUID iid
;
96 DECLARE_CLASS_IID (IUnitHandler
, 0x4B5147F8, 0x4654486B, 0x8DAB30BA, 0x163A3C56)
98 //------------------------------------------------------------------------
99 /** Host callback for extended unit support: Vst::IUnitHandler2
100 \ingroup vstIHost vst365
102 - [extends IUnitHandler]
106 Host callback interface, used with IUnitInfo.
107 Retrieve via queryInterface from IComponentHandler.
109 The plug-in has the possibility to inform the host with notifyUnitByBusChange that something has
110 changed in the bus - unit assignment, the host then has to recall IUnitInfo::getUnitByBus in order
111 to get the new relations between busses and unit.
113 \see \ref vst3Units, IUnitHandler
115 class IUnitHandler2
: public FUnknown
118 //------------------------------------------------------------------------
119 /** Tell host that assignment Unit-Bus defined by IUnitInfo::getUnitByBus has changed. */
120 virtual tresult PLUGIN_API
notifyUnitByBusChange () = 0;
122 //------------------------------------------------------------------------
123 static const FUID iid
;
126 DECLARE_CLASS_IID (IUnitHandler2
, 0xF89F8CDF, 0x699E4BA5, 0x96AAC9A4, 0x81452B01)
128 //------------------------------------------------------------------------
129 /** Edit controller extension to describe the plug-in structure: Vst::IUnitInfo
130 \ingroup vstIPlug vst300
132 - [extends IEditController]
136 IUnitInfo describes the internal structure of the plug-in.
137 - The root unit is the component itself, so getUnitCount must return 1 at least.
138 - The root unit id has to be 0 (kRootUnitId).
139 - Each unit can reference one program list - this reference must not change.
140 - Each unit, using a program list, references one program of the list.
142 \see \ref vst3Units, IUnitHandler
144 class IUnitInfo
: public FUnknown
147 //------------------------------------------------------------------------
148 /** Returns the flat count of units. */
149 virtual int32 PLUGIN_API
getUnitCount () = 0;
151 /** Gets UnitInfo for a given index in the flat list of unit. */
152 virtual tresult PLUGIN_API
getUnitInfo (int32 unitIndex
, UnitInfo
& info
/*out*/) = 0;
154 /** Component intern program structure. */
155 /** Gets the count of Program List. */
156 virtual int32 PLUGIN_API
getProgramListCount () = 0;
158 /** Gets for a given index the Program List Info. */
159 virtual tresult PLUGIN_API
getProgramListInfo (int32 listIndex
, ProgramListInfo
& info
/*out*/) = 0;
161 /** Gets for a given program list ID and program index its program name. */
162 virtual tresult PLUGIN_API
getProgramName (ProgramListID listId
, int32 programIndex
, String128 name
/*out*/) = 0;
164 /** Gets for a given program list ID, program index and attributeId the associated attribute value. */
165 virtual tresult PLUGIN_API
getProgramInfo (ProgramListID listId
, int32 programIndex
,
166 CString attributeId
/*in*/, String128 attributeValue
/*out*/) = 0;
168 /** Returns kResultTrue if the given program index of a given program list ID supports PitchNames. */
169 virtual tresult PLUGIN_API
hasProgramPitchNames (ProgramListID listId
, int32 programIndex
) = 0;
171 /** Gets the PitchName for a given program list ID, program index and pitch.
172 If PitchNames are changed the plug-in should inform the host with IUnitHandler::notifyProgramListChange. */
173 virtual tresult PLUGIN_API
getProgramPitchName (ProgramListID listId
, int32 programIndex
,
174 int16 midiPitch
, String128 name
/*out*/) = 0;
176 // units selection --------------------
177 /** Gets the current selected unit. */
178 virtual UnitID PLUGIN_API
getSelectedUnit () = 0;
180 /** Sets a new selected unit. */
181 virtual tresult PLUGIN_API
selectUnit (UnitID unitId
) = 0;
183 /** Gets the according unit if there is an unambiguous relation between a channel or a bus and a unit.
184 This method mainly is intended to find out which unit is related to a given MIDI input channel. */
185 virtual tresult PLUGIN_API
getUnitByBus (MediaType type
, BusDirection dir
, int32 busIndex
,
186 int32 channel
, UnitID
& unitId
/*out*/) = 0;
188 /** Receives a preset data stream.
189 - If the component supports program list data (IProgramListData), the destination of the data
190 stream is the program specified by list-Id and program index (first and second parameter)
191 - If the component supports unit data (IUnitData), the destination is the unit specified by the first
192 parameter - in this case parameter programIndex is < 0). */
193 virtual tresult PLUGIN_API
setUnitProgramData (int32 listOrUnitId
, int32 programIndex
, IBStream
* data
) = 0;
195 //------------------------------------------------------------------------
196 static const FUID iid
;
199 DECLARE_CLASS_IID (IUnitInfo
, 0x3D4BD6B5, 0x913A4FD2, 0xA886E768, 0xA5EB92C1)
201 //------------------------------------------------------------------------
202 /** Component extension to access program list data: Vst::IProgramListData
203 \ingroup vstIPlug vst300
205 - [extends IComponent]
209 A component can support program list data via this interface or/and
210 unit preset data (IUnitData).
212 \see IUnitData, \ref vst3MultitimbralPrograms
214 class IProgramListData
: public FUnknown
217 //------------------------------------------------------------------------
218 /** Returns kResultTrue if the given Program List ID supports Program Data. */
219 virtual tresult PLUGIN_API
programDataSupported (ProgramListID listId
) = 0;
221 /** Gets for a given program list ID and program index the program Data. */
222 virtual tresult PLUGIN_API
getProgramData (ProgramListID listId
, int32 programIndex
, IBStream
* data
) = 0;
224 /** Sets for a given program list ID and program index a program Data. */
225 virtual tresult PLUGIN_API
setProgramData (ProgramListID listId
, int32 programIndex
, IBStream
* data
) = 0;
227 //------------------------------------------------------------------------
228 static const FUID iid
;
231 DECLARE_CLASS_IID (IProgramListData
, 0x8683B01F, 0x7B354F70, 0xA2651DEC, 0x353AF4FF)
233 //------------------------------------------------------------------------
234 /** Component extension to access unit data: Vst::IUnitData
235 \ingroup vstIPlug vst300
237 - [extends IComponent]
241 A component can support unit preset data via this interface or
242 program list data (IProgramListData).
244 \see \ref vst3ProgramLists
246 class IUnitData
: public FUnknown
249 //------------------------------------------------------------------------
250 /** Returns kResultTrue if the specified unit supports export and import of preset data. */
251 virtual tresult PLUGIN_API
unitDataSupported (UnitID unitID
) = 0;
253 /** Gets the preset data for the specified unit. */
254 virtual tresult PLUGIN_API
getUnitData (UnitID unitId
, IBStream
* data
) = 0;
256 /** Sets the preset data for the specified unit. */
257 virtual tresult PLUGIN_API
setUnitData (UnitID unitId
, IBStream
* data
) = 0;
259 //------------------------------------------------------------------------
260 static const FUID iid
;
263 DECLARE_CLASS_IID (IUnitData
, 0x6C389611, 0xD391455D, 0xB870B833, 0x94A0EFDD)
265 //------------------------------------------------------------------------
267 } // namespace Steinberg
269 //------------------------------------------------------------------------
270 #include "pluginterfaces/base/falignpop.h"
271 //------------------------------------------------------------------------