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.

181 lines
7.0KB

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