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