#include <sigc++/bind.h>
+#include <pbd/stacktrace.h>
+
#include <ardour/types.h>
#include <ardour/crossfade.h>
#include <ardour/crossfade_compare.h>
{
_in = in;
_out = out;
+
_length = length;
_position = position;
_anchor_point = ap;
- switch (Config->get_xfade_model()) {
- case ShortCrossfade:
- _follow_overlap = false;
- break;
- default:
- _follow_overlap = true;
- }
+ _follow_overlap = false;
+
+ cerr << "A: follow overlap = " << _follow_overlap << endl;
_active = Config->get_xfades_active ();
_fixed = true;
initialize ();
+ cerr << "K: follow overlap = " << _follow_overlap << endl;
}
Crossfade::Crossfade (const Playlist& playlist, XMLNode& node)
if (set_state (node)) {
throw failed_constructor();
}
+
+ cerr << "D: follow overlap = " << _follow_overlap << endl;
+
}
Crossfade::Crossfade (const Crossfade &orig, boost::shared_ptr<AudioRegion> newin, boost::shared_ptr<AudioRegion> newout)
// Let's make sure the fade isn't too long
set_length(_length);
+
+ cerr << "B: follow overlap = " << _follow_overlap << endl;
+
}
Crossfade::~Crossfade ()
{
- Invalidated (this);
+ cerr << this << " Crossfade deleted\n";
+ notify_callbacks ();
}
void
/* first check for matching ends */
if (top->first_frame() == bottom->first_frame()) {
-
+
/* Both regions start at the same point */
if (top->last_frame() < bottom->last_frame()) {
_in = bottom;
_out = top;
- _position = bottom->first_frame();
_anchor_point = StartOfIn;
if (model == FullCrossfade) {
+ _position = bottom->first_frame(); // "{"
_length = _out->first_frame() + _out->length() - _in->first_frame();
/* leave active alone */
_follow_overlap = true;
} else {
_length = min (short_xfade_length, top->length());
+ _position = top->last_frame() - _length; // "]" - length
_active = true;
_follow_overlap = false;
/* crossfades must be between non-muted regions */
if (_out->muted() || _in->muted()) {
- Invalidated (this);
+ Invalidated (shared_from_this());
return false;
}
+// if (_in->layer() < _out->layer()) {
+// cerr << this << " layer change, invalidated, in on " << _in->layer() << " out on " << _out->layer() << endl;
+// Invalidated (shared_from_this());
+// return false;
+// }
+
/* overlap type must be Start, End or External */
OverlapType ot;
ot = _in->coverage (_out->first_frame(), _out->last_frame());
-
- switch (ot) {
- case OverlapNone:
- case OverlapInternal:
- Invalidated (this);
- return false;
-
- default:
- break;
- }
-
+
/* overlap type must not have altered */
if (ot != overlap_type) {
- Invalidated (this);
+ cerr << this << " Invalid B\n";
+ Invalidated (shared_from_this());
return false;
}
{
nframes_t newlen;
+ cerr << this << " update, " << _in->name() << " + " << _out->name() << " length = " << _length << endl;
+
if (_follow_overlap) {
newlen = _out->first_frame() + _out->length() - _in->first_frame();
+ cerr << "\tmodify length\n";
} else {
newlen = _length;
}
if (newlen == 0) {
- Invalidated (this);
+ cerr << this << " Invalid C\n";
+ Invalidated (shared_from_this());
return false;
}
}
+ cerr << "\tFover = " << _follow_overlap << endl;
+
switch (_anchor_point) {
case StartOfIn:
- if (_position != _in->first_frame()) {
- _position = _in->first_frame();
- }
+ _position = _in->first_frame();
break;
case EndOfIn:
- if (_position != _in->last_frame() - _length) {
- _position = _in->last_frame() - _length;
- }
+ _position = _in->last_frame() - _length;
break;
case EndOfOut:
- if (_position != _out->last_frame() - _length) {
- _position = _out->last_frame() - _length;
- }
+ _position = _out->last_frame() - _length;
}
/* UI's may need to know that the overlap changed even
/* fade out */
- _fade_in.freeze ();
+ _fade_out.freeze ();
_fade_out.clear ();
children = fo->children();
void
Crossfade::invalidate ()
{
- Invalidated (this); /* EMIT SIGNAL */
+ Invalidated (shared_from_this()); /* EMIT SIGNAL */
}