From df1c8ccd8341b521fba63ed397646d9055854454 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Sat, 19 Mar 2022 23:31:38 +0300 Subject: [PATCH] Add blip rate of 0 which only plays a single blip sound per message (#659) * Add blip rate of 0 which only plays a single blip sound per message * don't have copy-pasted code I GUESS --- src/aooptionsdialog.cpp | 4 ++-- src/courtroom.cpp | 4 ++-- src/text_file_functions.cpp | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/aooptionsdialog.cpp b/src/aooptionsdialog.cpp index 589bc92..6af93ed 100644 --- a/src/aooptionsdialog.cpp +++ b/src/aooptionsdialog.cpp @@ -751,10 +751,10 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) ui_audio_layout->setWidget(row, QFormLayout::LabelRole, ui_bliprate_lbl); ui_bliprate_spinbox = new QSpinBox(ui_audio_widget); - ui_bliprate_spinbox->setMinimum(1); + ui_bliprate_spinbox->setMinimum(0); ui_bliprate_spinbox->setToolTip( tr("Play a blip sound \"once per every X symbols\", where " - "X is the blip rate.")); + "X is the blip rate. 0 plays a blip sound only once.")); ui_audio_layout->setWidget(row, QFormLayout::FieldRole, ui_bliprate_spinbox); diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 69040ff..37ad846 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -3614,7 +3614,7 @@ void Courtroom::chat_tick() // ! ! ! ! // where ! is the blip sound int b_rate = blip_rate; - // Earrape prevention without using timers, this method is more consistent. + // Overwhelming blip spam prevention, this method is more consistent than timers 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: @@ -3625,7 +3625,7 @@ void Courtroom::chat_tick() qMax(b_rate, qRound(static_cast(text_crawl) / msg_delay)); } - if (blip_ticker % b_rate == 0) { + if ((blip_rate <= 0 && blip_ticker < 1) || (b_rate > 0 && blip_ticker % b_rate == 0)) { // ignoring white space unless blank_blip is enabled. if (!formatting_char && (f_character != ' ' || blank_blip)) { blip_player->blip_tick(); diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index a0caf9b..e3a285d 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -10,8 +10,8 @@ int AOApplication::read_blip_rate() { int result = configini->value("blip_rate", 2).toInt(); - if (result < 1) - return 1; + if (result < 0) + return 0; return result; }