@@ -43,7 +43,7 @@ public class Visualizer: NSObject, RTCAudioRenderer, FlutterStreamHandler {
43
43
44
44
public let isCentered : Bool
45
45
public let smoothingFactor : Float
46
-
46
+ public let smoothTransition : Bool
47
47
public var bands : [ Float ]
48
48
49
49
private let _processor : AudioVisualizeProcessor
@@ -53,11 +53,13 @@ public class Visualizer: NSObject, RTCAudioRenderer, FlutterStreamHandler {
53
53
binaryMessenger: FlutterBinaryMessenger ,
54
54
bandCount: Int = 7 ,
55
55
isCentered: Bool = true ,
56
+ smoothTransition: Bool = true ,
56
57
smoothingFactor: Float = 0.3 ,
57
58
visualizerId: String )
58
59
{
59
60
self . isCentered = isCentered
60
61
self . smoothingFactor = smoothingFactor
62
+ self . smoothTransition = smoothTransition
61
63
bands = Array ( repeating: 0.0 , count: bandCount)
62
64
_processor = AudioVisualizeProcessor ( bandsCount: bandCount)
63
65
_track = track
@@ -86,7 +88,10 @@ public class Visualizer: NSObject, RTCAudioRenderer, FlutterStreamHandler {
86
88
guard let self else { return }
87
89
88
90
self . bands = zip ( self . bands, newBands) . map { old, new in
89
- self . _smoothTransition ( from: old, to: new, factor: self . smoothingFactor)
91
+ if ( self . smoothTransition) {
92
+ return self . _smoothTransition ( from: old, to: new, factor: self . smoothingFactor)
93
+ }
94
+ return new
90
95
}
91
96
self . eventSink ? ( self . bands)
92
97
}
0 commit comments