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.

222 lines
8.2KB

  1. //------------------------------------------------------------------------
  2. // Project : VST SDK
  3. //
  4. // Category : Interfaces
  5. // Filename : pluginterfaces/vst/ivstevents.h
  6. // Created by : Steinberg, 11/2005
  7. // Description : VST Events 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/vst/ivstprocesscontext.h"
  18. #include "pluginterfaces/vst/ivstnoteexpression.h"
  19. //------------------------------------------------------------------------
  20. #include "pluginterfaces/base/falignpush.h"
  21. //------------------------------------------------------------------------
  22. //------------------------------------------------------------------------
  23. namespace Steinberg {
  24. namespace Vst {
  25. //------------------------------------------------------------------------
  26. /** Reserved note identifier (noteId) range for a plug-in. Guaranteed not used by the host. */
  27. enum NoteIDUserRange
  28. {
  29. kNoteIDUserRangeLowerBound = -10000,
  30. kNoteIDUserRangeUpperBound = -1000,
  31. };
  32. //------------------------------------------------------------------------
  33. /** Note-on event specific data. Used in \ref Event (union)
  34. \ingroup vstEventGrp
  35. Pitch uses the twelve-tone equal temperament tuning (12-TET).
  36. */
  37. struct NoteOnEvent
  38. {
  39. int16 channel; ///< channel index in event bus
  40. int16 pitch; ///< range [0, 127] = [C-2, G8] with A3=440Hz (12-TET: twelve-tone equal temperament)
  41. float tuning; ///< 1.f = +1 cent, -1.f = -1 cent
  42. float velocity; ///< range [0.0, 1.0]
  43. int32 length; ///< in sample frames (optional, Note Off has to follow in any case!)
  44. int32 noteId; ///< note identifier (if not available then -1)
  45. };
  46. //------------------------------------------------------------------------
  47. /** Note-off event specific data. Used in \ref Event (union)
  48. \ingroup vstEventGrp
  49. */
  50. struct NoteOffEvent
  51. {
  52. int16 channel; ///< channel index in event bus
  53. int16 pitch; ///< range [0, 127] = [C-2, G8] with A3=440Hz (12-TET)
  54. float velocity; ///< range [0.0, 1.0]
  55. int32 noteId; ///< associated noteOn identifier (if not available then -1)
  56. float tuning; ///< 1.f = +1 cent, -1.f = -1 cent
  57. };
  58. //------------------------------------------------------------------------
  59. /** Data event specific data. Used in \ref Event (union)
  60. \ingroup vstEventGrp
  61. */
  62. struct DataEvent
  63. {
  64. uint32 size; ///< size in bytes of the data block bytes
  65. uint32 type; ///< type of this data block (see \ref DataTypes)
  66. const uint8* bytes; ///< pointer to the data block
  67. /** Value for DataEvent::type */
  68. enum DataTypes
  69. {
  70. kMidiSysEx = 0 ///< for MIDI system exclusive message
  71. };
  72. };
  73. //------------------------------------------------------------------------
  74. /** PolyPressure event specific data. Used in \ref Event (union)
  75. \ingroup vstEventGrp
  76. */
  77. struct PolyPressureEvent
  78. {
  79. int16 channel; ///< channel index in event bus
  80. int16 pitch; ///< range [0, 127] = [C-2, G8] with A3=440Hz
  81. float pressure; ///< range [0.0, 1.0]
  82. int32 noteId; ///< event should be applied to the noteId (if not -1)
  83. };
  84. //------------------------------------------------------------------------
  85. /** Chord event specific data. Used in \ref Event (union)
  86. \ingroup vstEventGrp
  87. */
  88. struct ChordEvent
  89. {
  90. int16 root; ///< range [0, 127] = [C-2, G8] with A3=440Hz
  91. int16 bassNote; ///< range [0, 127] = [C-2, G8] with A3=440Hz
  92. int16 mask; ///< root is bit 0
  93. uint16 textLen; ///< the number of characters (TChar) between the beginning of text and the terminating
  94. ///< null character (without including the terminating null character itself)
  95. const TChar* text; ///< UTF-16, null terminated Hosts Chord Name
  96. };
  97. //------------------------------------------------------------------------
  98. /** Scale event specific data. Used in \ref Event (union)
  99. \ingroup vstEventGrp
  100. */
  101. struct ScaleEvent
  102. {
  103. int16 root; ///< range [0, 127] = root Note/Transpose Factor
  104. int16 mask; ///< Bit 0 = C, Bit 1 = C#, ... (0x5ab5 = Major Scale)
  105. uint16 textLen; ///< the number of characters (TChar) between the beginning of text and the terminating
  106. ///< null character (without including the terminating null character itself)
  107. const TChar* text; ///< UTF-16, null terminated, Hosts Scale Name
  108. };
  109. //------------------------------------------------------------------------
  110. /** Legacy MIDI CC Out event specific data. Used in \ref Event (union)
  111. \ingroup vstEventGrp
  112. - [released: 3.6.12]
  113. This kind of event is reserved for generating MIDI CC as output event for kEvent Bus during the process call.
  114. */
  115. struct LegacyMIDICCOutEvent
  116. {
  117. uint8 controlNumber;///< see enum ControllerNumbers [0, 255]
  118. int8 channel; ///< channel index in event bus [0, 15]
  119. int8 value; ///< value of Controller [0, 127]
  120. int8 value2; ///< [0, 127] used for pitch bend (kPitchBend) and polyPressure (kCtrlPolyPressure)
  121. };
  122. //------------------------------------------------------------------------
  123. /** Event
  124. \ingroup vstEventGrp
  125. Structure representing a single Event of different types associated to a specific event (\ref kEvent) bus.
  126. */
  127. struct Event
  128. {
  129. int32 busIndex; ///< event bus index
  130. int32 sampleOffset; ///< sample frames related to the current block start sample position
  131. TQuarterNotes ppqPosition; ///< position in project
  132. uint16 flags; ///< combination of \ref EventFlags
  133. /** Event Flags - used for Event::flags */
  134. enum EventFlags
  135. {
  136. kIsLive = 1 << 0, ///< indicates that the event is played live (directly from keyboard)
  137. kUserReserved1 = 1 << 14, ///< reserved for user (for internal use)
  138. kUserReserved2 = 1 << 15 ///< reserved for user (for internal use)
  139. };
  140. /** Event Types - used for Event::type */
  141. enum EventTypes
  142. {
  143. kNoteOnEvent = 0, ///< is \ref NoteOnEvent
  144. kNoteOffEvent = 1, ///< is \ref NoteOffEvent
  145. kDataEvent = 2, ///< is \ref DataEvent
  146. kPolyPressureEvent = 3, ///< is \ref PolyPressureEvent
  147. kNoteExpressionValueEvent = 4, ///< is \ref NoteExpressionValueEvent
  148. kNoteExpressionTextEvent = 5, ///< is \ref NoteExpressionTextEvent
  149. kChordEvent = 6, ///< is \ref ChordEvent
  150. kScaleEvent = 7, ///< is \ref ScaleEvent
  151. kLegacyMIDICCOutEvent = 65535 ///< is \ref LegacyMIDICCOutEvent
  152. };
  153. uint16 type; ///< a value from \ref EventTypes
  154. union
  155. {
  156. NoteOnEvent noteOn; ///< type == kNoteOnEvent
  157. NoteOffEvent noteOff; ///< type == kNoteOffEvent
  158. DataEvent data; ///< type == kDataEvent
  159. PolyPressureEvent polyPressure; ///< type == kPolyPressureEvent
  160. NoteExpressionValueEvent noteExpressionValue; ///< type == kNoteExpressionValueEvent
  161. NoteExpressionTextEvent noteExpressionText; ///< type == kNoteExpressionTextEvent
  162. ChordEvent chord; ///< type == kChordEvent
  163. ScaleEvent scale; ///< type == kScaleEvent
  164. LegacyMIDICCOutEvent midiCCOut; ///< type == kLegacyMIDICCOutEvent
  165. };
  166. };
  167. //------------------------------------------------------------------------
  168. /** List of events to process: Vst::IEventList
  169. \ingroup vstIHost vst300
  170. - [host imp]
  171. - [released: 3.0.0]
  172. - [mandatory]
  173. \see ProcessData, Event
  174. */
  175. class IEventList : public FUnknown
  176. {
  177. public:
  178. //------------------------------------------------------------------------
  179. /** Returns the count of events. */
  180. virtual int32 PLUGIN_API getEventCount () = 0;
  181. /** Gets parameter by index. */
  182. virtual tresult PLUGIN_API getEvent (int32 index, Event& e /*out*/) = 0;
  183. /** Adds a new event. */
  184. virtual tresult PLUGIN_API addEvent (Event& e /*in*/) = 0;
  185. //------------------------------------------------------------------------
  186. static const FUID iid;
  187. };
  188. DECLARE_CLASS_IID (IEventList, 0x3A2C4214, 0x346349FE, 0xB2C4F397, 0xB9695A44)
  189. //------------------------------------------------------------------------
  190. } // namespace Vst
  191. } // namespace Steinberg
  192. //------------------------------------------------------------------------
  193. #include "pluginterfaces/base/falignpop.h"
  194. //------------------------------------------------------------------------