Simplify 86e6df15cc
using a dedicated method
This commit is contained in:
parent
86e6df15cc
commit
cc07cde142
@ -129,7 +129,7 @@ public:
|
||||
|
||||
samplepos_t position_sample () const { return position().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(); }
|
||||
|
||||
layer_t layer () const { return _layer; }
|
||||
|
||||
@ -456,6 +456,9 @@ protected:
|
||||
bool verify_start_and_length (timepos_t const &, timecnt_t&);
|
||||
void first_edit ();
|
||||
|
||||
/* This is always using AudioTime. convenient for evenlopes in AudioRegion */
|
||||
timepos_t len_as_tpos () const { return timepos_t((samplepos_t)_length.val().samples()); }
|
||||
|
||||
DataType _type;
|
||||
|
||||
PBD::Property<bool> _sync_marked;
|
||||
|
@ -278,7 +278,7 @@ AudioRegion::AudioRegion (boost::shared_ptr<const AudioRegion> other)
|
||||
/* As far as I can see, the _envelope's times are relative to region position, and have nothing
|
||||
* to do with sources (and hence _start). So when we copy the envelope, we just use the supplied offset.
|
||||
*/
|
||||
, _envelope (Properties::envelope, boost::shared_ptr<AutomationList> (new AutomationList (*other->_envelope.val(), timepos_t (Temporal::AudioTime), timepos_t ((samplepos_t)other->length().samples()))))
|
||||
, _envelope (Properties::envelope, boost::shared_ptr<AutomationList> (new AutomationList (*other->_envelope.val(), timepos_t (Temporal::AudioTime), other->len_as_tpos ())))
|
||||
, _automatable (other->session(), Temporal::AudioTime)
|
||||
, _fade_in_suspended (0)
|
||||
, _fade_out_suspended (0)
|
||||
@ -300,7 +300,7 @@ AudioRegion::AudioRegion (boost::shared_ptr<const AudioRegion> other, timecnt_t
|
||||
/* As far as I can see, the _envelope's times are relative to region position, and have nothing
|
||||
to do with sources (and hence _start). So when we copy the envelope, we just use the supplied offset.
|
||||
*/
|
||||
, _envelope (Properties::envelope, boost::shared_ptr<AutomationList> (new AutomationList (*other->_envelope.val(), timepos_t (offset.samples()), timepos_t ((samplepos_t)other->length().samples()))))
|
||||
, _envelope (Properties::envelope, boost::shared_ptr<AutomationList> (new AutomationList (*other->_envelope.val(), timepos_t (offset.samples()), other->len_as_tpos ())))
|
||||
, _automatable (other->session(), Temporal::AudioTime)
|
||||
, _fade_in_suspended (0)
|
||||
, _fade_out_suspended (0)
|
||||
@ -380,7 +380,7 @@ AudioRegion::post_set (const PropertyChange& /*ignored*/)
|
||||
}
|
||||
|
||||
/* If _length changed, adjust our gain envelope accordingly */
|
||||
_envelope->truncate_end (timepos_t ((samplepos_t)length ().samples ()));
|
||||
_envelope->truncate_end (len_as_tpos ());
|
||||
}
|
||||
|
||||
void
|
||||
@ -815,7 +815,7 @@ AudioRegion::state () const
|
||||
if (_envelope->size() == 2 &&
|
||||
_envelope->front()->value == GAIN_COEFF_UNITY &&
|
||||
_envelope->back()->value==GAIN_COEFF_UNITY) {
|
||||
if (_envelope->front()->when == 0 && _envelope->back()->when == timepos_t ((samplepos_t)length ().samples ())) {
|
||||
if (_envelope->front()->when == 0 && _envelope->back()->when == len_as_tpos ()) {
|
||||
default_env = true;
|
||||
}
|
||||
}
|
||||
@ -900,7 +900,7 @@ AudioRegion::_set_state (const XMLNode& node, int version, PropertyChange& what_
|
||||
set_default_envelope ();
|
||||
}
|
||||
|
||||
_envelope->truncate_end (timepos_t ((samplepos_t)length ().samples ()));
|
||||
_envelope->truncate_end (len_as_tpos ());
|
||||
|
||||
|
||||
} else if (child->name() == "FadeIn") {
|
||||
@ -1294,9 +1294,7 @@ AudioRegion::set_default_envelope ()
|
||||
* XXX this needs some thought
|
||||
*/
|
||||
|
||||
timepos_t alen ((samplepos_t)length ().samples ());
|
||||
|
||||
_envelope->fast_simple_add (alen, GAIN_COEFF_UNITY);
|
||||
_envelope->fast_simple_add (len_as_tpos (), GAIN_COEFF_UNITY);
|
||||
_envelope->thaw ();
|
||||
}
|
||||
|
||||
@ -1308,7 +1306,7 @@ AudioRegion::recompute_at_end ()
|
||||
*/
|
||||
|
||||
_envelope->freeze ();
|
||||
_envelope->truncate_end (timepos_t ((samplepos_t)length ().samples ()));
|
||||
_envelope->truncate_end (len_as_tpos ());
|
||||
_envelope->thaw ();
|
||||
|
||||
suspend_property_changes();
|
||||
|
Loading…
Reference in New Issue
Block a user