remove absurd internal Crossfade constructor that confused region start and region position; set position explicitly in the two places that we use these crossfades; revert to the assert that caught this crazy error

git-svn-id: svn://localhost/ardour2/branches/3.0@10259 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2011-10-20 21:17:25 +00:00
parent 00ddd099ed
commit fb917cff45
4 changed files with 12 additions and 19 deletions

View file

@ -59,7 +59,6 @@ class Crossfade : public ARDOUR::AudioRegion
/* constructor for "fixed" xfades at each end of an internal overlap */
Crossfade (boost::shared_ptr<ARDOUR::AudioRegion> in, boost::shared_ptr<ARDOUR::AudioRegion> out,
framepos_t position,
framecnt_t initial_length,
AnchorPoint);
@ -114,10 +113,6 @@ class Crossfade : public ARDOUR::AudioRegion
PBD::Signal1<void,boost::shared_ptr<Region> > Invalidated;
bool covers (framepos_t frame) const {
return _position <= frame && frame < _position + _length;
}
OverlapType coverage (framepos_t start, framepos_t end) const;
static void set_buffer_size (framecnt_t);

View file

@ -311,12 +311,14 @@ AudioPlaylist::read (Sample *buf, Sample *mixdown_buffer, float *gain_buffer, fr
DEBUG_TRACE (DEBUG::AudioPlayback, string_compose ("Checking %1 xfades\n", _crossfades.size()));
for (Crossfades::iterator i = _crossfades.begin(); i != _crossfades.end(); ++i) {
DEBUG_TRACE (DEBUG::AudioPlayback, string_compose ("%1 check xfade between %2 and %3 ...\n",
name(), (*i)->out()->name(), (*i)->in()->name()));
DEBUG_TRACE (DEBUG::AudioPlayback, string_compose ("%1 check xfade between %2 and %3 ... [ %4 ... %5 | %6 ... %7]\n",
name(), (*i)->out()->name(), (*i)->in()->name(),
(*i)->first_frame(), (*i)->last_frame(),
start, end));
if ((*i)->coverage (start, end) != OverlapNone) {
relevant_xfades[(*i)->upper_layer()].push_back (*i);
DEBUG_TRACE (DEBUG::AudioPlayback, string_compose ("\t\txfade is relevant, place on layer %1\n",
(*i)->upper_layer()));
DEBUG_TRACE (DEBUG::AudioPlayback, string_compose ("\t\txfade is relevant (coverage = %2), place on layer %1\n",
(*i)->upper_layer(), enum_2_string ((*i)->coverage (start, end))));
}
}
@ -579,7 +581,8 @@ AudioPlaylist::check_dependents (boost::shared_ptr<Region> r, bool norefresh)
if (top_region_at (top->first_frame()) == top) {
xfade = boost::shared_ptr<Crossfade> (new Crossfade (top, bottom, xfade_length, top->first_frame(), StartOfIn));
xfade = boost::shared_ptr<Crossfade> (new Crossfade (top, bottom, xfade_length, StartOfIn));
xfade->set_position (top->first_frame());
add_crossfade (xfade);
}
@ -590,7 +593,8 @@ AudioPlaylist::check_dependents (boost::shared_ptr<Region> r, bool norefresh)
would cover it).
*/
xfade = boost::shared_ptr<Crossfade> (new Crossfade (bottom, top, xfade_length, top->last_frame() - xfade_length, EndOfOut));
xfade = boost::shared_ptr<Crossfade> (new Crossfade (bottom, top, xfade_length, EndOfOut));
xfade->set_position (top->last_frame() - xfade_length);
add_crossfade (xfade);
}
break;

View file

@ -402,12 +402,7 @@ AudioRegion::_read_at (const SourceList& srcs, framecnt_t limit,
/* if this fails then the requested section is entirely
before the position of this region
*/
if (cnt < buf_offset) {
error << "trying to read region " << name() << " @ " << position << " which is outside region bounds "
<< _position << " .. " << last_frame() << " (len = " << length() << ')'
<< endmsg;
return 0; // read nothing
}
assert (cnt >= buf_offset);
cnt -= buf_offset;
} else {
internal_offset = position - _position;

View file

@ -85,9 +85,8 @@ Crossfade::operator== (const Crossfade& other)
Crossfade::Crossfade (boost::shared_ptr<AudioRegion> in, boost::shared_ptr<AudioRegion> out,
framecnt_t length,
framepos_t position,
AnchorPoint ap)
: AudioRegion (in->session(), position, length, in->name() + string ("<>") + out->name())
: AudioRegion (in->session(), 0, length, in->name() + string ("<>") + out->name())
, CROSSFADE_DEFAULT_PROPERTIES
, _fade_in (Evoral::Parameter(FadeInAutomation)) // linear (gain coefficient) => -inf..+6dB
, _fade_out (Evoral::Parameter(FadeOutAutomation)) // linear (gain coefficient) => -inf..+6dB