Skip to content

Commit 628fc21

Browse files
MKV21obviyus
authored andcommitted
Android: stop reply speaker on voice teardown
1 parent 5942b10 commit 628fc21

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

apps/android/app/src/main/java/ai/openclaw/app/NodeRuntime.kt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -760,7 +760,7 @@ class NodeRuntime(
760760
prefs.setTalkEnabled(value)
761761
if (value) {
762762
// Tapping mic on interrupts any active TTS (barge-in)
763-
talkMode.stopTts()
763+
stopVoicePlayback()
764764
talkMode.ttsOnAllResponses = false
765765
scope.launch { talkMode.ensureChatSubscribed() }
766766
}
@@ -782,12 +782,19 @@ class NodeRuntime(
782782

783783
private fun stopActiveVoiceSession() {
784784
talkMode.ttsOnAllResponses = false
785-
talkMode.stopTts()
785+
stopVoicePlayback()
786786
micCapture.setMicEnabled(false)
787787
prefs.setTalkEnabled(false)
788788
externalAudioCaptureActive.value = false
789789
}
790790

791+
private fun stopVoicePlayback() {
792+
talkMode.stopTts()
793+
if (voiceReplySpeakerLazy.isInitialized()) {
794+
voiceReplySpeaker.stopTts()
795+
}
796+
}
797+
791798
fun refreshGatewayConnection() {
792799
val endpoint =
793800
connectedEndpoint ?: run {

apps/android/app/src/main/java/ai/openclaw/app/voice/MicCaptureManager.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ class MicCaptureManager(
244244
pendingRunId = null
245245
pendingAssistantEntryId = null
246246
_isSending.value = false
247-
if (messageQueue.isNotEmpty()) {
247+
if (hasQueuedMessages()) {
248248
_statusText.value = queuedWaitingStatus()
249249
}
250250
}
@@ -352,7 +352,7 @@ class MicCaptureManager(
352352
_statusText.value =
353353
when {
354354
_isSending.value -> "Listening · sending queued voice"
355-
messageQueue.isNotEmpty() -> "Listening · ${messageQueue.size} queued"
355+
hasQueuedMessages() -> "Listening · ${queuedMessageCount()} queued"
356356
else -> "Listening"
357357
}
358358
_isListening.value = true

0 commit comments

Comments
 (0)