get rid of Region _position member, since the _length member has its own position

This commit is contained in:
Paul Davis 2021-02-25 08:16:15 -07:00
parent dad56af802
commit c0343a5a1a
4 changed files with 63 additions and 67 deletions

View file

@ -118,7 +118,7 @@ public:
* LENGTH: number of samples the region represents * LENGTH: number of samples the region represents
*/ */
timepos_t position () const { return _position.val(); } timepos_t position () const { return _length.val().position(); }
timecnt_t start () const { return _start.val(); } timecnt_t start () const { return _start.val(); }
timecnt_t length () const { return _length.val(); } timecnt_t length () const { return _length.val(); }
timepos_t end() const; timepos_t end() const;
@ -128,7 +128,7 @@ public:
timepos_t source_relative_position (Temporal::timepos_t const &) const; timepos_t source_relative_position (Temporal::timepos_t const &) const;
timepos_t region_relative_position (Temporal::timepos_t const &) const; timepos_t region_relative_position (Temporal::timepos_t const &) const;
samplepos_t position_sample () const { return _position.val().samples(); } samplepos_t position_sample () const { return position().samples(); }
samplecnt_t start_sample () const { return _start.val().samples(); } samplecnt_t start_sample () const { return _start.val().samples(); }
samplecnt_t length_samples () const { return _length.val().samples(); } samplecnt_t length_samples () const { return _length.val().samples(); }
@ -161,7 +161,7 @@ public:
/* first_sample() is an alias; last_sample() just hides some math */ /* first_sample() is an alias; last_sample() just hides some math */
samplepos_t first_sample () const { return _position.val().samples(); } samplepos_t first_sample () const { return position().samples(); }
samplepos_t last_sample () const { return first_sample() + length_samples() - 1; } samplepos_t last_sample () const { return first_sample() + length_samples() - 1; }
/** Return the earliest possible value of _position given the /** Return the earliest possible value of _position given the
@ -222,7 +222,7 @@ public:
* OverlapExternal: the range overlaps all of this region. * OverlapExternal: the range overlaps all of this region.
*/ */
Temporal::OverlapType coverage (timepos_t const & start, timepos_t const & end) const { Temporal::OverlapType coverage (timepos_t const & start, timepos_t const & end) const {
return Temporal::coverage_exclusive_ends (_position.val(), nt_last(), start, end); return Temporal::coverage_exclusive_ends (position(), nt_last(), start, end);
} }
bool exact_equivalent (boost::shared_ptr<const Region>) const; bool exact_equivalent (boost::shared_ptr<const Region>) const;
@ -463,7 +463,6 @@ protected:
PBD::Property<bool> _valid_transients; PBD::Property<bool> _valid_transients;
PBD::Property<timecnt_t> _start; PBD::Property<timecnt_t> _start;
PBD::Property<timecnt_t> _length; PBD::Property<timecnt_t> _length;
PBD::Property<timepos_t> _position;
/** Sync position relative to the start of our file */ /** Sync position relative to the start of our file */
PBD::Property<timecnt_t> _sync_position; PBD::Property<timecnt_t> _sync_position;

View file

@ -461,7 +461,7 @@ samplecnt_t
AudioRegion::read (Sample* buf, samplepos_t pos, samplecnt_t cnt, int channel) const AudioRegion::read (Sample* buf, samplepos_t pos, samplecnt_t cnt, int channel) const
{ {
/* raw read, no fades, no gain, nada */ /* raw read, no fades, no gain, nada */
return read_from_sources (_sources, _length.val().samples(), buf, _position.val().samples() + pos, cnt, channel); return read_from_sources (_sources, _length.val().samples(), buf, position().samples() + pos, cnt, channel);
} }
samplecnt_t samplecnt_t
@ -477,13 +477,13 @@ AudioRegion::master_read_at (Sample *buf, Sample* /*mixdown_buffer*/, float* /*g
/** @param buf Buffer to mix data into. /** @param buf Buffer to mix data into.
* @param mixdown_buffer Scratch buffer for audio data. * @param mixdown_buffer Scratch buffer for audio data.
* @param gain_buffer Scratch buffer for gain data. * @param gain_buffer Scratch buffer for gain data.
* @param position Position within the session to read from. * @param pos Position within the session to read from.
* @param cnt Number of samples to read. * @param cnt Number of samples to read.
* @param chan_n Channel number to read. * @param chan_n Channel number to read.
*/ */
samplecnt_t samplecnt_t
AudioRegion::read_at (Sample *buf, Sample *mixdown_buffer, float *gain_buffer, AudioRegion::read_at (Sample *buf, Sample *mixdown_buffer, float *gain_buffer,
samplepos_t position, samplepos_t pos,
samplecnt_t cnt, samplecnt_t cnt,
uint32_t chan_n) const uint32_t chan_n) const
{ {
@ -504,11 +504,11 @@ AudioRegion::read_at (Sample *buf, Sample *mixdown_buffer, float *gain_buffer,
/* WORK OUT WHERE TO GET DATA FROM */ /* WORK OUT WHERE TO GET DATA FROM */
samplecnt_t to_read; samplecnt_t to_read;
const samplepos_t psamples = _position.val().samples(); const samplepos_t psamples = position().samples();
const samplecnt_t lsamples = _length.val().samples(); const samplecnt_t lsamples = _length.val().samples();
assert (position >= psamples); assert (pos >= psamples);
sampleoffset_t const internal_offset = position - psamples; sampleoffset_t const internal_offset = pos - psamples;
if (internal_offset >= lsamples) { if (internal_offset >= lsamples) {
return 0; /* read nothing */ return 0; /* read nothing */
@ -590,7 +590,7 @@ AudioRegion::read_at (Sample *buf, Sample *mixdown_buffer, float *gain_buffer,
may need to mix with the existing data. may need to mix with the existing data.
*/ */
if (read_from_sources (_sources, lsamples, mixdown_buffer, position, to_read, chan_n) != to_read) { if (read_from_sources (_sources, lsamples, mixdown_buffer, pos, to_read, chan_n) != to_read) {
return 0; return 0;
} }
@ -729,16 +729,16 @@ AudioRegion::read_at (Sample *buf, Sample *mixdown_buffer, float *gain_buffer,
* @param srcs Source list to get our source from. * @param srcs Source list to get our source from.
* @param limit Furthest that we should read, as an offset from the region position. * @param limit Furthest that we should read, as an offset from the region position.
* @param buf Buffer to write data into (existing contents of the buffer will be overwritten) * @param buf Buffer to write data into (existing contents of the buffer will be overwritten)
* @param position Position to read from, in session samples. * @param pos Position to read from, in session samples.
* @param cnt Number of samples to read. * @param cnt Number of samples to read.
* @param chan_n Channel to read from. * @param chan_n Channel to read from.
* @return Number of samples read. * @return Number of samples read.
*/ */
samplecnt_t samplecnt_t
AudioRegion::read_from_sources (SourceList const & srcs, samplecnt_t limit, Sample* buf, samplepos_t position, samplecnt_t cnt, uint32_t chan_n) const AudioRegion::read_from_sources (SourceList const & srcs, samplecnt_t limit, Sample* buf, samplepos_t pos, samplecnt_t cnt, uint32_t chan_n) const
{ {
sampleoffset_t const internal_offset = position - _position.val().samples(); sampleoffset_t const internal_offset = pos - position().samples();
if (internal_offset >= limit) { if (internal_offset >= limit) {
return 0; return 0;
@ -978,14 +978,14 @@ AudioRegion::fade_range (samplepos_t start, samplepos_t end)
switch (coverage (timepos_t (start), timepos_t (end))) { switch (coverage (timepos_t (start), timepos_t (end))) {
case Temporal::OverlapStart: case Temporal::OverlapStart:
trim_front (timepos_t (start)); trim_front (timepos_t (start));
s = _position.val().samples(); s = position().samples();
e = end; e = end;
set_fade_in (FadeConstantPower, e - s); set_fade_in (FadeConstantPower, e - s);
break; break;
case Temporal::OverlapEnd: case Temporal::OverlapEnd:
trim_end(timepos_t (end)); trim_end(timepos_t (end));
s = start; s = start;
e = (_position.val() + timepos_t (_length)).samples(); e = (position() + timepos_t (_length)).samples();
set_fade_out (FadeConstantPower, e - s); set_fade_out (FadeConstantPower, e - s);
break; break;
case Temporal::OverlapInternal: case Temporal::OverlapInternal:

View file

@ -164,7 +164,6 @@ MidiRegion::clone (boost::shared_ptr<MidiSource> newsrc, ThawList* tl) const
plist.add (Properties::whole_file, true); plist.add (Properties::whole_file, true);
plist.add (Properties::start, _start); plist.add (Properties::start, _start);
plist.add (Properties::length, _length); plist.add (Properties::length, _length);
plist.add (Properties::position, _position);
plist.add (Properties::layer, 0); plist.add (Properties::layer, 0);
boost::shared_ptr<MidiRegion> ret (boost::dynamic_pointer_cast<MidiRegion> (RegionFactory::create (newsrc, plist, true, tl))); boost::shared_ptr<MidiRegion> ret (boost::dynamic_pointer_cast<MidiRegion> (RegionFactory::create (newsrc, plist, true, tl)));
@ -201,7 +200,7 @@ MidiRegion::master_read_at (MidiRingBuffer<samplepos_t>& out,
timecnt_t timecnt_t
MidiRegion::_read_at (const SourceList& /*srcs*/, MidiRegion::_read_at (const SourceList& /*srcs*/,
Evoral::EventSink<samplepos_t>& dst, Evoral::EventSink<samplepos_t>& dst,
timepos_t const & position, timepos_t const & pos,
timecnt_t const & xdur, timecnt_t const & xdur,
Temporal::Range* loop_range, Temporal::Range* loop_range,
MidiCursor& cursor, MidiCursor& cursor,
@ -222,13 +221,13 @@ MidiRegion::_read_at (const SourceList& /*srcs*/,
return timecnt_t(); /* read nothing */ return timecnt_t(); /* read nothing */
} }
if (position < _position) { if (pos < position()) {
/* we are starting the read from before the start of the region */ /* we are starting the read from before the start of the region */
internal_offset = timecnt_t (Temporal::BeatTime);; internal_offset = timecnt_t (Temporal::BeatTime);;
dur -= position.distance (_position); dur -= pos.distance (position());
} else { } else {
/* we are starting the read from after the start of the region */ /* we are starting the read from after the start of the region */
internal_offset = _position.val().distance (position); internal_offset = position().distance (pos);
} }
if (internal_offset >= _length) { if (internal_offset >= _length) {
@ -246,11 +245,11 @@ MidiRegion::_read_at (const SourceList& /*srcs*/,
src->set_note_mode(lm, mode); src->set_note_mode(lm, mode);
#if 0 #if 0
cerr << "MR " << name () << " read @ " << position << " + " << to_read cerr << "MR " << name () << " read @ " << pos << " + " << to_read
<< " dur was " << dur << " dur was " << dur
<< " len " << _length << " len " << _length
<< " l-io " << (_length - internal_offset) << " l-io " << (_length - internal_offset)
<< " _position = " << _position << " position = " << position()
<< " _start = " << _start << " _start = " << _start
<< " intoffset = " << internal_offset << " intoffset = " << internal_offset
<< " quarter_note = " << quarter_note() << " quarter_note = " << quarter_note()
@ -263,7 +262,7 @@ MidiRegion::_read_at (const SourceList& /*srcs*/,
if (src->midi_read ( if (src->midi_read (
lm, // source lock lm, // source lock
dst, // destination buffer dst, // destination buffer
_position.val().earlier (_start.val()), // start position of the source on timeline position().earlier (_start.val()), // start position of the source on timeline
_start.val() + internal_offset, // where to start reading in the source _start.val() + internal_offset, // where to start reading in the source
to_read, // read duration in samples to_read, // read duration in samples
loop_range, loop_range,
@ -298,12 +297,12 @@ MidiRegion::render (Evoral::EventSink<samplepos_t>& dst,
/* dump pulls from zero to infinity ... */ /* dump pulls from zero to infinity ... */
if (!_position.val().zero()) { if (!position().zero()) {
/* we are starting the read from before the start of the region */ /* we are starting the read from before the start of the region */
internal_offset = timecnt_t (Temporal::BeatTime); internal_offset = timecnt_t (Temporal::BeatTime);
} else { } else {
/* we are starting the read from after the start of the region */ /* we are starting the read from after the start of the region */
internal_offset = timecnt_t (-_position.val()); internal_offset = timecnt_t (-position());
} }
if (internal_offset >= _length) { if (internal_offset >= _length) {

View file

@ -71,9 +71,9 @@ namespace ARDOUR {
PBD::PropertyDescriptor<bool> valid_transients; PBD::PropertyDescriptor<bool> valid_transients;
PBD::PropertyDescriptor<timecnt_t> start; PBD::PropertyDescriptor<timecnt_t> start;
PBD::PropertyDescriptor<timecnt_t> length; PBD::PropertyDescriptor<timecnt_t> length;
PBD::PropertyDescriptor<timepos_t> position;
PBD::PropertyDescriptor<double> beat; PBD::PropertyDescriptor<double> beat;
PBD::PropertyDescriptor<timecnt_t> sync_position; PBD::PropertyDescriptor<timecnt_t> sync_position;
PBD::PropertyDescriptor<timepos_t> position;
PBD::PropertyDescriptor<layer_t> layer; PBD::PropertyDescriptor<layer_t> layer;
PBD::PropertyDescriptor<timecnt_t> ancestral_start; PBD::PropertyDescriptor<timecnt_t> ancestral_start;
PBD::PropertyDescriptor<timecnt_t> ancestral_length; PBD::PropertyDescriptor<timecnt_t> ancestral_length;
@ -123,10 +123,10 @@ Region::make_property_quarks ()
DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for start = %1\n", Properties::start.property_id)); DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for start = %1\n", Properties::start.property_id));
Properties::length.property_id = g_quark_from_static_string (X_("length")); Properties::length.property_id = g_quark_from_static_string (X_("length"));
DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for length = %1\n", Properties::length.property_id)); DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for length = %1\n", Properties::length.property_id));
Properties::position.property_id = g_quark_from_static_string (X_("position"));
DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for position = %1\n", Properties::position.property_id));
Properties::beat.property_id = g_quark_from_static_string (X_("beat")); Properties::beat.property_id = g_quark_from_static_string (X_("beat"));
DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for beat = %1\n", Properties::beat.property_id)); DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for beat = %1\n", Properties::beat.property_id));
Properties::position.property_id = g_quark_from_static_string (X_("position"));
DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for position = %1\n", Properties::position.property_id));
Properties::sync_position.property_id = g_quark_from_static_string (X_("sync-position")); Properties::sync_position.property_id = g_quark_from_static_string (X_("sync-position"));
DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for sync-position = %1\n", Properties::sync_position.property_id)); DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for sync-position = %1\n", Properties::sync_position.property_id));
Properties::layer.property_id = g_quark_from_static_string (X_("layer")); Properties::layer.property_id = g_quark_from_static_string (X_("layer"));
@ -168,7 +168,6 @@ Region::register_properties ()
add_property (_valid_transients); add_property (_valid_transients);
add_property (_start); add_property (_start);
add_property (_length); add_property (_length);
add_property (_position);
add_property (_sync_position); add_property (_sync_position);
add_property (_ancestral_start); add_property (_ancestral_start);
add_property (_ancestral_length); add_property (_ancestral_length);
@ -186,7 +185,6 @@ Region::register_properties ()
, _valid_transients (Properties::valid_transients, false) \ , _valid_transients (Properties::valid_transients, false) \
, _start (Properties::start, timecnt_t (s, _type == DataType::MIDI ? timepos_t (Temporal::Beats()) : timepos_t::from_superclock (0))) \ , _start (Properties::start, timecnt_t (s, _type == DataType::MIDI ? timepos_t (Temporal::Beats()) : timepos_t::from_superclock (0))) \
, _length (Properties::length, timecnt_t (l, timepos_t (s))) \ , _length (Properties::length, timecnt_t (l, timepos_t (s))) \
, _position (Properties::position, _type == DataType::MIDI ? timepos_t (Temporal::Beats()) : timepos_t::from_superclock (0)) \
, _sync_position (Properties::sync_position, timecnt_t (s, _type == DataType::MIDI ? timepos_t (Temporal::Beats()) : timepos_t::from_superclock (0))) \ , _sync_position (Properties::sync_position, timecnt_t (s, _type == DataType::MIDI ? timepos_t (Temporal::Beats()) : timepos_t::from_superclock (0))) \
, _transient_user_start (0) \ , _transient_user_start (0) \
, _transient_analysis_start (0) \ , _transient_analysis_start (0) \
@ -217,7 +215,6 @@ Region::register_properties ()
, _valid_transients (Properties::valid_transients, other->_valid_transients) \ , _valid_transients (Properties::valid_transients, other->_valid_transients) \
, _start(Properties::start, other->_start) \ , _start(Properties::start, other->_start) \
, _length(Properties::length, other->_length) \ , _length(Properties::length, other->_length) \
, _position(Properties::position, other->_position) \
, _sync_position(Properties::sync_position, other->_sync_position) \ , _sync_position(Properties::sync_position, other->_sync_position) \
, _user_transients (other->_user_transients) \ , _user_transients (other->_user_transients) \
, _transient_user_start (other->_transient_user_start) \ , _transient_user_start (other->_transient_user_start) \
@ -297,7 +294,6 @@ Region::Region (boost::shared_ptr<const Region> other)
/* override state that may have been incorrectly inherited from the other region /* override state that may have been incorrectly inherited from the other region
*/ */
_position = other->_position;
_locked = false; _locked = false;
_whole_file = false; _whole_file = false;
_hidden = false; _hidden = false;
@ -364,7 +360,7 @@ Region::Region (boost::shared_ptr<const Region> other, timecnt_t const & offset)
use_sources (other->_sources); use_sources (other->_sources);
set_master_sources (other->_master_sources); set_master_sources (other->_master_sources);
_position = other->_position.val() + offset; _length.call().set_position (other->position() + offset);
_start = other->_start.val() + offset; _start = other->_start.val() + offset;
/* if the other region had a distinct sync point /* if the other region had a distinct sync point
@ -473,7 +469,7 @@ Region::set_length (timecnt_t const & len)
* length impossible. * length impossible.
*/ */
if (timepos_t::max (len.time_domain()).earlier (len) < _position) { if (timepos_t::max (len.time_domain()).earlier (len) < position()) {
return; return;
} }
@ -538,7 +534,7 @@ Region::at_natural_position () const
boost::shared_ptr<Region> whole_file_region = get_parent(); boost::shared_ptr<Region> whole_file_region = get_parent();
if (whole_file_region) { if (whole_file_region) {
if (_position == whole_file_region->position() + _start) { if (position() == whole_file_region->position() + _start) {
return true; return true;
} }
} }
@ -569,17 +565,18 @@ Region::special_set_position (timepos_t const & pos)
* a way to store its "natural" or "captured" position. * a way to store its "natural" or "captured" position.
*/ */
_position = pos; _length.call().set_position (pos);
} }
void void
Region::set_position_time_domain (Temporal::TimeDomain ps) Region::set_position_time_domain (Temporal::TimeDomain ps)
{ {
if (_position.val().time_domain() != ps) { if (_length.val().time_domain() != ps) {
boost::shared_ptr<Playlist> pl (playlist()); boost::shared_ptr<Playlist> pl (playlist());
_position.call().set_time_domain (ps); #warning NUTEMPO need to set ALL of length to new TD
//_length.val().set_time_domain (ps);
send_change (Properties::time_domain); send_change (Properties::time_domain);
} }
@ -606,7 +603,7 @@ Region::update_after_tempo_map_change (bool send)
* change * change
*/ */
if (_position.val().time_domain() == Temporal::AudioTime) { if (_length.val().time_domain() == Temporal::AudioTime) {
return; return;
} }
@ -675,11 +672,11 @@ Region::set_position_internal (timepos_t const & pos)
* (see Region::set_position), so we must always set this up so that * (see Region::set_position), so we must always set this up so that
* e.g. Playlist::notify_region_moved doesn't use an out-of-date last_position. * e.g. Playlist::notify_region_moved doesn't use an out-of-date last_position.
*/ */
_last_position = _position; _last_position = position();
_last_length.set_position (_position); _last_length.set_position (_last_position);
if (_position != pos) { if (position() != pos) {
_position = pos; #warning NUTEMPO is this correct? why would set position set the position of the start (duration)?
_start.call().set_position (pos); _start.call().set_position (pos);
_length.call().set_position (pos); _length.call().set_position (pos);
@ -688,9 +685,9 @@ Region::set_position_internal (timepos_t const & pos)
* *
* XXX is this the right thing to do? * XXX is this the right thing to do?
*/ */
if (timepos_t::max (_length.val().time_domain()).earlier (_length) < _position) { if (timepos_t::max (_length.val().time_domain()).earlier (_length) < position()) {
_last_length = _length; _last_length = _length;
_length = _position.call().distance (timepos_t::max(_position.val().time_domain())); _length = position().distance (timepos_t::max (position().time_domain()));
} }
} }
} }
@ -707,8 +704,9 @@ Region::set_initial_position (timepos_t const & pos)
return; return;
} }
if (_position != pos) { if (position() != pos) {
_position = pos;
_length.call().set_position (pos);
/* check that the new _position wouldn't make the current /* check that the new _position wouldn't make the current
* length impossible - if so, change the length. * length impossible - if so, change the length.
@ -716,15 +714,15 @@ Region::set_initial_position (timepos_t const & pos)
* XXX is this the right thing to do? * XXX is this the right thing to do?
*/ */
if (timepos_t::max (_length.val().time_domain()).earlier (_length) < _position) { if (timepos_t::max (_length.val().time_domain()).earlier (_length) < position()) {
_last_length = _length; _last_length = _length;
_length = _position.call().distance (timepos_t::max (_position.val().time_domain())); _length = position().distance (timepos_t::max (position().time_domain()));
} }
recompute_position_from_time_domain (); recompute_position_from_time_domain ();
/* ensure that this move doesn't cause a range move */ /* ensure that this move doesn't cause a range move */
_last_position = _position; _last_position = position();
_last_length.set_position (_position); _last_length.set_position (position());
} }
@ -745,7 +743,7 @@ Region::nudge_position (timecnt_t const & n)
return; return;
} }
timepos_t new_position = _position; timepos_t new_position = position();
if (n.positive()) { if (n.positive()) {
if (position() > timepos_t::max (n.time_domain()).earlier (n)) { if (position() > timepos_t::max (n.time_domain()).earlier (n)) {
@ -755,7 +753,7 @@ Region::nudge_position (timecnt_t const & n)
} }
} else { } else {
if (position() < -n) { if (position() < -n) {
new_position = timepos_t (_position.val().time_domain()); new_position = timepos_t (position().time_domain());
} else { } else {
new_position += n; new_position += n;
} }
@ -917,8 +915,8 @@ Region::modify_end (timepos_t const & new_endpoint, bool reset_fade)
return; return;
} }
if (new_endpoint > _position) { if (new_endpoint > position()) {
trim_to_internal (_position, position().distance (new_endpoint)); trim_to_internal (position(), position().distance (new_endpoint));
if (reset_fade) { if (reset_fade) {
_left_of_split = true; _left_of_split = true;
} }
@ -1007,7 +1005,7 @@ Region::trim_to_internal (timepos_t const & pos, timecnt_t const & len)
if (position() != pos) { if (position() != pos) {
if (!property_changes_suspended()) { if (!property_changes_suspended()) {
_last_position = _position; _last_position = position();
} }
set_position_internal (pos); set_position_internal (pos);
what_changed.add (Properties::position); what_changed.add (Properties::position);
@ -1393,7 +1391,7 @@ Region::suspend_property_changes ()
{ {
Stateful::suspend_property_changes (); Stateful::suspend_property_changes ();
_last_length = _length; _last_length = _length;
_last_position = _position; _last_position = position();
} }
void void
@ -1454,7 +1452,7 @@ bool
Region::layer_and_time_equivalent (boost::shared_ptr<const Region> other) const Region::layer_and_time_equivalent (boost::shared_ptr<const Region> other) const
{ {
return _layer == other->_layer && return _layer == other->_layer &&
_position == other->_position && position() == other->position() &&
_length == other->_length; _length == other->_length;
} }
@ -1462,7 +1460,7 @@ bool
Region::exact_equivalent (boost::shared_ptr<const Region> other) const Region::exact_equivalent (boost::shared_ptr<const Region> other) const
{ {
return _start == other->_start && return _start == other->_start &&
_position == other->_position && position() == other->position() &&
_length == other->_length; _length == other->_length;
} }
@ -1967,7 +1965,7 @@ Region::set_start_internal (timecnt_t const & s)
timepos_t timepos_t
Region::earliest_possible_position () const Region::earliest_possible_position () const
{ {
if (start() > timecnt_t (_position, timepos_t())) { if (start() > timecnt_t (position(), timepos_t())) {
return timepos_t::from_superclock (0); return timepos_t::from_superclock (0);
} else { } else {
return source_position(); return source_position();
@ -1996,7 +1994,7 @@ Region::latest_possible_sample () const
Temporal::TimeDomain Temporal::TimeDomain
Region::position_time_domain() const Region::position_time_domain() const
{ {
return _position.val().time_domain(); return position().time_domain();
} }
timepos_t timepos_t
@ -2005,14 +2003,14 @@ Region::end() const
/* one day we might want to enforce _position, _start and _length (or /* one day we might want to enforce _position, _start and _length (or
some combination thereof) all being in the same time domain. some combination thereof) all being in the same time domain.
*/ */
return _position.val() + _length.val(); return position() + _length.val();
} }
timepos_t timepos_t
Region::source_position () const Region::source_position () const
{ {
/* this is the position of the start of the source, in absolute time */ /* this is the position of the start of the source, in absolute time */
return _position.val().earlier (_start.val()); return position().earlier (_start.val());
} }
Temporal::Beats Temporal::Beats
@ -2033,7 +2031,7 @@ Region::source_beats_to_absolute_beats (Temporal::Beats beats) const
Temporal::timepos_t Temporal::timepos_t
Region::region_beats_to_absolute_time (Temporal::Beats beats) const Region::region_beats_to_absolute_time (Temporal::Beats beats) const
{ {
return _position.val() + timepos_t (beats); return position() + timepos_t (beats);
} }
Temporal::timepos_t Temporal::timepos_t
@ -2086,5 +2084,5 @@ Region::region_relative_position (timepos_t const & p) const
XXX this seems likely to cause problems. XXX this seems likely to cause problems.
*/ */
return p.earlier (_position.val()); return p.earlier (position());
} }