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.

ivstcomponent.h 8.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. //-----------------------------------------------------------------------------
  2. // Project : VST SDK
  3. // Version : 3.6.7
  4. //
  5. // Category : Interfaces
  6. // Filename : pluginterfaces/vst/ivstcomponent.h
  7. // Created by : Steinberg, 04/2005
  8. // Description : Basic VST 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/ipluginbase.h"
  19. #include "vsttypes.h"
  20. //------------------------------------------------------------------------
  21. #include "pluginterfaces/base/falignpush.h"
  22. //------------------------------------------------------------------------
  23. namespace Steinberg {
  24. class IBStream;
  25. //------------------------------------------------------------------------
  26. /** All VST specific interfaces are located in Vst namespace */
  27. //------------------------------------------------------------------------
  28. namespace Vst {
  29. const int32 kDefaultFactoryFlags = PFactoryInfo::kUnicode; ///< Standard value for PFactoryInfo::flags
  30. #define BEGIN_FACTORY_DEF(vendor,url,email) using namespace Steinberg; \
  31. EXPORT_FACTORY IPluginFactory* PLUGIN_API GetPluginFactory () { \
  32. if (!gPluginFactory) \
  33. { static PFactoryInfo factoryInfo (vendor,url,email,Vst::kDefaultFactoryFlags); \
  34. gPluginFactory = new CPluginFactory (factoryInfo);
  35. //------------------------------------------------------------------------
  36. /** \defgroup vstBus VST Buses
  37. @{*/
  38. //------------------------------------------------------------------------
  39. /** Bus media types */
  40. //------------------------------------------------------------------------
  41. enum MediaTypes
  42. {
  43. //------------------------------------------------------------------------
  44. kAudio = 0, ///< audio
  45. kEvent, ///< events
  46. kNumMediaTypes
  47. //------------------------------------------------------------------------
  48. };
  49. //------------------------------------------------------------------------
  50. /** Bus directions */
  51. //------------------------------------------------------------------------
  52. enum BusDirections
  53. {
  54. //------------------------------------------------------------------------
  55. kInput = 0, ///< input bus
  56. kOutput ///< output bus
  57. //------------------------------------------------------------------------
  58. };
  59. //------------------------------------------------------------------------
  60. /** Bus types */
  61. //------------------------------------------------------------------------
  62. enum BusTypes
  63. {
  64. //------------------------------------------------------------------------
  65. kMain = 0, ///< main bus
  66. kAux ///< auxiliary bus (sidechain)
  67. //------------------------------------------------------------------------
  68. };
  69. //------------------------------------------------------------------------
  70. /** Bus Description
  71. A bus can be understood as a 'collection of data channels' belonging together.
  72. It describes a data input or a data output of the Plug-in.
  73. A VST component can define any desired number of buses, but this number must \b never change.
  74. Dynamic usage of buses is handled in the host by activating and deactivating buses.
  75. The component has to define the maximum number of supported buses and it has to
  76. define which of them are active by default. A host that can handle multiple buses,
  77. allows the user to activate buses that were initially inactive.
  78. See also: IComponent::getBusInfo , IComponent::activateBus
  79. */
  80. //------------------------------------------------------------------------
  81. struct BusInfo
  82. {
  83. //------------------------------------------------------------------------
  84. MediaType mediaType; ///< Media type - has to be a value of \ref MediaTypes
  85. BusDirection direction; ///< input or output \ref BusDirections
  86. int32 channelCount; ///< number of channels (if used then need to be recheck after \ref
  87. /// IAudioProcessor::setBusArrangements is called).
  88. /// For a bus of type MediaTypes::kEvent the channelCount corresponds
  89. /// to the number of supported MIDI channels by this bus
  90. String128 name; ///< name of the bus
  91. BusType busType; ///< main or aux - has to be a value of \ref BusTypes
  92. uint32 flags; ///< flags - a combination of \ref BusFlags
  93. enum BusFlags
  94. {
  95. kDefaultActive = 1 << 0 ///< bus active per default
  96. };
  97. //------------------------------------------------------------------------
  98. };
  99. /*@}*/
  100. //------------------------------------------------------------------------
  101. /** I/O modes */
  102. //------------------------------------------------------------------------
  103. enum IoModes
  104. {
  105. kSimple = 0, ///< 1:1 Input / Output. Only used for Instruments. See \ref vst3IoMode
  106. kAdvanced, ///< n:m Input / Output. Only used for Instruments.
  107. kOfflineProcessing ///< Plug-in used in an offline processing context
  108. };
  109. //------------------------------------------------------------------------
  110. /** Routing Information.
  111. When the Plug-in supports multiple I/O buses, a host may want to know how the
  112. buses are related. The relation of an event-input-channel to an audio-output-bus
  113. in particular is of interest to the host (in order to relate MIDI-tracks to audio-channels)
  114. \n See also: IComponent::getRoutingInfo, \ref vst3Routing */
  115. //------------------------------------------------------------------------
  116. struct RoutingInfo
  117. {
  118. MediaType mediaType; ///< media type see \ref MediaTypes
  119. int32 busIndex; ///< bus index
  120. int32 channel; ///< channel (-1 for all channels)
  121. };
  122. //------------------------------------------------------------------------
  123. // IComponent Interface
  124. //------------------------------------------------------------------------
  125. /** Component Base Interface
  126. \ingroup vstIPlug vst300
  127. - [plug imp]
  128. - [released: 3.0.0]
  129. - [mandatory]
  130. This is the basic interface for a VST component and must always be supported.
  131. It contains the common parts of any kind of processing class. The parts that
  132. are specific to a media type are defined in a separate interface. An implementation
  133. component must provide both the specific interface and IComponent.
  134. */
  135. class IComponent: public IPluginBase
  136. {
  137. public:
  138. //------------------------------------------------------------------------
  139. /** Called before initializing the component to get information about the controller class. */
  140. virtual tresult PLUGIN_API getControllerClassId (TUID classId) = 0;
  141. /** Called before 'initialize' to set the component usage (optional). See \ref IoModes */
  142. virtual tresult PLUGIN_API setIoMode (IoMode mode) = 0;
  143. /** Called after the Plug-in is initialized. See \ref MediaTypes, BusDirections */
  144. virtual int32 PLUGIN_API getBusCount (MediaType type, BusDirection dir) = 0;
  145. /** Called after the Plug-in is initialized. See \ref MediaTypes, BusDirections */
  146. virtual tresult PLUGIN_API getBusInfo (MediaType type, BusDirection dir, int32 index, BusInfo& bus /*out*/) = 0;
  147. /** Retrieves routing information (to be implemented when more than one regular input or output bus exists).
  148. The inInfo always refers to an input bus while the returned outInfo must refer to an output bus! */
  149. virtual tresult PLUGIN_API getRoutingInfo (RoutingInfo& inInfo, RoutingInfo& outInfo /*out*/) = 0;
  150. /** Called upon (de-)activating a bus in the host application. The Plug-in should only processed an activated bus,
  151. the host could provide less see \ref AudioBusBuffers in the process call (see \ref IAudioProcessor::process) if last buses are not activated */
  152. virtual tresult PLUGIN_API activateBus (MediaType type, BusDirection dir, int32 index, TBool state) = 0;
  153. /** Activates / deactivates the component. */
  154. virtual tresult PLUGIN_API setActive (TBool state) = 0;
  155. /** Sets complete state of component. */
  156. virtual tresult PLUGIN_API setState (IBStream* state) = 0;
  157. /** Retrieves complete state of component. */
  158. virtual tresult PLUGIN_API getState (IBStream* state) = 0;
  159. //------------------------------------------------------------------------
  160. static const FUID iid;
  161. };
  162. DECLARE_CLASS_IID (IComponent, 0xE831FF31, 0xF2D54301, 0x928EBBEE, 0x25697802)
  163. //------------------------------------------------------------------------
  164. } // namespace Vst
  165. } // namespace Steinberg
  166. //------------------------------------------------------------------------
  167. #include "pluginterfaces/base/falignpop.h"
  168. //------------------------------------------------------------------------