@@ -84,7 +84,7 @@ public struct BarAudioVisualizer: View {
84
84
@State private var animationTask : Task < Void , Never > ?
85
85
86
86
public init ( audioTrack: AudioTrack ? ,
87
- agentState: AgentState = . unknown ,
87
+ agentState: AgentState = . speaking ,
88
88
barColor: Color = . primary,
89
89
barCount: Int = 5 ,
90
90
barCornerRadius: CGFloat = 100 ,
@@ -180,21 +180,19 @@ extension BarAudioVisualizer {
180
180
181
181
func duration( agentState: AgentState ) -> TimeInterval {
182
182
switch agentState {
183
- case . connecting , . initializing: 2 / Double( barCount)
183
+ case . idle , . initializing: 2 / Double( barCount)
184
184
case . listening: 0.5
185
185
case . thinking: 0.15
186
186
case . speaking: veryLongDuration
187
- default : veryLongDuration
188
187
}
189
188
}
190
189
191
190
func highlightingSequence( agentState: AgentState ) -> [ HighlightedBars ] {
192
191
switch agentState {
193
- case . connecting, . initializing: ( 0 ..< barCount) . map { HighlightedBars ( [ $0, barCount - 1 - $0] ) }
194
- case . thinking: Array ( ( 0 ..< barCount) + ( 0 ..< barCount) . reversed ( ) ) . map { HighlightedBars ( [ $0] ) }
192
+ case . idle, . initializing: ( 0 ..< barCount) . map { HighlightedBars ( [ $0, barCount - 1 - $0] ) }
195
193
case . listening: barCount % 2 == 0 ? [ [ ( barCount / 2 ) - 1 , barCount / 2 ] , [ ] ] : [ [ barCount / 2 ] , [ ] ]
196
- case . speaking , . unknown : [ HighlightedBars ( 0 ..< barCount) ]
197
- case . disconnected : [ [ ] ]
194
+ case . thinking : Array ( ( 0 ..< barCount ) + ( 0 ..< barCount) . reversed ( ) ) . map { HighlightedBars ( [ $0 ] ) }
195
+ case . speaking : [ HighlightedBars ( 0 ..< barCount ) ]
198
196
}
199
197
}
200
198
}
0 commit comments