42 |
event_type_note_on, |
event_type_note_on, |
43 |
event_type_note_off, |
event_type_note_off, |
44 |
event_type_pitchbend, |
event_type_pitchbend, |
45 |
event_type_control_change |
event_type_control_change, |
46 |
|
event_type_cancel_release, ///< transformed either from a note-on or sustain-pedal-down event |
47 |
|
event_type_release ///< transformed either from a note-off or sustain-pedal-up event |
48 |
}; |
}; |
49 |
class Event { |
class Event { |
50 |
public: |
public: |
62 |
Event() { |
Event() { |
63 |
TimeStamp = ModulationSystem::CreateTimeStamp(); |
TimeStamp = ModulationSystem::CreateTimeStamp(); |
64 |
iFragmentPos = -1; |
iFragmentPos = -1; |
65 |
}; |
} |
66 |
uint FragmentPos() { |
inline uint FragmentPos() { |
67 |
if (iFragmentPos >= 0) return (uint) iFragmentPos; |
if (iFragmentPos >= 0) return (uint) iFragmentPos; |
68 |
return (uint) (iFragmentPos = ModulationSystem::ToFragmentPos(TimeStamp)); |
return (uint) (iFragmentPos = ModulationSystem::ToFragmentPos(TimeStamp)); |
69 |
}; |
} |
70 |
private: |
private: |
71 |
real_time_t TimeStamp; ///< Time stamp of the event's occurence. |
real_time_t TimeStamp; ///< Time stamp of the event's occurence. |
72 |
int iFragmentPos; ///< Position in the current fragment this event refers to. |
int iFragmentPos; ///< Position in the current fragment this event refers to. |
79 |
static void ResetDestinationParameter(ModulationSystem::destination_t dst, float val); |
static void ResetDestinationParameter(ModulationSystem::destination_t dst, float val); |
80 |
static void UpdateFragmentTime(); |
static void UpdateFragmentTime(); |
81 |
static real_time_t CreateTimeStamp(); |
static real_time_t CreateTimeStamp(); |
82 |
static inline uint MaxSamplesPerCycle() { return uiMaxSamplesPerCycle; }; |
static inline uint MaxSamplesPerCycle() { return uiMaxSamplesPerCycle; } |
83 |
static inline uint SampleRate() { return uiSampleRate; }; |
static inline uint SampleRate() { return uiSampleRate; } |
84 |
static inline uint ToFragmentPos(real_time_t time_stamp) { |
static inline uint ToFragmentPos(real_time_t time_stamp) { |
85 |
return uint ((time_stamp - FragmentTime.begin) * FragmentTime.sample_ratio); |
return uint ((time_stamp - FragmentTime.begin) * FragmentTime.sample_ratio); |
86 |
}; |
} |
87 |
protected: |
protected: |
88 |
static uint uiMaxSamplesPerCycle; |
static uint uiMaxSamplesPerCycle; |
89 |
static uint uiSampleRate; |
static uint uiSampleRate; |