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
This commit is contained in:
Crystalwarrior 2022-03-19 23:31:38 +03:00 committed by GitHub
parent fa6eef8eba
commit df1c8ccd83
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 6 deletions

View File

@ -751,10 +751,10 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app)
ui_audio_layout->setWidget(row, QFormLayout::LabelRole, ui_bliprate_lbl); ui_audio_layout->setWidget(row, QFormLayout::LabelRole, ui_bliprate_lbl);
ui_bliprate_spinbox = new QSpinBox(ui_audio_widget); ui_bliprate_spinbox = new QSpinBox(ui_audio_widget);
ui_bliprate_spinbox->setMinimum(1); ui_bliprate_spinbox->setMinimum(0);
ui_bliprate_spinbox->setToolTip( ui_bliprate_spinbox->setToolTip(
tr("Play a blip sound \"once per every X symbols\", where " 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); ui_audio_layout->setWidget(row, QFormLayout::FieldRole, ui_bliprate_spinbox);

View File

@ -3614,7 +3614,7 @@ void Courtroom::chat_tick()
// ! ! ! ! // ! ! ! !
// where ! is the blip sound // where ! is the blip sound
int b_rate = blip_rate; 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) { if (msg_delay != 0 && msg_delay <= 25) {
// The default blip speed is 40ms, and if current msg_delay is 25ms, // The default blip speed is 40ms, and if current msg_delay is 25ms,
// the formula will result in the blip rate of: // the formula will result in the blip rate of:
@ -3625,7 +3625,7 @@ void Courtroom::chat_tick()
qMax(b_rate, qRound(static_cast<float>(text_crawl) / qMax(b_rate, qRound(static_cast<float>(text_crawl) /
msg_delay)); 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. // ignoring white space unless blank_blip is enabled.
if (!formatting_char && (f_character != ' ' || blank_blip)) { if (!formatting_char && (f_character != ' ' || blank_blip)) {
blip_player->blip_tick(); blip_player->blip_tick();

View File

@ -10,8 +10,8 @@ int AOApplication::read_blip_rate()
{ {
int result = configini->value("blip_rate", 2).toInt(); int result = configini->value("blip_rate", 2).toInt();
if (result < 1) if (result < 0)
return 1; return 0;
return result; return result;
} }