mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-21 12:49:10 +00:00
Don't feed remaining subtitles when audio skips to past the end of last subtitle
This commit is contained in:
@ -115,6 +115,7 @@ void plWin32Sound::Update()
|
|||||||
plSrtFileReader* srtReader = buf->GetSrtReader();
|
plSrtFileReader* srtReader = buf->GetSrtReader();
|
||||||
if (srtReader != nullptr) {
|
if (srtReader != nullptr) {
|
||||||
uint32_t currentTimeMs = (uint32_t)(GetActualTimeSec() * 1000.0f);
|
uint32_t currentTimeMs = (uint32_t)(GetActualTimeSec() * 1000.0f);
|
||||||
|
if (currentTimeMs <= srtReader->GetLastEntryEndTime()) {
|
||||||
while (plSrtEntry* nextEntry = srtReader->GetNextEntryStartingBeforeTime(currentTimeMs)) {
|
while (plSrtEntry* nextEntry = srtReader->GetNextEntryStartingBeforeTime(currentTimeMs)) {
|
||||||
if (plgAudioSys::AreSubtitlesEnabled()) {
|
if (plgAudioSys::AreSubtitlesEnabled()) {
|
||||||
// add a plSubtitleMsg to go... to whoever is listening (probably the KI)
|
// add a plSubtitleMsg to go... to whoever is listening (probably the KI)
|
||||||
@ -124,6 +125,7 @@ void plWin32Sound::Update()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
plSound::Update();
|
plSound::Update();
|
||||||
}
|
}
|
||||||
|
@ -185,3 +185,12 @@ plSrtEntry* plSrtFileReader::GetNextEntryEndingBeforeTime(uint32_t timeMs)
|
|||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t plSrtFileReader::GetLastEntryEndTime()
|
||||||
|
{
|
||||||
|
if (!fEntries.empty()) {
|
||||||
|
return fEntries.back().GetEndTimeMs();
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
@ -95,6 +95,7 @@ public:
|
|||||||
void AdvanceToTime(uint32_t timeMs);
|
void AdvanceToTime(uint32_t timeMs);
|
||||||
plSrtEntry* GetNextEntryStartingBeforeTime(uint32_t timeMs);
|
plSrtEntry* GetNextEntryStartingBeforeTime(uint32_t timeMs);
|
||||||
plSrtEntry* GetNextEntryEndingBeforeTime(uint32_t timeMs);
|
plSrtEntry* GetNextEntryEndingBeforeTime(uint32_t timeMs);
|
||||||
|
uint32_t GetLastEntryEndTime();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user