(Source List) Clean up the natural_position implementation (gtk2 part).

This commit is contained in:
Ben Loftis 2018-11-15 09:33:44 -06:00
parent bbe77c1c6a
commit 57dec7db2b
4 changed files with 17 additions and 9 deletions

View File

@ -350,12 +350,13 @@ EditorSources::populate_row (TreeModel::Row row, boost::shared_ptr<ARDOUR::Sourc
row[_columns.natural_s] = source->natural_position();
//Natural Position (text representation)
char buf[64];
snprintf(buf, 16, "--" );
if (source->natural_position() > 0) {
if (source->have_natural_position()) {
char buf[64];
format_position (source->natural_position(), buf, sizeof (buf));
row[_columns.natural_pos] = buf;
} else {
row[_columns.natural_pos] = X_("--");
}
row[_columns.natural_pos] = buf;
}
void
@ -380,13 +381,20 @@ EditorSources::source_changed (boost::shared_ptr<ARDOUR::Source> source)
{
TreeModel::iterator i;
TreeModel::Children rows = _model->children();
bool found = false;
for (i = rows.begin(); i != rows.end(); ++i) {
boost::shared_ptr<ARDOUR::Source> ss = (*i)[_columns.source];
if (source == ss) {
populate_row(*i, source);
found = true;
break;
}
}
if (!found) {
add_source (source);
}
}
void

View File

@ -990,7 +990,7 @@ ExportReport::audition (std::string path, unsigned n_chn, int page)
PBD::PropertyList plist;
plist.add (ARDOUR::Properties::start, 0);
plist.add (ARDOUR::Properties::length, srclist[0]->length(srclist[0]->timeline_position()));
plist.add (ARDOUR::Properties::length, srclist[0]->length(srclist[0]->natural_position()));
plist.add (ARDOUR::Properties::name, rname);
plist.add (ARDOUR::Properties::layer, 0);

View File

@ -4204,7 +4204,7 @@ MidiRegionView::data_recorded (boost::weak_ptr<MidiSource> w)
/* convert from session samples to source beats */
Temporal::Beats const time_beats = _source_relative_time_converter.from(
ev.time() - src->timeline_position() + _region->start());
ev.time() - src->natural_position() + _region->start());
if (ev.type() == MIDI_CMD_NOTE_ON) {
boost::shared_ptr<NoteType> note (

View File

@ -342,7 +342,7 @@ SoundFileBox::setup_labels (const string& filename)
channels_value.set_text (to_string(ms->num_tracks()));
}
}
length_clock.set (ms->length(ms->timeline_position()));
length_clock.set (ms->length(ms->natural_position()));
switch (ms->num_tempos()) {
case 0:
tempomap_value.set_text (_("No tempo data"));
@ -497,7 +497,7 @@ SoundFileBox::audition ()
PropertyList plist;
plist.add (ARDOUR::Properties::start, 0);
plist.add (ARDOUR::Properties::length, ms->length(ms->timeline_position()));
plist.add (ARDOUR::Properties::length, ms->length(ms->natural_position()));
plist.add (ARDOUR::Properties::name, rname);
plist.add (ARDOUR::Properties::layer, 0);
@ -546,7 +546,7 @@ SoundFileBox::audition ()
PropertyList plist;
plist.add (ARDOUR::Properties::start, 0);
plist.add (ARDOUR::Properties::length, srclist[0]->length(srclist[0]->timeline_position()));
plist.add (ARDOUR::Properties::length, srclist[0]->length(srclist[0]->natural_position()));
plist.add (ARDOUR::Properties::name, rname);
plist.add (ARDOUR::Properties::layer, 0);