fix: address talk streaming build
This commit is contained in:
@@ -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
|
||||||
|
|||||||
@@ -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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user