24 |
#define __LS_EVENT_H__ |
#define __LS_EVENT_H__ |
25 |
|
|
26 |
#include "../../common/global.h" |
#include "../../common/global.h" |
27 |
|
#include "../../common/RTMath.h" |
28 |
|
#include "EngineChannel.h" |
29 |
|
|
30 |
namespace LinuxSampler { |
namespace LinuxSampler { |
31 |
|
|
42 |
void UpdateFragmentTime(uint SamplesToProcess); |
void UpdateFragmentTime(uint SamplesToProcess); |
43 |
Event CreateEvent(); |
Event CreateEvent(); |
44 |
protected: |
protected: |
45 |
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 RTMath::time_stamp_t time_stamp_t; |
46 |
inline int32_t ToFragmentPos(time_stamp_t TimeStamp) { |
inline int32_t ToFragmentPos(time_stamp_t TimeStamp) { |
47 |
return int32_t (int32_t(TimeStamp - FragmentTime.begin) * FragmentTime.sample_ratio); |
return int32_t (int32_t(TimeStamp - FragmentTime.begin) * FragmentTime.sample_ratio); |
48 |
} |
} |
55 |
time_stamp_t end; ///< Real time stamp of the end of this audio fragment cycle. |
time_stamp_t end; ///< Real time stamp of the end of this audio fragment cycle. |
56 |
float sample_ratio; ///< (Samples per cycle) / (Real time duration of cycle) |
float sample_ratio; ///< (Samples per cycle) / (Real time duration of cycle) |
57 |
} FragmentTime; |
} FragmentTime; |
|
time_stamp_t CreateTimeStamp(); |
|
58 |
}; |
}; |
59 |
|
|
60 |
/** |
/** |
105 |
uint Size; ///< Data length (in bytes) of MIDI system exclusive message. |
uint Size; ///< Data length (in bytes) of MIDI system exclusive message. |
106 |
} Sysex; |
} Sysex; |
107 |
} Param; |
} Param; |
108 |
|
EngineChannel* pEngineChannel; ///< Pointer to the EngineChannel where this event occured on, NULL means Engine global event (e.g. SysEx message). |
109 |
|
|
110 |
inline int32_t FragmentPos() { |
inline int32_t FragmentPos() { |
111 |
if (iFragmentPos >= 0) return iFragmentPos; |
if (iFragmentPos >= 0) return iFragmentPos; |