/[svn]/linuxsampler/trunk/src/engines/common/Event.h
ViewVC logotype

Diff of /linuxsampler/trunk/src/engines/common/Event.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 906 by schoenebeck, Sun Jul 23 16:44:08 2006 UTC revision 2611 by schoenebeck, Mon Jun 9 19:20:37 2014 UTC
# Line 3  Line 3 
3   *   LinuxSampler - modular, streaming capable sampler                     *   *   LinuxSampler - modular, streaming capable sampler                     *
4   *                                                                         *   *                                                                         *
5   *   Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck   *   *   Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck   *
6   *   Copyright (C) 2005, 2006 Christian Schoenebeck                        *   *   Copyright (C) 2005 - 2014 Christian Schoenebeck                       *
7   *                                                                         *   *                                                                         *
8   *   This program is free software; you can redistribute it and/or modify  *   *   This program is free software; you can redistribute it and/or modify  *
9   *   it under the terms of the GNU General Public License as published by  *   *   it under the terms of the GNU General Public License as published by  *
# Line 64  namespace LinuxSampler { Line 64  namespace LinuxSampler {
64       * controller like LFO or EG. An event should only be created by an       * controller like LFO or EG. An event should only be created by an
65       * EventGenerator!       * EventGenerator!
66       *       *
67       * @see EventGenerator       * @see EventGenerator, ScriptEvent
68       */       */
69      class Event {      class Event {
70          public:          public:
# Line 76  namespace LinuxSampler { Line 76  namespace LinuxSampler {
76                  type_control_change,                  type_control_change,
77                  type_sysex,           ///< MIDI system exclusive message                  type_sysex,           ///< MIDI system exclusive message
78                  type_cancel_release,  ///< transformed either from a note-on or sustain-pedal-down event                  type_cancel_release,  ///< transformed either from a note-on or sustain-pedal-down event
79                  type_release          ///< transformed either from a note-off or sustain-pedal-up event                  type_release,         ///< transformed either from a note-off or sustain-pedal-up event
80                    type_channel_pressure, ///< a.k.a. aftertouch
81                    type_note_pressure, ///< polyphonic key pressure (aftertouch)
82              } Type;              } Type;
83              union {              union {
84                  /// Note-on and note-off event specifics                  /// Note-on and note-off event specifics
85                  struct _Note {                  struct _Note {
86                        uint8_t Channel;     ///< MIDI channel (0..15)
87                      uint8_t Key;         ///< MIDI key number of note-on / note-off event.                      uint8_t Key;         ///< MIDI key number of note-on / note-off event.
88                      uint8_t Velocity;    ///< Trigger or release velocity of note-on / note-off event.                      uint8_t Velocity;    ///< Trigger or release velocity of note-on / note-off event.
89                      int8_t  Layer;       ///< Layer index (usually only used if a note-on event has to be postponed, e.g. due to shortage of free voices).                      int8_t  Layer;       ///< Layer index (usually only used if a note-on event has to be postponed, e.g. due to shortage of free voices).
90                      int8_t  ReleaseTrigger; ///< If new voice should be a release triggered voice (actually boolean field and usually only used if a note-on event has to be postponed, e.g. due to shortage of free voices).                      int8_t  ReleaseTrigger; ///< If new voice should be a release triggered voice (actually boolean field and usually only used if a note-on event has to be postponed, e.g. due to shortage of free voices).
91                        void*   pRegion;     ///< Engine specific pointer to instrument region
92                  } Note;                  } Note;
93                  /// Control change event specifics                  /// Control change event specifics
94                  struct _CC {                  struct _CC {
95                        uint8_t Channel;     ///< MIDI channel (0..15)
96                      uint8_t Controller;  ///< MIDI controller number of control change event.                      uint8_t Controller;  ///< MIDI controller number of control change event.
97                      uint8_t Value;       ///< Controller Value of control change event.                      uint8_t Value;       ///< Controller Value of control change event.
98                  } CC;                  } CC;
99                  /// Pitchbend event specifics                  /// Pitchbend event specifics
100                  struct _Pitch {                  struct _Pitch {
101                        uint8_t Channel;     ///< MIDI channel (0..15)
102                      int16_t Pitch;       ///< Pitch value of pitchbend event.                      int16_t Pitch;       ///< Pitch value of pitchbend event.
103                  } Pitch;                  } Pitch;
104                  /// MIDI system exclusive event specifics                  /// MIDI system exclusive event specifics
105                  struct _Sysex {                  struct _Sysex {
106                      uint Size;           ///< Data length (in bytes) of MIDI system exclusive message.                      uint Size;           ///< Data length (in bytes) of MIDI system exclusive message.
107                  } Sysex;                  } Sysex;
108                    /// Channel Pressure (aftertouch) event specifics
109                    struct _ChannelPressure {
110                        uint8_t Channel; ///< MIDI channel (0..15)
111                        uint8_t Controller; ///< Should always be assigned to CTRL_TABLE_IDX_AFTERTOUCH.
112                        uint8_t Value;   ///< New aftertouch / pressure value for keys on that channel.
113                    } ChannelPressure;
114                    /// Polyphonic Note Pressure (aftertouch) event specifics
115                    struct _NotePressure {
116                        uint8_t Channel; ///< MIDI channel (0..15)
117                        uint8_t Key;     ///< MIDI note number where key pressure (polyphonic aftertouch) changed.
118                        uint8_t Value;   ///< New pressure value for note.
119                    } NotePressure;
120              } Param;              } Param;
121                /// Sampler format specific informations and variables.
122                union {
123                    /// Gigasampler/GigaStudio format specifics.
124                    struct _Gig {
125                        uint8_t DimMask; ///< May be used to override the Dimension zone to be selected for a new voice: each 1 bit means that respective bit shall be overridden by taking the respective bit from DimBits instead.
126                        uint8_t DimBits; ///< Used only in conjunction with DimMask: Dimension bits that shall be selected.
127                    } Gig;
128                } Format;
129              EngineChannel* pEngineChannel; ///< Pointer to the EngineChannel where this event occured on, NULL means Engine global event (e.g. SysEx message).              EngineChannel* pEngineChannel; ///< Pointer to the EngineChannel where this event occured on, NULL means Engine global event (e.g. SysEx message).
130                MidiInputPort* pMidiInputPort; ///< Pointer to the MIDI input port on which this event occured (NOTE: currently only for global events, that is SysEx messages)
131    
132              inline int32_t FragmentPos() {              inline int32_t FragmentPos() {
133                  if (iFragmentPos >= 0) return iFragmentPos;                  if (iFragmentPos >= 0) return iFragmentPos;
# Line 122  namespace LinuxSampler { Line 149  namespace LinuxSampler {
149              int32_t         iFragmentPos;    ///< Position in the current fragment this event refers to.              int32_t         iFragmentPos;    ///< Position in the current fragment this event refers to.
150      };      };
151    
152        class VMEventHandler;
153        class VMExecContext;
154    
155        /** @brief Real-time instrument script event.
156         *
157         * Encapsulates one execution instance of a real-time instrument script for
158         * exactly one script event handler (script event callback).
159         */
160        class ScriptEvent {
161        public:
162            Event cause; ///< Original external event that triggered this script event (i.e. MIDI note on event, MIDI CC event, etc.).
163            int id; ///< Unique ID of the external event that triggered this cript event.
164            VMEventHandler** handlers; ///< The script's event handlers (callbacks) to be processed (NULL terminated list).
165            VMExecContext* execCtx; ///< Script's current execution state (polyphonic variables and execution stack).
166            int currentHandler; ///< Current index in 'handlers' list above.
167            int executionSlices; ///< Amount of times this script event has been executed by the ScriptVM runner class.
168        };
169    
170  } // namespace LinuxSampler  } // namespace LinuxSampler
171    
172  #endif // __LS_EVENT_H__  #endif // __LS_EVENT_H__

Legend:
Removed from v.906  
changed lines
  Added in v.2611

  ViewVC Help
Powered by ViewVC