/[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 56 by schoenebeck, Tue Apr 27 09:21:58 2004 UTC revision 293 by schoenebeck, Mon Oct 25 15:14:27 2004 UTC
# Line 41  namespace LinuxSampler { Line 41  namespace LinuxSampler {
41              Event CreateEvent();              Event CreateEvent();
42          protected:          protected:
43              typedef uint32_t time_stamp_t; ///< We read the processor's cycle count register as a reference for the real time. These are of course only abstract values with arbitrary time entity, but that's not a problem as we calculate relatively.              typedef uint32_t time_stamp_t; ///< We read the processor's cycle count register as a reference for the real time. These are of course only abstract values with arbitrary time entity, but that's not a problem as we calculate relatively.
44              inline uint ToFragmentPos(time_stamp_t TimeStamp) {              inline int32_t ToFragmentPos(time_stamp_t TimeStamp) {
45                  return uint ((TimeStamp - FragmentTime.begin) * FragmentTime.sample_ratio);                  return int32_t (int32_t(TimeStamp - FragmentTime.begin) * FragmentTime.sample_ratio);
46              }              }
47              friend class Event;              friend class Event;
48          private:          private:
# Line 71  namespace LinuxSampler { Line 71  namespace LinuxSampler {
71                  type_note_off,                  type_note_off,
72                  type_pitchbend,                  type_pitchbend,
73                  type_control_change,                  type_control_change,
74                    type_sysex,           ///< MIDI system exclusive message
75                  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
76                  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
77              } Type;              } Type;
# Line 82  namespace LinuxSampler { Line 83  namespace LinuxSampler {
83                  destination_count  ///< Total number of modulation destinations (this has to stay the last element in the enum)                  destination_count  ///< Total number of modulation destinations (this has to stay the last element in the enum)
84              };              };
85              union {              union {
86                  uint8_t Key;          ///< MIDI key number for note-on and note-off events.                  /// Note-on and note-off event specifics
87                  uint8_t Controller;   ///< MIDI controller number for control change events.                  struct _Note {
88              };                      uint8_t Key;         ///< MIDI key number of note-on / note-off event.
89              union {                      uint8_t Velocity;    ///< Trigger or release velocity of note-on / note-off event.
90                  uint8_t Velocity;     ///< Trigger or release velocity for note-on or note-off events.                      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).
91                  uint8_t Value;        ///< Value for control change events.                      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).
92              };                  } Note;
93              int16_t Pitch;            ///< Pitch value for pitchbend events.                  /// Control change event specifics
94                    struct _CC {
95                        uint8_t Controller;  ///< MIDI controller number of control change event.
96                        uint8_t Value;       ///< Controller Value of control change event.
97                    } CC;
98                    /// Pitchbend event specifics
99                    struct _Pitch {
100                        int16_t Pitch;       ///< Pitch value of pitchbend event.
101                    } Pitch;
102                    /// MIDI system exclusive event specifics
103                    struct _Sysex {
104                        uint Size;           ///< Data length (in bytes) of MIDI system exclusive message.
105                    } Sysex;
106                } Param;
107    
108              inline uint FragmentPos() {              inline int32_t FragmentPos() {
109                  if (iFragmentPos >= 0) return (uint) iFragmentPos;                  if (iFragmentPos >= 0) return iFragmentPos;
110                  return (uint) (iFragmentPos = pEventGenerator->ToFragmentPos(TimeStamp));                  iFragmentPos = pEventGenerator->ToFragmentPos(TimeStamp);
111                    if (iFragmentPos < 0) iFragmentPos = 0; // if event arrived shortly before the beginning of current fragment
112                    return iFragmentPos;
113                }
114                inline void ResetFragmentPos() {
115                    iFragmentPos = -1;
116              }              }
117          protected:          protected:
118              typedef EventGenerator::time_stamp_t time_stamp_t;              typedef EventGenerator::time_stamp_t time_stamp_t;
# Line 102  namespace LinuxSampler { Line 121  namespace LinuxSampler {
121          private:          private:
122              EventGenerator* pEventGenerator; ///< Creator of the event.              EventGenerator* pEventGenerator; ///< Creator of the event.
123              time_stamp_t    TimeStamp;       ///< Time stamp of the event's occurence.              time_stamp_t    TimeStamp;       ///< Time stamp of the event's occurence.
124              int             iFragmentPos;    ///< Position in the current fragment this event refers to.              int32_t         iFragmentPos;    ///< Position in the current fragment this event refers to.
125      };      };
126    
127  } // namespace LinuxSampler  } // namespace LinuxSampler

Legend:
Removed from v.56  
changed lines
  Added in v.293

  ViewVC Help
Powered by ViewVC