Add dialog to allow removal of plugin presets. Should fix #2662.
[ardour.git] / libs / ardour / crossfade.cc
index 6b0c0a9560d3248f38d1893364a6c521b3da88f8..b22dd15c9cf4e31ed2d6eb972ae3a4d1c118f1d4 100644 (file)
@@ -355,7 +355,7 @@ Crossfade::read_at (Sample *buf, Sample *mixdown_buffer,
 
                start = _position;
                buf += offset;
-               to_write = min (_length.val(), (nframes64_t) cnt);
+               to_write = min (_length.val(), cnt);
 
        } else {
 
@@ -868,6 +868,11 @@ Crossfade::set_state (const XMLNode& node, int /*version*/)
                }
        }
 
+        if (_fade_in.size() < 2) {
+                /* fade state somehow saved with no points */
+                return -1;
+        }
+
         _fade_in.front()->value = 0.0;
         _fade_in.back()->value = 1.0;
 
@@ -896,6 +901,11 @@ Crossfade::set_state (const XMLNode& node, int /*version*/)
                }
        }
 
+        if (_fade_out.size() < 2) {
+                /* fade state somehow saved with no points */
+                return -1;
+        }
+
         _fade_out.front()->value = 1.0;
         _fade_out.back()->value = 0.0;