mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 06:44:57 +01:00
(Source List) Clean up the natural_position implementation (libardour part).
This commit is contained in:
parent
77950c36c5
commit
edde5d64a2
24 changed files with 91 additions and 74 deletions
|
|
@ -97,7 +97,7 @@ Analyser::work ()
|
|||
|
||||
boost::shared_ptr<AudioFileSource> afs = boost::dynamic_pointer_cast<AudioFileSource> (src);
|
||||
|
||||
if (afs && afs->length(afs->timeline_position())) {
|
||||
if (afs && afs->length(afs->natural_position())) {
|
||||
Glib::Threads::Mutex::Lock lm (analysis_active_lock);
|
||||
analyse_audio_file_source (afs);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ protected:
|
|||
|
||||
int init (const std::string& idstr, bool must_exist);
|
||||
|
||||
virtual void set_header_timeline_position () = 0;
|
||||
virtual void set_header_natural_position () = 0;
|
||||
virtual void handle_header_position_change () {}
|
||||
|
||||
int move_dependents_to_trash();
|
||||
|
|
|
|||
|
|
@ -43,7 +43,6 @@ class LIBARDOUR_API CAImportableSource : public ImportableSource {
|
|||
samplecnt_t length() const;
|
||||
samplecnt_t samplerate() const;
|
||||
void seek (samplepos_t pos);
|
||||
samplepos_t natural_position() const { return 0; }
|
||||
bool clamped_at_unity () const { return false; }
|
||||
|
||||
protected:
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ class LIBARDOUR_API CoreAudioSource : public AudioFileSource {
|
|||
uint32_t channel_count () const { return n_channels; }
|
||||
|
||||
int flush_header () {return 0;};
|
||||
void set_header_timeline_position () {};
|
||||
void set_header_natural_position () {};
|
||||
bool clamped_at_unity () const { return false; }
|
||||
|
||||
void flush () {}
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ protected:
|
|||
|
||||
samplecnt_t write_unlocked (Sample */*dst*/, samplecnt_t /*cnt*/) { return 0; }
|
||||
|
||||
void set_header_timeline_position () {}
|
||||
void set_header_natural_position () {}
|
||||
|
||||
int read_peaks_with_fpp (PeakData *peaks, samplecnt_t npeaks, samplepos_t /*start*/, samplecnt_t /*cnt*/,
|
||||
double /*samples_per_pixel*/, samplecnt_t /*fpp*/) const {
|
||||
|
|
|
|||
|
|
@ -37,9 +37,9 @@ public:
|
|||
uint32_t channels() const;
|
||||
samplecnt_t length() const;
|
||||
samplecnt_t samplerate() const;
|
||||
void seek (samplepos_t pos);
|
||||
samplepos_t natural_position() const;
|
||||
bool clamped_at_unity () const;
|
||||
void seek (samplepos_t pos);
|
||||
bool clamped_at_unity () const;
|
||||
samplepos_t natural_position () const;
|
||||
|
||||
protected:
|
||||
SF_INFO sf_info;
|
||||
|
|
|
|||
|
|
@ -60,8 +60,6 @@ class LIBARDOUR_API SndFileSource : public AudioFileSource {
|
|||
int flush_header ();
|
||||
void flush ();
|
||||
|
||||
samplepos_t natural_position () const;
|
||||
|
||||
samplepos_t last_capture_start_sample() const;
|
||||
void mark_capture_start (samplepos_t);
|
||||
void mark_capture_end ();
|
||||
|
|
@ -81,7 +79,7 @@ class LIBARDOUR_API SndFileSource : public AudioFileSource {
|
|||
void close ();
|
||||
|
||||
void set_path (const std::string& p);
|
||||
void set_header_timeline_position ();
|
||||
void set_header_natural_position ();
|
||||
|
||||
samplecnt_t read_unlocked (Sample *dst, samplepos_t start, samplecnt_t cnt) const;
|
||||
samplecnt_t write_unlocked (Sample *dst, samplecnt_t cnt);
|
||||
|
|
@ -111,7 +109,7 @@ class LIBARDOUR_API SndFileSource : public AudioFileSource {
|
|||
Sample* xfade_buf;
|
||||
|
||||
samplecnt_t crossfade (Sample* data, samplecnt_t cnt, int dir);
|
||||
void set_timeline_position (samplepos_t);
|
||||
void set_natural_position (samplepos_t);
|
||||
samplecnt_t destructive_write_unlocked (Sample *dst, samplecnt_t cnt);
|
||||
samplecnt_t nondestructive_write_unlocked (Sample *dst, samplecnt_t cnt);
|
||||
void handle_header_position_change ();
|
||||
|
|
|
|||
|
|
@ -74,8 +74,6 @@ public:
|
|||
void set_take_id (std::string id) { _take_id =id; }
|
||||
const std::string& take_id () const { return _take_id; }
|
||||
|
||||
virtual samplepos_t natural_position() const { return 0; }
|
||||
|
||||
void mark_for_remove();
|
||||
|
||||
virtual void mark_streaming_write_started (const Lock& lock) {}
|
||||
|
|
@ -104,8 +102,9 @@ public:
|
|||
std::string get_transients_path() const;
|
||||
int load_transients (const std::string&);
|
||||
|
||||
samplepos_t timeline_position() const { return _timeline_position; }
|
||||
virtual void set_timeline_position (samplepos_t pos);
|
||||
virtual samplepos_t natural_position() const { return _natural_position; }
|
||||
virtual void set_natural_position (samplepos_t pos);
|
||||
bool have_natural_position() const { return _have_natural_position; }
|
||||
|
||||
void set_allow_remove_if_empty (bool yn);
|
||||
|
||||
|
|
@ -129,7 +128,8 @@ public:
|
|||
Flag _flags;
|
||||
time_t _timestamp;
|
||||
std::string _take_id;
|
||||
samplepos_t _timeline_position;
|
||||
samplepos_t _natural_position;
|
||||
samplepos_t _have_natural_position;
|
||||
bool _analysed;
|
||||
mutable Glib::Threads::Mutex _lock;
|
||||
mutable Glib::Threads::Mutex _analysis_lock;
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ public:
|
|||
int update_header (samplepos_t /*when*/, struct tm&, time_t) { return 0; }
|
||||
int flush_header () { return 0; }
|
||||
void flush () { }
|
||||
void set_header_timeline_position () {};
|
||||
void set_header_natural_position () {};
|
||||
void set_length (samplecnt_t /*len*/) {};
|
||||
|
||||
float sample_rate () const { return _session.nominal_sample_rate(); }
|
||||
|
|
|
|||
|
|
@ -441,7 +441,7 @@ AudioTrack::freeze_me (InterThreadInfo& itt)
|
|||
PropertyList plist;
|
||||
|
||||
plist.add (Properties::start, 0);
|
||||
plist.add (Properties::length, srcs[0]->length(srcs[0]->timeline_position()));
|
||||
plist.add (Properties::length, srcs[0]->length(srcs[0]->natural_position()));
|
||||
plist.add (Properties::name, region_name);
|
||||
plist.add (Properties::whole_file, true);
|
||||
|
||||
|
|
|
|||
|
|
@ -462,7 +462,7 @@ AudioRegion::master_read_at (Sample *buf, Sample* /*mixdown_buffer*/, float* /*g
|
|||
|
||||
assert (cnt >= 0);
|
||||
return read_from_sources (
|
||||
_master_sources, _master_sources.front()->length (_master_sources.front()->timeline_position()),
|
||||
_master_sources, _master_sources.front()->length (_master_sources.front()->natural_position()),
|
||||
buf, position, cnt, chan_n
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -267,7 +267,7 @@ AudioSource::initialize_peakfile (const string& audio_path, const bool in_sessio
|
|||
|
||||
/* we found it in the peaks dir, so check it out */
|
||||
|
||||
if (statbuf.st_size == 0 || (statbuf.st_size < (off_t) ((length(_timeline_position) / _FPP) * sizeof (PeakData)))) {
|
||||
if (statbuf.st_size == 0 || (statbuf.st_size < (off_t) ((length(_natural_position) / _FPP) * sizeof (PeakData)))) {
|
||||
DEBUG_TRACE(DEBUG::Peaks, string_compose("Peakfile %1 is empty\n", _peakpath));
|
||||
_peaks_built = false;
|
||||
} else {
|
||||
|
|
@ -1066,7 +1066,7 @@ samplecnt_t
|
|||
AudioSource::available_peaks (double zoom_factor) const
|
||||
{
|
||||
if (zoom_factor < _FPP) {
|
||||
return length(_timeline_position); // peak data will come from the audio file
|
||||
return length(_natural_position); // peak data will come from the audio file
|
||||
}
|
||||
|
||||
/* peak data comes from peakfile, but the filesize might not represent
|
||||
|
|
|
|||
|
|
@ -328,7 +328,7 @@ void
|
|||
DiskWriter::non_realtime_locate (samplepos_t position)
|
||||
{
|
||||
if (_midi_write_source) {
|
||||
_midi_write_source->set_timeline_position (position);
|
||||
_midi_write_source->set_natural_position (position);
|
||||
}
|
||||
|
||||
DiskIOProcessor::non_realtime_locate (position);
|
||||
|
|
@ -1219,9 +1219,7 @@ DiskWriter::transport_stopped_wallclock (struct tm& when, time_t twhen, bool abo
|
|||
char buf[128];
|
||||
strftime (buf, sizeof(buf), "%F %H.%M.%S", &when);
|
||||
as->set_take_id ( buf );
|
||||
|
||||
Source::SourcePropertyChanged(as);
|
||||
|
||||
|
||||
if (Config->get_auto_analyse_audio()) {
|
||||
Analyser::queue_source_for_analysis (as, true);
|
||||
}
|
||||
|
|
@ -1232,6 +1230,11 @@ DiskWriter::transport_stopped_wallclock (struct tm& when, time_t twhen, bool abo
|
|||
if (_midi_write_source) {
|
||||
midi_srcs.push_back (_midi_write_source);
|
||||
}
|
||||
|
||||
(*chan)->write_source->stamp (twhen);
|
||||
|
||||
/* "re-announce the source to the world */
|
||||
Source::SourcePropertyChanged ((*chan)->write_source);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1261,7 +1264,7 @@ DiskWriter::transport_stopped_wallclock (struct tm& when, time_t twhen, bool abo
|
|||
|
||||
midi_srcs.push_back (_midi_write_source);
|
||||
|
||||
_midi_write_source->set_timeline_position (capture_info.front()->start);
|
||||
_midi_write_source->set_natural_position (capture_info.front()->start);
|
||||
_midi_write_source->set_captured_for (_name);
|
||||
|
||||
char buf[128];
|
||||
|
|
|
|||
|
|
@ -116,8 +116,6 @@ FileSource::removable () const
|
|||
int
|
||||
FileSource::init (const string& pathstr, bool must_exist)
|
||||
{
|
||||
_timeline_position = 0;
|
||||
|
||||
if (Stateful::loading_state_version < 3000) {
|
||||
if (!find_2X (_session, _type, pathstr, must_exist, _file_is_new, _channel, _path)) {
|
||||
throw MissingSource (pathstr, _type);
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ Filter::finish (boost::shared_ptr<Region> region, SourceList& nsrcs, string regi
|
|||
|
||||
boost::shared_ptr<SMFSource> smfs = boost::dynamic_pointer_cast<SMFSource>(*si);
|
||||
if (smfs) {
|
||||
smfs->set_timeline_position (region->position());
|
||||
smfs->set_natural_position (region->position());
|
||||
smfs->flush ();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -184,7 +184,7 @@ static bool
|
|||
create_mono_sources_for_writing (const vector<string>& new_paths,
|
||||
Session& sess, uint32_t samplerate,
|
||||
vector<boost::shared_ptr<Source> >& newfiles,
|
||||
samplepos_t timeline_position)
|
||||
samplepos_t natural_position)
|
||||
{
|
||||
for (vector<string>::const_iterator i = new_paths.begin(); i != new_paths.end(); ++i) {
|
||||
|
||||
|
|
@ -212,7 +212,7 @@ create_mono_sources_for_writing (const vector<string>& new_paths,
|
|||
|
||||
boost::shared_ptr<AudioFileSource> afs;
|
||||
if ((afs = boost::dynamic_pointer_cast<AudioFileSource>(source)) != 0) {
|
||||
afs->set_timeline_position(timeline_position);
|
||||
afs->set_natural_position (natural_position);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -1285,7 +1285,7 @@ LuaBindings::common (lua_State* L)
|
|||
.addFunction ("writable", &Source::writable)
|
||||
.addFunction ("has_been_analysed", &Source::has_been_analysed)
|
||||
.addFunction ("can_be_analysed", &Source::can_be_analysed)
|
||||
.addFunction ("timeline_position", &Source::timeline_position)
|
||||
.addFunction ("timeline_position", &Source::natural_position) /* duplicate */
|
||||
.addFunction ("use_count", &Source::use_count)
|
||||
.addFunction ("used", &Source::used)
|
||||
.addFunction ("ancestor_name", &Source::ancestor_name)
|
||||
|
|
|
|||
|
|
@ -352,7 +352,7 @@ MidiSource::mark_write_starting_now (samplecnt_t position,
|
|||
because it is not RT-safe.
|
||||
*/
|
||||
|
||||
set_timeline_position(position);
|
||||
set_natural_position (position);
|
||||
_capture_length = capture_length;
|
||||
_capture_loop_length = loop_length;
|
||||
|
||||
|
|
@ -417,7 +417,7 @@ MidiSource::write_to (const Lock& lock, boost::shared_ptr<MidiSource> newsrc, Te
|
|||
{
|
||||
Lock newsrc_lock (newsrc->mutex ());
|
||||
|
||||
newsrc->set_timeline_position (_timeline_position);
|
||||
newsrc->set_natural_position (_natural_position);
|
||||
newsrc->copy_interpolation_from (this);
|
||||
newsrc->copy_automation_state_from (this);
|
||||
|
||||
|
|
|
|||
|
|
@ -194,7 +194,7 @@ RegionFactory::create (boost::shared_ptr<Region> region, const SourceList& srcs,
|
|||
|
||||
if ((other = boost::dynamic_pointer_cast<AudioRegion>(region)) != 0) {
|
||||
|
||||
// XXX use me in caller where plist is setup, this is start i think srcs.front()->length (srcs.front()->timeline_position())
|
||||
// XXX use me in caller where plist is setup, this is start i think srcs.front()->length (srcs.front()->natural_position())
|
||||
|
||||
ret = boost::shared_ptr<Region> (new AudioRegion (other, srcs));
|
||||
|
||||
|
|
|
|||
|
|
@ -6274,7 +6274,7 @@ Session::write_one_track (Track& track, samplepos_t start, samplepos_t end,
|
|||
if (!endpoint || for_export) {
|
||||
ev.set_time(ev.time() - position);
|
||||
}
|
||||
ms->append_event_samples(lock, ev, ms->timeline_position());
|
||||
ms->append_event_samples(lock, ev, ms->natural_position());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -6328,7 +6328,7 @@ Session::write_one_track (Track& track, samplepos_t start, samplepos_t end,
|
|||
PropertyList plist;
|
||||
|
||||
plist.add (Properties::start, 0);
|
||||
plist.add (Properties::length, srcs.front()->length(srcs.front()->timeline_position()));
|
||||
plist.add (Properties::length, srcs.front()->length(srcs.front()->natural_position()));
|
||||
plist.add (Properties::name, region_name_from_path (srcs.front()->name(), true));
|
||||
|
||||
result = RegionFactory::create (srcs, plist);
|
||||
|
|
|
|||
|
|
@ -3411,7 +3411,7 @@ Session::cleanup_sources (CleanupReport& rep)
|
|||
* capture files.
|
||||
*/
|
||||
|
||||
if (!i->second->used() && (i->second->length(i->second->timeline_position()) > 0)) {
|
||||
if (!i->second->used() && (i->second->length(i->second->natural_position()) > 0)) {
|
||||
dead_sources.push_back (i->second);
|
||||
i->second->drop_references ();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -350,7 +350,7 @@ SndFileSource::init_sndfile ()
|
|||
|
||||
if (destructive()) {
|
||||
xfade_buf = new Sample[xfade_samples];
|
||||
_timeline_position = header_position_offset;
|
||||
_natural_position = header_position_offset;
|
||||
}
|
||||
|
||||
AudioFileSource::HeaderPositionOffsetChanged.connect_same_thread (header_position_connection, boost::bind (&SndFileSource::handle_header_position_change, this));
|
||||
|
|
@ -447,15 +447,22 @@ SndFileSource::open ()
|
|||
|
||||
if (_file_is_new && _length == 0 && writable() && !bwf_info_exists) {
|
||||
/* newly created files will not have a BWF header at this point in time.
|
||||
* Import will have called Source::set_timeline_position() if one exists
|
||||
* Import will have called Source::set_natural_position() if one exists
|
||||
* in the original. */
|
||||
header_position_offset = _timeline_position;
|
||||
header_position_offset = _natural_position;
|
||||
}
|
||||
|
||||
/* Set our timeline position to either the time reference from a BWF header or the current
|
||||
start of the session.
|
||||
*/
|
||||
set_timeline_position (bwf_info_exists ? _broadcast_info->get_time_reference() : header_position_offset);
|
||||
if (destructive()) {
|
||||
/* Set our timeline position to either the time reference from a BWF header or the current
|
||||
start of the session.
|
||||
*/
|
||||
set_natural_position (bwf_info_exists ? _broadcast_info->get_time_reference() : header_position_offset);
|
||||
} else {
|
||||
/* If a BWF header exists, set our _natural_position from it */
|
||||
if (bwf_info_exists) {
|
||||
set_natural_position (_broadcast_info->get_time_reference());
|
||||
}
|
||||
}
|
||||
|
||||
if (_length != 0 && !bwf_info_exists) {
|
||||
delete _broadcast_info;
|
||||
|
|
@ -668,7 +675,7 @@ SndFileSource::destructive_write_unlocked (Sample* data, samplecnt_t cnt)
|
|||
_capture_end = false;
|
||||
|
||||
/* move to the correct location place */
|
||||
file_pos = capture_start_sample - _timeline_position;
|
||||
file_pos = capture_start_sample - _natural_position;
|
||||
|
||||
// split cnt in half
|
||||
samplecnt_t subcnt = cnt / 2;
|
||||
|
|
@ -700,7 +707,7 @@ SndFileSource::destructive_write_unlocked (Sample* data, samplecnt_t cnt)
|
|||
_capture_end = false;
|
||||
|
||||
/* move to the correct location place */
|
||||
file_pos = capture_start_sample - _timeline_position;
|
||||
file_pos = capture_start_sample - _natural_position;
|
||||
|
||||
if (crossfade (data, cnt, 1) != cnt) {
|
||||
return 0;
|
||||
|
|
@ -742,7 +749,7 @@ SndFileSource::destructive_write_unlocked (Sample* data, samplecnt_t cnt)
|
|||
int
|
||||
SndFileSource::update_header (samplepos_t when, struct tm& now, time_t tnow)
|
||||
{
|
||||
set_timeline_position (when);
|
||||
set_natural_position (when);
|
||||
|
||||
if (_flags & Broadcast) {
|
||||
if (setup_broadcast_info (when, now, tnow)) {
|
||||
|
|
@ -810,20 +817,20 @@ SndFileSource::setup_broadcast_info (samplepos_t /*when*/, struct tm& now, time_
|
|||
|
||||
/* now update header position taking header offset into account */
|
||||
|
||||
set_header_timeline_position ();
|
||||
set_header_natural_position ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
SndFileSource::set_header_timeline_position ()
|
||||
SndFileSource::set_header_natural_position ()
|
||||
{
|
||||
if (!(_flags & Broadcast)) {
|
||||
return;
|
||||
}
|
||||
assert (_broadcast_info);
|
||||
|
||||
_broadcast_info->set_time_reference (_timeline_position);
|
||||
_broadcast_info->set_time_reference (_natural_position);
|
||||
|
||||
if (_sndfile == 0 || !_broadcast_info->write_to_file (_sndfile)) {
|
||||
error << string_compose (_("cannot set broadcast info for audio file %1 (%2); dropping broadcast info for this file"),
|
||||
|
|
@ -855,12 +862,6 @@ SndFileSource::write_float (Sample* data, samplepos_t sample_pos, samplecnt_t cn
|
|||
return cnt;
|
||||
}
|
||||
|
||||
samplepos_t
|
||||
SndFileSource::natural_position() const
|
||||
{
|
||||
return _timeline_position;
|
||||
}
|
||||
|
||||
void
|
||||
SndFileSource::clear_capture_marks ()
|
||||
{
|
||||
|
|
@ -873,7 +874,7 @@ void
|
|||
SndFileSource::mark_capture_start (samplepos_t pos)
|
||||
{
|
||||
if (destructive()) {
|
||||
if (pos < _timeline_position) {
|
||||
if (pos < _natural_position) {
|
||||
_capture_start = false;
|
||||
} else {
|
||||
_capture_start = true;
|
||||
|
|
@ -1031,8 +1032,8 @@ SndFileSource::handle_header_position_change ()
|
|||
error << string_compose(_("Filesource: start time is already set for existing file (%1): Cannot change start time."), _path ) << endmsg;
|
||||
//in the future, pop up a dialog here that allows user to regenerate file with new start offset
|
||||
} else if (writable()) {
|
||||
_timeline_position = header_position_offset;
|
||||
set_header_timeline_position (); //this will get flushed if/when the file is recorded to
|
||||
_natural_position = header_position_offset;
|
||||
set_header_natural_position (); //this will get flushed if/when the file is recorded to
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1056,14 +1057,14 @@ SndFileSource::setup_standard_crossfades (Session const & s, samplecnt_t rate)
|
|||
}
|
||||
|
||||
void
|
||||
SndFileSource::set_timeline_position (samplepos_t pos)
|
||||
SndFileSource::set_natural_position (samplepos_t pos)
|
||||
{
|
||||
// destructive track timeline postion does not change
|
||||
// except at instantion or when header_position_offset
|
||||
// (session start) changes
|
||||
|
||||
if (!destructive()) {
|
||||
AudioFileSource::set_timeline_position (pos);
|
||||
AudioFileSource::set_natural_position (pos);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1149,4 +1150,3 @@ SndFileSource::set_path (const string& p)
|
|||
{
|
||||
FileSource::set_path (p);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -59,8 +59,9 @@ Source::Source (Session& s, DataType type, const string& name, Flag flags)
|
|||
: SessionObject(s, name)
|
||||
, _type(type)
|
||||
, _flags(flags)
|
||||
, _timeline_position(0)
|
||||
, _use_count (0)
|
||||
, _natural_position(0)
|
||||
, _have_natural_position (false)
|
||||
, _use_count (0)
|
||||
, _level (0)
|
||||
{
|
||||
_analysed = false;
|
||||
|
|
@ -72,7 +73,8 @@ Source::Source (Session& s, const XMLNode& node)
|
|||
: SessionObject(s, "unnamed source")
|
||||
, _type(DataType::AUDIO)
|
||||
, _flags (Flag (Writable|CanRename))
|
||||
, _timeline_position(0)
|
||||
, _natural_position(0)
|
||||
, _have_natural_position (false)
|
||||
, _use_count (0)
|
||||
, _level (0)
|
||||
{
|
||||
|
|
@ -111,7 +113,12 @@ Source::get_state ()
|
|||
node->set_property ("id", id());
|
||||
|
||||
if (_timestamp != 0) {
|
||||
node->set_property ("timestamp", (int64_t)_timestamp);
|
||||
int64_t t = _timestamp;
|
||||
node->set_property ("timestamp", t);
|
||||
}
|
||||
|
||||
if (_have_natural_position) {
|
||||
node->set_property ("natural-position", _natural_position);
|
||||
}
|
||||
|
||||
return *node;
|
||||
|
|
@ -135,13 +142,25 @@ Source::set_state (const XMLNode& node, int version)
|
|||
|
||||
int64_t t;
|
||||
if (node.get_property ("timestamp", t)) {
|
||||
_timestamp = t;
|
||||
_timestamp = (time_t) t;
|
||||
}
|
||||
|
||||
samplepos_t ts;
|
||||
if (node.get_property ("natural-position", ts)) {
|
||||
_natural_position = ts;
|
||||
_have_natural_position = true;
|
||||
} else if (node.get_property ("timeline-position", ts)) {
|
||||
/* some older versions of ardour might have stored this with
|
||||
this property name.
|
||||
*/
|
||||
_natural_position = ts;
|
||||
_have_natural_position = true;
|
||||
}
|
||||
|
||||
if (!node.get_property (X_("flags"), _flags)) {
|
||||
_flags = Flag (0);
|
||||
}
|
||||
|
||||
|
||||
if (!node.get_property (X_("take-id"), _take_id)) {
|
||||
_take_id = "";
|
||||
}
|
||||
|
|
@ -273,9 +292,10 @@ Source::mark_for_remove ()
|
|||
}
|
||||
|
||||
void
|
||||
Source::set_timeline_position (samplepos_t pos)
|
||||
Source::set_natural_position (samplepos_t pos)
|
||||
{
|
||||
_timeline_position = pos;
|
||||
_natural_position = pos;
|
||||
_have_natural_position = true;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -332,4 +352,3 @@ Source::writable () const
|
|||
{
|
||||
return (_flags & Writable) && _session.writable();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ write_bbt_source_to_source (boost::shared_ptr<MidiSource> bbt_source, boost::sh
|
|||
|
||||
bbt_source->model()->set_percussive (old_percussive);
|
||||
source->mark_streaming_write_completed (source_lock);
|
||||
source->set_timeline_position (bbt_source->timeline_position());
|
||||
source->set_natural_position (bbt_source->natural_position());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue