From 40f200e066e884ac20fbf6958d4c4482c274e7f3 Mon Sep 17 00:00:00 2001 From: ZarothYe Date: Sun, 6 Mar 2022 09:04:27 -0600 Subject: [PATCH] Don't display previous subtitles all at once when subtitles are enabled mid-audio play --- Sources/Plasma/PubUtilLib/plAudio/plWin32Sound.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Sources/Plasma/PubUtilLib/plAudio/plWin32Sound.cpp b/Sources/Plasma/PubUtilLib/plAudio/plWin32Sound.cpp index 2fcbe712..945363a2 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plWin32Sound.cpp +++ b/Sources/Plasma/PubUtilLib/plAudio/plWin32Sound.cpp @@ -111,14 +111,16 @@ void plWin32Sound::IFreeBuffers( void ) void plWin32Sound::Update() { plSoundBuffer* buf = GetDataBuffer(); - if (plgAudioSys::AreSubtitlesEnabled() && buf != nullptr) { + if (buf != nullptr) { plSrtFileReader* srtReader = buf->GetSrtReader(); if (srtReader != nullptr) { uint32_t currentTimeMs = (uint32_t)(GetActualTimeSec() * 1000.0f); while (plSrtEntry* nextEntry = srtReader->GetNextEntryStartingBeforeTime(currentTimeMs)) { - // add a plSubtitleMsg to go... to whoever is listening (probably the KI) - plSubtitleMsg* msg = new plSubtitleMsg(nextEntry->GetSubtitleText(), nextEntry->GetSpeakerName()); - msg->Send(); + if (plgAudioSys::AreSubtitlesEnabled()) { + // add a plSubtitleMsg to go... to whoever is listening (probably the KI) + plSubtitleMsg* msg = new plSubtitleMsg(nextEntry->GetSubtitleText(), nextEntry->GetSpeakerName()); + msg->Send(); + } } } }