From 698101ebc0ed67044a000316fe3014e048b18963 Mon Sep 17 00:00:00 2001 From: damullan Date: Fri, 15 May 2026 11:20:14 +0100 Subject: [PATCH 1/2] Clear consumed cutscene audio block --- ArtemisRoleplayingKit/Voice/AddonTalkHandler.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/ArtemisRoleplayingKit/Voice/AddonTalkHandler.cs b/ArtemisRoleplayingKit/Voice/AddonTalkHandler.cs index 7b959e1..72503ba 100644 --- a/ArtemisRoleplayingKit/Voice/AddonTalkHandler.cs +++ b/ArtemisRoleplayingKit/Voice/AddonTalkHandler.cs @@ -602,7 +602,7 @@ private void Framework_Update(IFramework framework) { if (_currentDialoguePaths.Count > 0) { _currentDialoguePaths[_currentDialoguePaths.ElementAt(_currentDialoguePaths.Count - 1).Key] = true; } - _blockAudioGeneration = false; + ClearConsumedAudioGenerationBlock("talk state handled"); } } else if (stateSnapshot != null) { TraceNpcTtsDebug($"Ignored talk state speaker='{stateSnapshot.Speaker}' textPresent={!string.IsNullOrEmpty(stateSnapshot.Text)} text='{PreviewText(stateSnapshot.Text)}'"); @@ -717,6 +717,18 @@ private async void AutoAdvancePauseOnlyDialogue(string pauseText, long sequence) } } + private void ClearConsumedAudioGenerationBlock(string reason) { + if (!_blockAudioGeneration) { + return; + } + + // Cutscene audio blocks are intended to suppress one matching NPC line. + // Clear the flag once that block has been consumed so it cannot leak into + // later manually advanced dialogue after the voiced scene has ended. + _blockAudioGeneration = false; + TraceNpcTts($"Cleared consumed cutscene audio block reason='{reason}' blockCount={_blockAudioGenerationCount}"); + } + private bool ShouldSkipNpcText(string npcName, string message) { if (!VerifyIsEnglish(message, out var languageRejectionReason)) { Plugin.PluginLog.Information($"[NPC TTS] Skipping text for npc='{npcName}' reason='{languageRejectionReason}' text='{PreviewText(message)}'"); @@ -1411,6 +1423,7 @@ await _plugin.NpcVoiceManager.GetCharacterAudio(stream, value, arcValue, initial }, _plugin.Config.NPCSpeechSpeed, values.Item2 == "Elevenlabs" ? 0.5f : (values.Item2 == "XTTS" ? 1.8f : 1.8f)); } else { TraceNpcTts($"Audio ready but playback suppressed by blockAudioGeneration sequence={request.Sequence} npc='{nameToUse}' text='{PreviewText(value)}'"); + ClearConsumedAudioGenerationBlock("npc audio playback suppressed"); } } break; From 5c047efa47735348a99abb0420041d18e4e711e6 Mon Sep 17 00:00:00 2001 From: damullan Date: Fri, 15 May 2026 11:26:01 +0100 Subject: [PATCH 2/2] Document late cutscene block reset --- ArtemisRoleplayingKit/Voice/AddonTalkHandler.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ArtemisRoleplayingKit/Voice/AddonTalkHandler.cs b/ArtemisRoleplayingKit/Voice/AddonTalkHandler.cs index 72503ba..d7b11df 100644 --- a/ArtemisRoleplayingKit/Voice/AddonTalkHandler.cs +++ b/ArtemisRoleplayingKit/Voice/AddonTalkHandler.cs @@ -1423,6 +1423,8 @@ await _plugin.NpcVoiceManager.GetCharacterAudio(stream, value, arcValue, initial }, _plugin.Config.NPCSpeechSpeed, values.Item2 == "Elevenlabs" ? 0.5f : (values.Item2 == "XTTS" ? 1.8f : 1.8f)); } else { TraceNpcTts($"Audio ready but playback suppressed by blockAudioGeneration sequence={request.Sequence} npc='{nameToUse}' text='{PreviewText(value)}'"); + // A cutscene SCD can arrive while a relay request is in flight. + // Once that late response is suppressed, the block has done its job. ClearConsumedAudioGenerationBlock("npc audio playback suppressed"); } }