Skip to content

Commit 31a2dba

Browse files
committed
Add workaround to 0. crossfade duration.
1 parent 846560b commit 31a2dba

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/core/operators/cross.ml

+8-4
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ class cross val_source ~duration_getter ~override_duration ~persist_override
6565
* Going with the same choice as above for now. *)
6666
method self_sync = s#self_sync
6767
val mutable cross_length = Lazy.force Frame.size
68+
val mutable rejected_cross_length = None
6869
val mutable duration_getter = original_duration_getter
6970
method cross_duration = duration_getter ()
7071

@@ -73,16 +74,19 @@ class cross val_source ~duration_getter ~override_duration ~persist_override
7374
let main_new_cross_length = Frame.main_of_seconds new_cross_length in
7475

7576
if main_new_cross_length <> cross_length then
76-
if new_cross_length < 0. then
77-
self#log#important
78-
"Cannot set crossfade duration to negative value %f!"
79-
new_cross_length
77+
if new_cross_length <= 0. then (
78+
if rejected_cross_length <> Some new_cross_length then (
79+
self#log#critical "Invalid cross duration: %.2f <= 0.!"
80+
new_cross_length;
81+
rejected_cross_length <- Some new_cross_length);
82+
cross_length <- Lazy.force Frame.size)
8083
else (
8184
let main_new_cross_length =
8285
max (Lazy.force Frame.size) main_new_cross_length
8386
in
8487
self#log#info "Setting crossfade duration to %.2fs"
8588
(Frame.seconds_of_main main_new_cross_length);
89+
rejected_cross_length <- None;
8690
cross_length <- main_new_cross_length)
8791

8892
initializer self#set_cross_length

0 commit comments

Comments
 (0)