using namespace ARDOUR;
using namespace sigc;
using namespace std;
+using namespace PBD;
AudioPlaylist::State::~State ()
{
its OK to block (for short intervals).
*/
- LockMonitor rm (region_lock, __LINE__, __FILE__);
+ Glib::Mutex::Lock rm (region_lock);
end = start + cnt - 1;
AudioRegion *left = dynamic_cast<AudioRegion*>(l);
AudioRegion *right = dynamic_cast<AudioRegion*>(r);
- for (Crossfades::iterator x = _crossfades.begin(); x != _crossfades.end(); ++x) {
+ for (Crossfades::iterator x = _crossfades.begin(); x != _crossfades.end();) {
Crossfades::iterator tmp;
+ tmp = x;
+ ++tmp;
+ Crossfade *fade = 0;
+
if ((*x)->_in == orig) {
- (*x)->_in = left;
+ if (! (*x)->covers(right->position())) {
+ fade = new Crossfade( *(*x), left, (*x)->_out);
+ } else {
+ // Overlap, the crossfade is copied on the left side of the right region instead
+ fade = new Crossfade( *(*x), right, (*x)->_out);
+ }
}
-
+
if ((*x)->_out == orig) {
- (*x)->_out = right;
+ if (! (*x)->covers(right->position())) {
+ fade = new Crossfade( *(*x), (*x)->_in, right);
+ } else {
+ // Overlap, the crossfade is copied on the right side of the left region instead
+ fade = new Crossfade( *(*x), (*x)->_in, left);
+ }
}
+ if (fade) {
+ _crossfades.remove( (*x) );
+ add_crossfade (*fade);
+ }
+ x = tmp;
}
}
void AudioPlaylist::notify_crossfade_added (Crossfade *x)
{
- if (atomic_read(&block_notifications)) {
+ if (g_atomic_int_get(&block_notifications)) {
_pending_xfade_adds.insert (_pending_xfade_adds.end(), x);
} else {
NewCrossfade (x); /* EMIT SIGNAL */
AudioRegion* ar = dynamic_cast<AudioRegion*> (*i);
- if (ar && ar->equivalent (other)) {
- results.push_back (ar);
+ if (ar) {
+ if (Config->get_use_overlap_equivalency()) {
+ if (ar->overlap_equivalent (other)) {
+ results.push_back (ar);
+ } else if (ar->equivalent (other)) {
+ results.push_back (ar);
+ }
+ }
}
}
}