13
0

Simplify slightly odd update_length() signature.

git-svn-id: svn://localhost/ardour2/branches/3.0@11900 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2012-04-11 15:47:33 +00:00
parent 9b6c41c134
commit 3f647a9dcd
7 changed files with 10 additions and 12 deletions

View File

@ -51,7 +51,7 @@ class AudioSource : virtual public Source,
virtual bool empty() const;
framecnt_t length (framepos_t pos) const;
void update_length (framepos_t pos, framecnt_t cnt);
void update_length (framecnt_t cnt);
virtual framecnt_t available_peaks (double zoom) const;

View File

@ -76,7 +76,7 @@ class MidiSource : virtual public Source, public boost::enable_shared_from_this<
virtual bool empty () const;
virtual framecnt_t length (framepos_t pos) const;
virtual void update_length (framepos_t pos, framecnt_t cnt);
virtual void update_length (framecnt_t);
virtual void mark_streaming_midi_write_started (NoteMode mode);
virtual void mark_streaming_write_started ();

View File

@ -62,7 +62,7 @@ class Source : public SessionObject
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;
virtual void update_length (framecnt_t cnt) = 0;
virtual framepos_t natural_position() const { return 0; }

View File

@ -139,10 +139,10 @@ AudioSource::length (framepos_t /*pos*/) const
}
void
AudioSource::update_length (framepos_t pos, framecnt_t cnt)
AudioSource::update_length (framecnt_t len)
{
if (pos + cnt > _length) {
_length = pos + cnt;
if (len > _length) {
_length = len;
}
}

View File

@ -436,7 +436,7 @@ write_midi_data_to_new_files (Evoral::SMF* source, ImportStatus& status,
const framepos_t pos = 0;
const double length_beats = ceil(t / (double)source->ppqn());
BeatsFramesConverter converter(smfs->session().tempo_map(), pos);
smfs->update_length(pos, converter.to(length_beats));
smfs->update_length(pos + converter.to(length_beats));
smfs->mark_streaming_write_completed ();
if (status.cancel) {

View File

@ -176,7 +176,7 @@ MidiSource::length (framepos_t pos) const
}
void
MidiSource::update_length (framepos_t /*pos*/, framecnt_t /*cnt*/)
MidiSource::update_length (framecnt_t)
{
// You're not the boss of me!
}

View File

@ -393,15 +393,13 @@ SndFileSource::nondestructive_write_unlocked (Sample *data, framecnt_t cnt)
return 0;
}
framecnt_t oldlen;
int32_t frame_pos = _length;
if (write_float (data, frame_pos, cnt) != cnt) {
return 0;
}
oldlen = _length;
update_length (oldlen, cnt);
update_length (_length + cnt);
if (_build_peakfiles) {
compute_and_write_peaks (data, frame_pos, cnt, false, true);
@ -488,7 +486,7 @@ SndFileSource::destructive_write_unlocked (Sample* data, framecnt_t cnt)
}
}
update_length (file_pos, cnt);
update_length (file_pos + cnt);
if (_build_peakfiles) {
compute_and_write_peaks (data, file_pos, cnt, false, true);