summaryrefslogtreecommitdiff
path: root/servers/audio
diff options
context:
space:
mode:
authorAaron Franke <arnfranke@yahoo.com>2021-09-07 23:25:35 -0500
committerAaron Franke <arnfranke@yahoo.com>2021-10-12 00:17:27 -0500
commit7e51e4cb84aeb3c191289752e0e6b92facd8f7f6 (patch)
treee07661aeb47a95dbbce602440099da860e2d0c06 /servers/audio
parentf9aec342dcd51d65c5970dd395e3c7a66cac446c (diff)
Fix some LGTM errors of "Multiplication result converted to larger type"
Diffstat (limited to 'servers/audio')
-rw-r--r--servers/audio/audio_driver_dummy.cpp2
-rw-r--r--servers/audio/audio_rb_resampler.cpp5
2 files changed, 4 insertions, 3 deletions
diff --git a/servers/audio/audio_driver_dummy.cpp b/servers/audio/audio_driver_dummy.cpp
index a28dcb1015..47799dce96 100644
--- a/servers/audio/audio_driver_dummy.cpp
+++ b/servers/audio/audio_driver_dummy.cpp
@@ -46,7 +46,7 @@ Error AudioDriverDummy::init() {
int latency = GLOBAL_GET("audio/driver/output_latency");
buffer_frames = closest_power_of_2(latency * mix_rate / 1000);
- samples_in = memnew_arr(int32_t, buffer_frames * channels);
+ samples_in = memnew_arr(int32_t, (size_t)buffer_frames * channels);
thread.start(AudioDriverDummy::thread_func, this);
diff --git a/servers/audio/audio_rb_resampler.cpp b/servers/audio/audio_rb_resampler.cpp
index 3c8a1469cd..d9c442facf 100644
--- a/servers/audio/audio_rb_resampler.cpp
+++ b/servers/audio/audio_rb_resampler.cpp
@@ -176,8 +176,9 @@ Error AudioRBResampler::setup(int p_channels, int p_src_mix_rate, int p_target_m
rb_bits = desired_rb_bits;
rb_len = (1 << rb_bits);
rb_mask = rb_len - 1;
- rb = memnew_arr(float, rb_len *p_channels);
- read_buf = memnew_arr(float, rb_len *p_channels);
+ const size_t array_size = rb_len * (size_t)p_channels;
+ rb = memnew_arr(float, array_size);
+ read_buf = memnew_arr(float, array_size);
}
src_mix_rate = p_src_mix_rate;