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.

ivstevents.h 7.5KB

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