framecnt_t readable_length() const { return _length; }
uint32_t n_channels() const { return 1; }
+ bool empty() const;
framecnt_t length (framepos_t pos) const;
void update_length (framepos_t pos, framecnt_t cnt);
virtual void append_event_unlocked_frames(const Evoral::Event<nframes_t>& ev,
sframes_t source_start) = 0;
- virtual sframes_t length (sframes_t pos) const;
- virtual void update_length (sframes_t pos, sframes_t cnt);
+ virtual bool empty () const;
+ virtual framecnt_t length (framepos_t pos) const;
+ virtual void update_length (framepos_t pos, framecnt_t cnt);
virtual void mark_streaming_midi_write_started (NoteMode mode, sframes_t start_time);
virtual void mark_streaming_write_started ();
time_t timestamp() const { return _timestamp; }
void stamp (time_t when) { _timestamp = when; }
+ virtual bool empty () const = 0;
virtual framecnt_t length (framepos_t pos) const = 0;
virtual void update_length (framepos_t pos, framecnt_t cnt) = 0;
return 0;
}
-sframes_t
-AudioSource::length (sframes_t /*pos*/) const
+bool
+AudioSource::empty () const
+{
+ return _length == 0;
+}
+
+framecnt_t
+AudioSource::length (framepos_t /*pos*/) const
{
return _length;
}
void
-AudioSource::update_length (sframes_t pos, sframes_t cnt)
+AudioSource::update_length (framepos_t pos, framecnt_t cnt)
{
if (pos + cnt > _length) {
_length = pos + cnt;
{
return (_flags & Removable)
&& ((_flags & RemoveAtDestroy) ||
- ((_flags & RemovableIfEmpty) && length(timeline_position()) == 0));
+ ((_flags & RemovableIfEmpty) && empty() == 0));
}
int
return 0;
}
-sframes_t
-MidiSource::length (sframes_t pos) const
+bool
+MidiSource::empty () const
{
+ return _length_beats == 0;
+}
+
+framecnt_t
+MidiSource::length (framepos_t pos) const
+{
+ if (_length_beats == 0) {
+ return 0;
+ }
+
BeatsFramesConverter converter(_session.tempo_map(), pos);
return converter.to(_length_beats);
}
and unused by any regions.
*/
- cerr << "Source " << siter->second->name() << " has UC = " << siter->second->used()
- << " length = " << siter->second->length (0)
- << endl;
-
boost::shared_ptr<FileSource> fs;
if ((fs = boost::dynamic_pointer_cast<FileSource> (siter->second)) != 0) {
if (!fs->destructive()) {
- if (fs->length(fs->timeline_position()) == 0 && !fs->used()) {
+ if (fs->empty() && !fs->used()) {
continue;
}
}