@@ -20,7 +20,8 @@ public extension Snapshotting where Format == PlatformImage, Value == (AVAudioPC
2020 /// - Parameters:
2121 /// - width: The width of the resulting image.
2222 /// - height: The height of the resulting image.
23- static func waveform( width: Int , height: Int ) -> Snapshotting {
23+ /// - strategy: The strategy to use when generating the waveform. Defaults to `.joinedLines`.
24+ static func waveform( width: Int , height: Int , strategy: WaveformStrategy = . joinedLines) -> Snapshotting {
2425 Snapshotting < PlatformView , PlatformImage > . image ( size: . init( width: width, height: height) )
2526 . pullback { buffer1, buffer2 in
2627 let ( buckets1, max1) = buffer1. reduce ( bucketCount: width)
@@ -33,13 +34,15 @@ public extension Snapshotting where Format == PlatformImage, Value == (AVAudioPC
3334 buckets: data1,
3435 absMax: max1,
3536 height: waveformHeight,
36- color: . red
37+ color: . red,
38+ strategy: strategy
3739 )
3840 let waveform2 = WaveformView (
3941 buckets: data2,
4042 absMax: max2,
4143 height: waveformHeight,
42- color: . green
44+ color: . green,
45+ strategy: strategy
4346 )
4447 let waveform = ZStack {
4548 waveform1
@@ -58,7 +61,8 @@ public extension Snapshotting where Format == PlatformImage, Value == AVAudioPCM
5861 /// - Parameters:
5962 /// - width: The width of the resulting image.
6063 /// - height: The height of the resulting image.
61- static func waveform( width: Int , height: Int ) -> Snapshotting {
64+ /// - strategy: The strategy to use when generating the waveform. Defaults to `.joinedLines`.
65+ static func waveform( width: Int , height: Int , strategy: WaveformStrategy = . joinedLines) -> Snapshotting {
6266 Snapshotting < PlatformView , PlatformImage > . image ( size: . init( width: width, height: height) )
6367 . pullback { buffer in
6468 let verticalPadding : CGFloat = 4
@@ -69,7 +73,8 @@ public extension Snapshotting where Format == PlatformImage, Value == AVAudioPCM
6973 buckets: data,
7074 absMax: max,
7175 height: waveformHeight,
72- color: . red
76+ color: . red,
77+ strategy: strategy
7378 )
7479 . padding ( . vertical, verticalPadding)
7580 . background ( Color . black)
0 commit comments