mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-19 13:16:27 +01:00
libardour: remove _length_beats member from MidiSource and use Source::_length
timecnt_t can represent either time domain
This commit is contained in:
parent
9e58c43ecd
commit
a01bb90c04
2 changed files with 5 additions and 10 deletions
|
|
@ -172,9 +172,6 @@ class LIBARDOUR_API MidiSource : virtual public Source
|
||||||
|
|
||||||
bool length_mutable() const { return true; }
|
bool length_mutable() const { return true; }
|
||||||
|
|
||||||
void set_length_beats(TimeType l) { _length_beats = l; }
|
|
||||||
TimeType length_beats() const { return _length_beats; }
|
|
||||||
|
|
||||||
virtual void load_model(const Glib::Threads::Mutex::Lock& lock, bool force_reload=false) = 0;
|
virtual void load_model(const Glib::Threads::Mutex::Lock& lock, bool force_reload=false) = 0;
|
||||||
virtual void destroy_model(const Glib::Threads::Mutex::Lock& lock) = 0;
|
virtual void destroy_model(const Glib::Threads::Mutex::Lock& lock) = 0;
|
||||||
|
|
||||||
|
|
@ -235,8 +232,6 @@ class LIBARDOUR_API MidiSource : virtual public Source
|
||||||
boost::shared_ptr<MidiModel> _model;
|
boost::shared_ptr<MidiModel> _model;
|
||||||
bool _writing;
|
bool _writing;
|
||||||
|
|
||||||
Temporal::Beats _length_beats;
|
|
||||||
|
|
||||||
/** The total duration of the current capture. */
|
/** The total duration of the current capture. */
|
||||||
samplepos_t _capture_length;
|
samplepos_t _capture_length;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -442,7 +442,7 @@ SMFSource::append_event_beats (const Glib::Threads::Mutex::Lock& lock,
|
||||||
_model->append (ev, event_id);
|
_model->append (ev, event_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
_length_beats = max(_length_beats, time);
|
_length = max (_length, timecnt_t (time));
|
||||||
|
|
||||||
const Temporal::Beats delta_time_beats = time - _last_ev_time_beats;
|
const Temporal::Beats delta_time_beats = time - _last_ev_time_beats;
|
||||||
const uint32_t delta_time_ticks = delta_time_beats.to_ticks(ppqn());
|
const uint32_t delta_time_ticks = delta_time_beats.to_ticks(ppqn());
|
||||||
|
|
@ -495,7 +495,7 @@ SMFSource::append_event_samples (const Glib::Threads::Mutex::Lock& lock,
|
||||||
_model->append (beat_ev, event_id);
|
_model->append (beat_ev, event_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
_length_beats = max(_length_beats, ev_time_beats);
|
_length = max (_length, timecnt_t (ev_time_beats, timepos_t (position)));
|
||||||
|
|
||||||
/* a distance measure that starts at @param _last_ev_time_samples (audio time) and
|
/* a distance measure that starts at @param _last_ev_time_samples (audio time) and
|
||||||
extends for ev.time() (audio time)
|
extends for ev.time() (audio time)
|
||||||
|
|
@ -715,7 +715,7 @@ SMFSource::load_model (const Glib::Threads::Mutex::Lock& lock, bool force_reload
|
||||||
scratch_size = std::max(size, scratch_size);
|
scratch_size = std::max(size, scratch_size);
|
||||||
size = scratch_size;
|
size = scratch_size;
|
||||||
|
|
||||||
_length_beats = max(_length_beats, event_time);
|
_length = max (_length, timecnt_t (event_time));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* event ID's must immediately precede the event they are for */
|
/* event ID's must immediately precede the event they are for */
|
||||||
|
|
@ -735,7 +735,7 @@ SMFSource::load_model (const Glib::Threads::Mutex::Lock& lock, bool force_reload
|
||||||
// _playback_buf->dump (cerr);
|
// _playback_buf->dump (cerr);
|
||||||
// cerr << "----------------\n";
|
// cerr << "----------------\n";
|
||||||
|
|
||||||
_model->end_write (Evoral::Sequence<Temporal::Beats>::ResolveStuckNotes, _length_beats);
|
_model->end_write (Evoral::Sequence<Temporal::Beats>::ResolveStuckNotes, _length.beats());
|
||||||
_model->set_edited (false);
|
_model->set_edited (false);
|
||||||
invalidate(lock);
|
invalidate(lock);
|
||||||
|
|
||||||
|
|
@ -753,7 +753,7 @@ SMFSource::destroy_model (const Glib::Threads::Mutex::Lock& lock)
|
||||||
void
|
void
|
||||||
SMFSource::flush_midi (const Lock& lock)
|
SMFSource::flush_midi (const Lock& lock)
|
||||||
{
|
{
|
||||||
if (!writable() || _length_beats == 0.0) {
|
if (!writable() || _length.zero()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue