mirror of
https://github.com/mkxp-z/mkxp-z.git
synced 2025-07-01 22:25:17 +02:00
Apply global volume after applying volume scale
This commit is contained in:
parent
aaf5d3c8bf
commit
d04b383667
3 changed files with 4 additions and 5 deletions
|
@ -181,11 +181,11 @@ namespace Source
|
|||
break;
|
||||
case VolumeScale::Db35:
|
||||
if (value > FLT_EPSILON) {
|
||||
value = std::powf(10., -(35. / 20.) * (1. - value));
|
||||
value = std::powf(10.0f, -(35.0f / 20.0f) * (1.0f - value));
|
||||
}
|
||||
break;
|
||||
}
|
||||
alSourcef(id.al, AL_GAIN, value);
|
||||
alSourcef(id.al, AL_GAIN, value * 0.8f);
|
||||
}
|
||||
|
||||
inline void setPitch(Source::ID id, float value)
|
||||
|
@ -269,6 +269,5 @@ inline ALenum chooseALFormat(int sampleSize, int channelCount)
|
|||
|
||||
#define AUDIO_SLEEP 10
|
||||
#define STREAM_BUF_SIZE 32768
|
||||
#define GLOBAL_VOLUME 0.8f
|
||||
|
||||
#endif // ALUTIL_H
|
||||
|
|
|
@ -260,7 +260,7 @@ float AudioStream::playingOffset()
|
|||
|
||||
void AudioStream::updateVolume()
|
||||
{
|
||||
float vol = GLOBAL_VOLUME;
|
||||
float vol = 1.0f;
|
||||
|
||||
for (size_t i = 0; i < VolumeTypeCount; ++i)
|
||||
vol *= volumes[i];
|
||||
|
|
|
@ -172,7 +172,7 @@ void SoundEmitter::play(const std::string &filename,
|
|||
if (switchBuffer)
|
||||
AL::Source::attachBuffer(src, buffer->alBuffer);
|
||||
|
||||
AL::Source::setVolume(src, _volume * GLOBAL_VOLUME, AL::Source::Linear);
|
||||
AL::Source::setVolume(src, _volume, AL::Source::Linear);
|
||||
AL::Source::setPitch(src, _pitch);
|
||||
|
||||
AL::Source::play(src);
|
||||
|
|
Loading…
Add table
Reference in a new issue