small cleanup to Source length API

This commit is contained in:
Paul Davis 2020-12-08 11:35:13 -07:00
parent 6c6d7fa874
commit 0d15797499
4 changed files with 8 additions and 16 deletions

View file

@ -39,14 +39,13 @@ struct MidiCursor : public boost::noncopyable {
void connect(PBD::Signal1<void, bool>& invalidated) {
connections.drop_connections();
invalidated.connect_same_thread(
connections, boost::bind(&MidiCursor::invalidate, this, _1));
invalidated.connect_same_thread (connections, boost::bind(&MidiCursor::invalidate, this, _1));
}
void invalidate(bool preserve_notes) {
iter.invalidate(preserve_notes ? &active_notes : NULL);
#warning NUTEMPO this locks last_read_end to BeatTime which may not be good
last_read_end = Temporal::timepos_t (Temporal::BeatTime);
iter.invalidate (preserve_notes ? &active_notes : NULL);
/* maintain time domain while resetting to zero */
last_read_end = Temporal::timepos_t (last_read_end.time_domain());
}
Evoral::Sequence<Temporal::Beats>::const_iterator iter;

View file

@ -74,10 +74,10 @@ public:
time_t timestamp() const { return _timestamp; }
void stamp (time_t when) { _timestamp = when; }
timecnt_t length() const;
timecnt_t length() const { return _length; }
samplecnt_t length_samples () const { return _length.samples(); };
virtual bool empty () const;
virtual samplecnt_t length_samples (timepos_t const & pos) const { return _length.samples(); };
virtual void update_length (timecnt_t const & cnt) {}
void set_take_id (std::string id) { _take_id =id; }

View file

@ -43,8 +43,8 @@ public:
float sample_rate () const { return _session.nominal_sample_rate(); }
timepos_t natural_position() const { return _source->natural_position() * _ratio;}
samplecnt_t readable_length_samples() const { return _source->length_samples (timepos_t (Temporal::AudioTime)) * _ratio; }
samplecnt_t length (samplepos_t /*pos*/) const { return _source->length_samples (timepos_t (Temporal::AudioTime)) * _ratio; }
samplecnt_t readable_length_samples() const { return _source->length_samples () * _ratio; }
samplecnt_t length (samplepos_t /*pos*/) const { return _source->length_samples () * _ratio; }
bool can_be_analysed() const { return false; }
bool clamped_at_unity() const { return false; }

View file

@ -513,10 +513,3 @@ Source::empty () const
{
return _length == timecnt_t();
}
timecnt_t
Source::length() const
{
return _length;
}