From 4560589e25d51669ea4aa9f84cd5be83cf124b1b Mon Sep 17 00:00:00 2001 From: Jonas Kulla Date: Tue, 23 Dec 2014 20:12:47 +0100 Subject: [PATCH] Audio: Set overall volume of OpenAL output to 0.8 --- src/al-util.h | 1 + src/audiostream.cpp | 2 +- src/soundemitter.cpp | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/al-util.h b/src/al-util.h index 08c126e..78ae615 100644 --- a/src/al-util.h +++ b/src/al-util.h @@ -238,5 +238,6 @@ inline ALenum chooseALFormat(int sampleSize, int channelCount) #define AUDIO_SLEEP 10 #define STREAM_BUF_SIZE 32768 +#define GLOBAL_VOLUME 0.8 #endif // ALUTIL_H diff --git a/src/audiostream.cpp b/src/audiostream.cpp index 16cade7..75f7acd 100644 --- a/src/audiostream.cpp +++ b/src/audiostream.cpp @@ -252,7 +252,7 @@ float AudioStream::playingOffset() void AudioStream::updateVolume() { - float vol = 1.0; + float vol = GLOBAL_VOLUME; for (size_t i = 0; i < VolumeTypeCount; ++i) vol *= volumes[i]; diff --git a/src/soundemitter.cpp b/src/soundemitter.cpp index 965556c..57c81fc 100644 --- a/src/soundemitter.cpp +++ b/src/soundemitter.cpp @@ -168,7 +168,7 @@ void SoundEmitter::play(const std::string &filename, if (switchBuffer) AL::Source::attachBuffer(src, buffer->alBuffer); - AL::Source::setVolume(src, _volume); + AL::Source::setVolume(src, _volume * GLOBAL_VOLUME); AL::Source::setPitch(src, _pitch); AL::Source::play(src);