opaque xfade patch + a version of the editor ruler/playhead/click patch
[ardour.git] / libs / ardour / crossfade.cc
index c217b76422698e0592674284db687cbc396ae4f9..e1df8228ce4957d632b8d9b990b4a40f9361cd37 100644 (file)
@@ -268,6 +268,13 @@ Crossfade::read_at (Sample *buf, Sample *mixdown_buffer,
 
        offset = start - _position;
 
+       /* Prevent data from piling up inthe crossfade buffers when reading a transparent region */
+       if (!(_out->opaque())) {
+               memset (crossfade_buffer_out, 0, sizeof (Sample) * to_write);
+       } else if (!(_in->opaque())) {
+               memset (crossfade_buffer_in, 0, sizeof (Sample) * to_write);
+       }
+
        _out->read_at (crossfade_buffer_out, mixdown_buffer, gain_buffer, start, to_write, chan_n, read_frames, skip_frames);
        _in->read_at (crossfade_buffer_in, mixdown_buffer, gain_buffer, start, to_write, chan_n, read_frames, skip_frames);
 
@@ -332,6 +339,13 @@ Crossfade::refresh ()
                return false;
        }
 
+       /* Top layer shouldn't be transparent */
+
+       if (!((layer_relation > 0 ? _in : _out)->opaque())) {
+               Invalidated (shared_from_this());
+               return false;
+       }
+
        /* layer ordering cannot change */
 
        int32_t new_layer_relation = (int32_t) (_in->layer() - _out->layer());