@@ -43,7 +43,7 @@ public class Visualizer: NSObject, RTCAudioRenderer, FlutterStreamHandler {
4343
4444 public let isCentered : Bool
4545 public let smoothingFactor : Float
46-
46+ public let smoothTransition : Bool
4747 public var bands : [ Float ]
4848
4949 private let _processor : AudioVisualizeProcessor
@@ -53,11 +53,13 @@ public class Visualizer: NSObject, RTCAudioRenderer, FlutterStreamHandler {
5353 binaryMessenger: FlutterBinaryMessenger ,
5454 bandCount: Int = 7 ,
5555 isCentered: Bool = true ,
56+ smoothTransition: Bool = true ,
5657 smoothingFactor: Float = 0.3 ,
5758 visualizerId: String )
5859 {
5960 self . isCentered = isCentered
6061 self . smoothingFactor = smoothingFactor
62+ self . smoothTransition = smoothTransition
6163 bands = Array ( repeating: 0.0 , count: bandCount)
6264 _processor = AudioVisualizeProcessor ( bandsCount: bandCount)
6365 _track = track
@@ -86,7 +88,10 @@ public class Visualizer: NSObject, RTCAudioRenderer, FlutterStreamHandler {
8688 guard let self else { return }
8789
8890 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
9095 }
9196 self . eventSink ? ( self . bands)
9297 }
0 commit comments