Merge pull request #953 from Pablo-Dallegri/alerts-volume

Add volume adjustment for alerts
This commit is contained in:
yvt 2021-05-08 13:13:25 +09:00 committed by GitHub
commit 0d73f3cfcb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -661,6 +661,7 @@ namespace spades {
layouter.AddVolumeSlider(_Tr("Preferences", "Chat Notify Sounds"), "cg_chatBeep");
layouter.AddToggleField(_Tr("Preferences", "Hit Indicator"), "cg_hitIndicator");
layouter.AddToggleField(_Tr("Preferences", "Show Alerts"), "cg_alerts");
layouter.AddVolumeSlider(_Tr("Preferences", "Alert Sounds"), "cg_alertSounds");
layouter.AddHeading(_Tr("Preferences", "AoS 0.75/0.76 Compatibility"));
layouter.AddToggleField(_Tr("Preferences", "Allow Unicode"), "cg_unicode");

View File

@ -56,6 +56,7 @@
#include "NetClient.h"
DEFINE_SPADES_SETTING(cg_chatBeep, "1");
DEFINE_SPADES_SETTING(cg_alertSounds, "1");
DEFINE_SPADES_SETTING(cg_serverAlert, "1");
@ -537,7 +538,9 @@ namespace spades {
void Client::PlayAlertSound() {
Handle<IAudioChunk> chunk = audioDevice->RegisterSound("Sounds/Feedback/Alert.opus");
audioDevice->PlayLocal(chunk.GetPointerOrNull(), AudioParam());
AudioParam params;
params.volume = (float)cg_alertSounds;
audioDevice->PlayLocal(chunk.GetPointerOrNull(), params);
}
/** Records chat message/game events to the log file. */