summaryrefslogtreecommitdiff
path: root/scene/3d
diff options
context:
space:
mode:
authorMarkus Sauermann <6299227+Sauermann@users.noreply.github.com>2022-11-22 23:09:30 +0100
committerMarkus Sauermann <6299227+Sauermann@users.noreply.github.com>2023-02-07 14:30:16 +0100
commit826e54fa7356a16f67730f08e4a6fcc8c33c6622 (patch)
tree41a48c14ec1787163462327ff3507e745bd27050 /scene/3d
parent3f02cf7ced320f25ac5f4f72d7a57d98296bfcd1 (diff)
Some code simplifications
1. `number_width` isn't used later 2. `return_type` is used only once 3. AudioServer::get_singleton()->get_channel_count() always returns a channel_count of 1 or larger 4. negative `aa->backward` conditional 5. `current_canvas` == `find_world_2d()->get_canvas()` 6. identical if `render_shadows`
Diffstat (limited to 'scene/3d')
-rw-r--r--scene/3d/audio_stream_player_3d.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/scene/3d/audio_stream_player_3d.cpp b/scene/3d/audio_stream_player_3d.cpp
index 436b936586..77bf15125e 100644
--- a/scene/3d/audio_stream_player_3d.cpp
+++ b/scene/3d/audio_stream_player_3d.cpp
@@ -162,12 +162,10 @@ void AudioStreamPlayer3D::_calc_reverb_vol(Area3D *area, Vector3 listener_area_p
rev_pos.y = 0;
rev_pos.normalize();
- if (channel_count >= 1) {
- // Stereo pair
- float c = rev_pos.x * 0.5 + 0.5;
- reverb_vol.write[0].l = 1.0 - c;
- reverb_vol.write[0].r = c;
- }
+ // Stereo pair.
+ float c = rev_pos.x * 0.5 + 0.5;
+ reverb_vol.write[0].l = 1.0 - c;
+ reverb_vol.write[0].r = c;
if (channel_count >= 3) {
// Center pair + Side pair
@@ -183,7 +181,6 @@ void AudioStreamPlayer3D::_calc_reverb_vol(Area3D *area, Vector3 listener_area_p
if (channel_count >= 4) {
// Rear pair
// FIXME: Not sure what math should be done here
- float c = rev_pos.x * 0.5 + 0.5;
reverb_vol.write[3].l = 1.0 - c;
reverb_vol.write[3].r = c;
}