| 470 | } |
| 471 | |
| 472 | std::optional<std::string> GetCurrentSubtitle() |
| 473 | { |
| 474 | if (!g_Configuration.EnableSound || !g_Configuration.EnableSubtitles) |
| 475 | return std::nullopt; |
| 476 | |
| 477 | auto channel = SoundtrackSlot[(int)SoundTrackType::Voice].Channel; |
| 478 | |
| 479 | if (!BASS_ChannelIsActive(channel)) |
| 480 | return std::nullopt; |
| 481 | |
| 482 | if (Subtitles.empty()) |
| 483 | return std::nullopt; |
| 484 | |
| 485 | long time = long(BASS_ChannelBytes2Seconds(channel, BASS_ChannelGetPosition(channel, BASS_POS_BYTE)) * SOUND_MILLISECONDS_IN_SECOND); |
| 486 | |
| 487 | for (auto* stringPtr : Subtitles) |
| 488 | { |
| 489 | if (time >= stringPtr->getStartTime() && time <= stringPtr->getEndTime()) |
| 490 | return stringPtr->getText(); |
| 491 | } |
| 492 | |
| 493 | return std::nullopt; |
| 494 | } |
| 495 | |
| 496 | void PlaySoundTrack(const std::string& track, SoundTrackType type, std::optional<QWORD> pos, int forceFadeInTime) |
| 497 | { |
no test coverage detected