File tree Expand file tree Collapse file tree 4 files changed +22
-0
lines changed Expand file tree Collapse file tree 4 files changed +22
-0
lines changed Original file line number Diff line number Diff line change 45
45
fn next_source_frame ( & mut self , source_frame : Self :: Frame ) {
46
46
self . left = source_frame;
47
47
}
48
+
49
+ fn reset ( & mut self ) {
50
+ self . left = Self :: Frame :: EQUILIBRIUM ;
51
+ }
48
52
}
Original file line number Diff line number Diff line change @@ -48,4 +48,9 @@ pub trait Interpolator {
48
48
49
49
/// To be called whenever the Interpolator value steps passed 1.0.
50
50
fn next_source_frame ( & mut self , source_frame : Self :: Frame ) ;
51
+
52
+ /// Resets the state of the interpolator.
53
+ ///
54
+ /// Call this when there's a break in the continuity of the input data stream.
55
+ fn reset ( & mut self ) ;
51
56
}
Original file line number Diff line number Diff line change 59
59
self . left = self . right ;
60
60
self . right = source_frame;
61
61
}
62
+
63
+ fn reset ( & mut self ) {
64
+ self . left = Self :: Frame :: EQUILIBRIUM ;
65
+ self . right = Self :: Frame :: EQUILIBRIUM ;
66
+ }
62
67
}
Original file line number Diff line number Diff line change @@ -121,4 +121,12 @@ where
121
121
self . idx += 1 ;
122
122
}
123
123
}
124
+
125
+ fn reset ( & mut self ) {
126
+ self . idx = 0 ;
127
+ self . frames . set_first ( 0 ) ;
128
+ for frame in self . frames . iter_mut ( ) {
129
+ * frame = Self :: Frame :: EQUILIBRIUM ;
130
+ }
131
+ }
124
132
}
You can’t perform that action at this time.
0 commit comments