along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- $Id$
*/
#include <sigc++/bind.h>
_fade_in.add (_length, 1.0);
_fade_in.thaw ();
- // _in->StateChanged.connect (sigc::mem_fun (*this, &Crossfade::member_changed));
- // _out->StateChanged.connect (sigc::mem_fun (*this, &Crossfade::member_changed));
-
overlap_type = _in->coverage (_out->position(), _out->last_frame());
layer_relation = (int32_t) (_in->layer() - _out->layer());
}
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);
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());
_in = bottom;
_out = top;
- _anchor_point = StartOfIn;
+ _anchor_point = EndOfOut;
if (model == FullCrossfade) {
_position = bottom->first_frame(); // "{"
return 0;
}
-void
-Crossfade::member_changed (Change what_changed)
-{
- Change what_we_care_about = Change (Region::MuteChanged|
- Region::LayerChanged|
- BoundsChanged);
-
- if (what_changed & what_we_care_about) {
- try {
- if (what_changed & what_we_care_about) {
- refresh ();
- }
- }
-
- catch (NoCrossfadeHere& err) {
- // relax, Invalidated inside refresh()
- }
- }
-}
-
XMLNode&
Crossfade::get_state ()
{