Note the time of the last event that was read by read_unlocked, so that the current time can be reset on a subsequent call.
git-svn-id: svn://localhost/ardour2/branches/3.0@7148 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
a4664d68c0
commit
dd134d8afb
|
@ -86,7 +86,10 @@ private:
|
||||||
|
|
||||||
double _last_ev_time_beats;
|
double _last_ev_time_beats;
|
||||||
sframes_t _last_ev_time_frames;
|
sframes_t _last_ev_time_frames;
|
||||||
|
/** end time (start + duration) of last call to read_unlocked */
|
||||||
mutable sframes_t _smf_last_read_end;
|
mutable sframes_t _smf_last_read_end;
|
||||||
|
/** time (in SMF ticks, 1 tick per _ppqn) of the last event read by read_unlocked */
|
||||||
|
mutable sframes_t _smf_last_read_time;
|
||||||
};
|
};
|
||||||
|
|
||||||
}; /* namespace ARDOUR */
|
}; /* namespace ARDOUR */
|
||||||
|
|
|
@ -56,6 +56,7 @@ SMFSource::SMFSource (Session& s, const ustring& path, Source::Flag flags)
|
||||||
, _last_ev_time_beats(0.0)
|
, _last_ev_time_beats(0.0)
|
||||||
, _last_ev_time_frames(0)
|
, _last_ev_time_frames(0)
|
||||||
, _smf_last_read_end (0)
|
, _smf_last_read_end (0)
|
||||||
|
, _smf_last_read_time (0)
|
||||||
{
|
{
|
||||||
if (init(_path, false)) {
|
if (init(_path, false)) {
|
||||||
throw failed_constructor ();
|
throw failed_constructor ();
|
||||||
|
@ -76,6 +77,7 @@ SMFSource::SMFSource (Session& s, const XMLNode& node, bool must_exist)
|
||||||
, _last_ev_time_beats(0.0)
|
, _last_ev_time_beats(0.0)
|
||||||
, _last_ev_time_frames(0)
|
, _last_ev_time_frames(0)
|
||||||
, _smf_last_read_end (0)
|
, _smf_last_read_end (0)
|
||||||
|
, _smf_last_read_time (0)
|
||||||
{
|
{
|
||||||
if (set_state(node, Stateful::loading_state_version)) {
|
if (set_state(node, Stateful::loading_state_version)) {
|
||||||
throw failed_constructor ();
|
throw failed_constructor ();
|
||||||
|
@ -134,6 +136,8 @@ SMFSource::read_unlocked (Evoral::EventSink<nframes_t>& destination, sframes_t s
|
||||||
}
|
}
|
||||||
time += ev_delta_t; // accumulate delta time
|
time += ev_delta_t; // accumulate delta time
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
time = _smf_last_read_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
_smf_last_read_end = start + duration;
|
_smf_last_read_end = start + duration;
|
||||||
|
@ -145,6 +149,7 @@ SMFSource::read_unlocked (Evoral::EventSink<nframes_t>& destination, sframes_t s
|
||||||
}
|
}
|
||||||
|
|
||||||
time += ev_delta_t; // accumulate delta time
|
time += ev_delta_t; // accumulate delta time
|
||||||
|
_smf_last_read_time = time;
|
||||||
|
|
||||||
if (ret == 0) { // meta-event (skipped, just accumulate time)
|
if (ret == 0) { // meta-event (skipped, just accumulate time)
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user