Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add blip rate of 0 which only plays a single blip sound per message #659

Merged
merged 2 commits into from
Mar 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/aooptionsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
4 changes: 2 additions & 2 deletions src/courtroom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3609,7 +3609,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:
Expand All @@ -3620,7 +3620,7 @@ void Courtroom::chat_tick()
qMax(b_rate, qRound(static_cast<float>(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();
Expand Down
4 changes: 2 additions & 2 deletions src/text_file_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Comment on lines +13 to +14
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: statement should be inside braces [readability-braces-around-statements]

Suggested change
if (result < 0)
return 0;
if (result < 0) {
return 0;
}


return result;
}
Expand Down