1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-25 15:54:31 +01:00

Use C++'s std::abs instead of C's to get floats

C's abs() will only work on int values, only std::abs will get floats.
This commit is contained in:
Michał Janiszewski
2015-11-11 08:05:52 +01:00
parent 1f08f092dd
commit 2b02a04114

View File

@@ -26,6 +26,7 @@ extern "C" {
#include "audio.h"
}
#include "mixer.h"
#include <cmath>
Mixer gMixer;
@@ -393,7 +394,7 @@ void Channel::SetPan(float pan)
if (pan < 0) {
Channel::pan = 0;
}
double decibels = (abs(Channel::pan - 0.5) * 2.0) * 100.0;
double decibels = (std::abs(Channel::pan - 0.5) * 2.0) * 100.0;
double attenuation = pow(10, decibels / 20.0);
if (Channel::pan <= 0.5) {
volume_l = 1.0;