fix: address talk streaming build

This commit is contained in:
Peter Steinberger
2025-12-30 12:20:32 +01:00
parent 27adfb76fa
commit 9df22c0093
2 changed files with 5 additions and 4 deletions

View File

@@ -500,7 +500,7 @@ actor TalkModeRuntime {
if let apiKey, !apiKey.isEmpty, let voiceId { if let apiKey, !apiKey.isEmpty, let voiceId {
let desiredOutputFormat = directive?.outputFormat ?? self.defaultOutputFormat ?? "pcm_44100" let desiredOutputFormat = directive?.outputFormat ?? self.defaultOutputFormat ?? "pcm_44100"
let outputFormat = ElevenLabsTTSClient.validatedOutputFormat(desiredOutputFormat) let outputFormat = ElevenLabsTTSClient.validatedOutputFormat(desiredOutputFormat)
if outputFormat == nil, let desiredOutputFormat, !desiredOutputFormat.isEmpty { if outputFormat == nil, !desiredOutputFormat.isEmpty {
self.logger self.logger
.warning( .warning(
"talk output_format unsupported for local playback: \(desiredOutputFormat, privacy: .public)") "talk output_format unsupported for local playback: \(desiredOutputFormat, privacy: .public)")
@@ -639,11 +639,12 @@ actor TalkModeRuntime {
} }
func stopSpeaking(reason: TalkStopReason) async { func stopSpeaking(reason: TalkStopReason) async {
let usePCM = self.lastPlaybackWasPCM
let interruptedAt = await MainActor.run { let interruptedAt = await MainActor.run {
let primary = self.lastPlaybackWasPCM let primary = usePCM
? PCMStreamingAudioPlayer.shared.stop() ? PCMStreamingAudioPlayer.shared.stop()
: StreamingAudioPlayer.shared.stop() : StreamingAudioPlayer.shared.stop()
_ = self.lastPlaybackWasPCM _ = usePCM
? StreamingAudioPlayer.shared.stop() ? StreamingAudioPlayer.shared.stop()
: PCMStreamingAudioPlayer.shared.stop() : PCMStreamingAudioPlayer.shared.stop()
return primary return primary

View File

@@ -143,7 +143,7 @@ private final class Playback: @unchecked Sendable {
return return
} }
self.enqueueCurrentBuffer(flushOnly: true) self.enqueueCurrentBuffer(flushOnly: true)
self.stop(immediate: false) _ = self.stop(immediate: false)
} }
} }