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.

187 lines
7.6KB

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