1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-09 12:50:35 +00:00

Remove ABS in favor of Math::abs

This commit is contained in:
kobewi
2022-11-30 17:56:32 +01:00
parent 3d9b05ad4a
commit 10f6c01b9c
68 changed files with 142 additions and 146 deletions

View File

@@ -300,13 +300,13 @@ void AudioServer::_driver_process(int p_frames, int32_t *p_buffer) {
for (int j = 0; j < to_copy; j++) {
float l = CLAMP(buf[from + j].left, -1.0, 1.0);
int32_t vl = l * ((1 << 20) - 1);
int32_t vl2 = (vl < 0 ? -1 : 1) * (ABS(vl) << 11);
int32_t vl2 = (vl < 0 ? -1 : 1) * (Math::abs(vl) << 11);
*dest = vl2;
dest++;
float r = CLAMP(buf[from + j].right, -1.0, 1.0);
int32_t vr = r * ((1 << 20) - 1);
int32_t vr2 = (vr < 0 ? -1 : 1) * (ABS(vr) << 11);
int32_t vr2 = (vr < 0 ? -1 : 1) * (Math::abs(vr) << 11);
*dest = vr2;
dest += stride_minus_one;
}
@@ -621,11 +621,11 @@ void AudioServer::_mix_step() {
for (uint32_t j = 0; j < buffer_size; j++) {
buf[j] *= volume;
float l = ABS(buf[j].left);
float l = Math::abs(buf[j].left);
if (l > peak.left) {
peak.left = l;
}
float r = ABS(buf[j].right);
float r = Math::abs(buf[j].right);
if (r > peak.right) {
peak.right = r;
}