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.

206 lines
8.4KB

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