diff options
| author | Crystalwarrior <varsash@gmail.com> | 2020-09-11 23:38:36 +0300 |
|---|---|---|
| committer | Crystalwarrior <varsash@gmail.com> | 2020-09-11 23:38:36 +0300 |
| commit | d00d0769a9bf325df5bb25d7a7a4bd376b539b3c (patch) | |
| tree | fe74166b82030106f792251852c3255f5be4a564 /src/courtroom.cpp | |
| parent | 8cc067dee42ede24614f1a7bccef7f8752f56a01 (diff) | |
Lots of blip rate fixes:
Remove qElapsedTimer method of blip earrape protection due to major inconsistency issues with this method (the same message would produce wildly different blip sounds - consistency is preferred)
More sophisticated blip earrape prevention is calculated in the chat ticker function itself, it also properly adjusts itself depending on the blip_rate used.
Diffstat (limited to 'src/courtroom.cpp')
| -rw-r--r-- | src/courtroom.cpp | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 3e00158e..13a9a6b7 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -2943,7 +2943,17 @@ void Courtroom::chat_tick() // I am you // ! ! ! ! // where ! is the blip sound - if (blip_ticker % blip_rate == 0) { + int b_rate = blip_rate; + // Earrape prevention without using timers, this method is more consistent. + if (msg_delay != 0 && msg_delay <= 25) { + // The default blip speed is 40ms, and if current msg_delay is 25ms, + // the formula will result in the blip rate of: + // 40/25 = 1.6 = 2 + // And if it's faster than that: + // 40/10 = 4 + b_rate = qMax(b_rate, qRound(static_cast<float>(message_display_speed[3])/msg_delay)); + } + if (blip_ticker % b_rate == 0) { // ignoring white space unless blank_blip is enabled. if (!formatting_char && (f_character != ' ' || blank_blip)) { blip_player->blip_tick(); @@ -2958,9 +2968,10 @@ void Courtroom::chat_tick() ++blip_ticker; } - // Punctuation delayer - if (punctuation_chars.contains(f_character)) { - msg_delay *= punctuation_modifier; + // Punctuation delayer, only kicks in on speed ticks less than }} + if (current_display_speed > 1 && punctuation_chars.contains(f_character)) { + // Making the user have to wait any longer than 150ms per letter is downright unreasonable + msg_delay = qMin(150, msg_delay * punctuation_modifier); } // If this color is talking |
