summaryrefslogtreecommitdiffstats
path: root/servers/audio
diff options
context:
space:
mode:
authorA Thousand Ships <96648715+AThousandShips@users.noreply.github.com>2024-01-09 15:01:12 +0100
committerA Thousand Ships <96648715+AThousandShips@users.noreply.github.com>2024-02-13 15:37:09 +0100
commitd8b29efe666202443a019532eb68f560041abeb5 (patch)
treeabe805edd7548423fc40ee9e0b621c82e947a742 /servers/audio
parentdfe226b93346c208787728eceecc2c64d81a9553 (diff)
downloadredot-engine-d8b29efe666202443a019532eb68f560041abeb5.tar.gz
Fix member names of `AudioFrame` to match extension
Diffstat (limited to 'servers/audio')
-rw-r--r--servers/audio/effects/audio_effect_capture.cpp2
-rw-r--r--servers/audio/effects/audio_effect_chorus.cpp4
-rw-r--r--servers/audio/effects/audio_effect_compressor.cpp6
-rw-r--r--servers/audio/effects/audio_effect_delay.cpp8
-rw-r--r--servers/audio/effects/audio_effect_eq.cpp8
-rw-r--r--servers/audio/effects/audio_effect_filter.cpp8
-rw-r--r--servers/audio/effects/audio_effect_limiter.cpp8
-rw-r--r--servers/audio/effects/audio_effect_panner.cpp4
-rw-r--r--servers/audio/effects/audio_effect_phaser.cpp12
-rw-r--r--servers/audio/effects/audio_effect_record.cpp4
-rw-r--r--servers/audio/effects/audio_effect_reverb.cpp8
-rw-r--r--servers/audio/effects/audio_effect_spectrum_analyzer.cpp12
-rw-r--r--servers/audio/effects/audio_effect_stereo_enhance.cpp8
13 files changed, 46 insertions, 46 deletions
diff --git a/servers/audio/effects/audio_effect_capture.cpp b/servers/audio/effects/audio_effect_capture.cpp
index 7e7aa73f9c..a5740c7e27 100644
--- a/servers/audio/effects/audio_effect_capture.cpp
+++ b/servers/audio/effects/audio_effect_capture.cpp
@@ -49,7 +49,7 @@ PackedVector2Array AudioEffectCapture::get_buffer(int p_frames) {
streaming_data.resize(p_frames);
buffer.read(streaming_data.ptrw(), p_frames);
for (int32_t i = 0; i < p_frames; i++) {
- ret.write[i] = Vector2(streaming_data[i].l, streaming_data[i].r);
+ ret.write[i] = Vector2(streaming_data[i].left, streaming_data[i].right);
}
return ret;
}
diff --git a/servers/audio/effects/audio_effect_chorus.cpp b/servers/audio/effects/audio_effect_chorus.cpp
index 796abfee02..16f42aea9e 100644
--- a/servers/audio/effects/audio_effect_chorus.cpp
+++ b/servers/audio/effects/audio_effect_chorus.cpp
@@ -96,8 +96,8 @@ void AudioEffectChorusInstance::_process_chunk(const AudioFrame *p_src_frames, A
//vol modifier
AudioFrame vol_modifier = AudioFrame(base->wet, base->wet) * Math::db_to_linear(v.level);
- vol_modifier.l *= CLAMP(1.0 - v.pan, 0, 1);
- vol_modifier.r *= CLAMP(1.0 + v.pan, 0, 1);
+ vol_modifier.left *= CLAMP(1.0 - v.pan, 0, 1);
+ vol_modifier.right *= CLAMP(1.0 + v.pan, 0, 1);
for (int i = 0; i < p_frame_count; i++) {
/** COMPUTE WAVEFORM **/
diff --git a/servers/audio/effects/audio_effect_compressor.cpp b/servers/audio/effects/audio_effect_compressor.cpp
index ed6690c120..1ab1b6eaf3 100644
--- a/servers/audio/effects/audio_effect_compressor.cpp
+++ b/servers/audio/effects/audio_effect_compressor.cpp
@@ -59,10 +59,10 @@ void AudioEffectCompressorInstance::process(const AudioFrame *p_src_frames, Audi
for (int i = 0; i < p_frame_count; i++) {
AudioFrame s = src[i];
//convert to positive
- s.l = Math::abs(s.l);
- s.r = Math::abs(s.r);
+ s.left = Math::abs(s.left);
+ s.right = Math::abs(s.right);
- float peak = MAX(s.l, s.r);
+ float peak = MAX(s.left, s.right);
float overdb = 2.08136898f * Math::linear_to_db(peak / threshold);
diff --git a/servers/audio/effects/audio_effect_delay.cpp b/servers/audio/effects/audio_effect_delay.cpp
index 40a7a28fc4..3014dc703f 100644
--- a/servers/audio/effects/audio_effect_delay.cpp
+++ b/servers/audio/effects/audio_effect_delay.cpp
@@ -64,13 +64,13 @@ void AudioEffectDelayInstance::_process_chunk(const AudioFrame *p_src_frames, Au
AudioFrame tap1_vol = AudioFrame(tap_1_level_f, tap_1_level_f);
- tap1_vol.l *= CLAMP(1.0 - base->tap_1_pan, 0, 1);
- tap1_vol.r *= CLAMP(1.0 + base->tap_1_pan, 0, 1);
+ tap1_vol.left *= CLAMP(1.0 - base->tap_1_pan, 0, 1);
+ tap1_vol.right *= CLAMP(1.0 + base->tap_1_pan, 0, 1);
AudioFrame tap2_vol = AudioFrame(tap_2_level_f, tap_2_level_f);
- tap2_vol.l *= CLAMP(1.0 - base->tap_2_pan, 0, 1);
- tap2_vol.r *= CLAMP(1.0 + base->tap_2_pan, 0, 1);
+ tap2_vol.left *= CLAMP(1.0 - base->tap_2_pan, 0, 1);
+ tap2_vol.right *= CLAMP(1.0 + base->tap_2_pan, 0, 1);
// feedback lowpass here
float lpf_c = expf(-Math_TAU * base->feedback_lowpass / mix_rate); // 0 .. 10khz
diff --git a/servers/audio/effects/audio_effect_eq.cpp b/servers/audio/effects/audio_effect_eq.cpp
index 8d4bc1891f..59032f99d8 100644
--- a/servers/audio/effects/audio_effect_eq.cpp
+++ b/servers/audio/effects/audio_effect_eq.cpp
@@ -46,14 +46,14 @@ void AudioEffectEQInstance::process(const AudioFrame *p_src_frames, AudioFrame *
AudioFrame dst = AudioFrame(0, 0);
for (int j = 0; j < band_count; j++) {
- float l = src.l;
- float r = src.r;
+ float l = src.left;
+ float r = src.right;
proc_l[j].process_one(l);
proc_r[j].process_one(r);
- dst.l += l * bgain[j];
- dst.r += r * bgain[j];
+ dst.left += l * bgain[j];
+ dst.right += r * bgain[j];
}
p_dst_frames[i] = dst;
diff --git a/servers/audio/effects/audio_effect_filter.cpp b/servers/audio/effects/audio_effect_filter.cpp
index dd89784010..cd2839044f 100644
--- a/servers/audio/effects/audio_effect_filter.cpp
+++ b/servers/audio/effects/audio_effect_filter.cpp
@@ -34,7 +34,7 @@
template <int S>
void AudioEffectFilterInstance::_process_filter(const AudioFrame *p_src_frames, AudioFrame *p_dst_frames, int p_frame_count) {
for (int i = 0; i < p_frame_count; i++) {
- float f = p_src_frames[i].l;
+ float f = p_src_frames[i].left;
filter_process[0][0].process_one(f);
if constexpr (S > 1) {
filter_process[0][1].process_one(f);
@@ -46,11 +46,11 @@ void AudioEffectFilterInstance::_process_filter(const AudioFrame *p_src_frames,
filter_process[0][3].process_one(f);
}
- p_dst_frames[i].l = f;
+ p_dst_frames[i].left = f;
}
for (int i = 0; i < p_frame_count; i++) {
- float f = p_src_frames[i].r;
+ float f = p_src_frames[i].right;
filter_process[1][0].process_one(f);
if constexpr (S > 1) {
filter_process[1][1].process_one(f);
@@ -62,7 +62,7 @@ void AudioEffectFilterInstance::_process_filter(const AudioFrame *p_src_frames,
filter_process[1][3].process_one(f);
}
- p_dst_frames[i].r = f;
+ p_dst_frames[i].right = f;
}
}
diff --git a/servers/audio/effects/audio_effect_limiter.cpp b/servers/audio/effects/audio_effect_limiter.cpp
index ede6d77fbc..8c5dc731bb 100644
--- a/servers/audio/effects/audio_effect_limiter.cpp
+++ b/servers/audio/effects/audio_effect_limiter.cpp
@@ -41,8 +41,8 @@ void AudioEffectLimiterInstance::process(const AudioFrame *p_src_frames, AudioFr
float scmult = Math::abs((ceildb - sc) / (peakdb - sc));
for (int i = 0; i < p_frame_count; i++) {
- float spl0 = p_src_frames[i].l;
- float spl1 = p_src_frames[i].r;
+ float spl0 = p_src_frames[i].left;
+ float spl1 = p_src_frames[i].right;
spl0 = spl0 * makeup;
spl1 = spl1 * makeup;
float sign0 = (spl0 < 0.0 ? -1.0 : 1.0);
@@ -62,8 +62,8 @@ void AudioEffectLimiterInstance::process(const AudioFrame *p_src_frames, AudioFr
spl0 = MIN(ceiling, Math::abs(spl0)) * (spl0 < 0.0 ? -1.0 : 1.0);
spl1 = MIN(ceiling, Math::abs(spl1)) * (spl1 < 0.0 ? -1.0 : 1.0);
- p_dst_frames[i].l = spl0;
- p_dst_frames[i].r = spl1;
+ p_dst_frames[i].left = spl0;
+ p_dst_frames[i].right = spl1;
}
}
diff --git a/servers/audio/effects/audio_effect_panner.cpp b/servers/audio/effects/audio_effect_panner.cpp
index 74742d60de..3fbdcd450a 100644
--- a/servers/audio/effects/audio_effect_panner.cpp
+++ b/servers/audio/effects/audio_effect_panner.cpp
@@ -35,8 +35,8 @@ void AudioEffectPannerInstance::process(const AudioFrame *p_src_frames, AudioFra
float rvol = CLAMP(1.0 + base->pan, 0, 1);
for (int i = 0; i < p_frame_count; i++) {
- p_dst_frames[i].l = p_src_frames[i].l * lvol + p_src_frames[i].r * (1.0 - rvol);
- p_dst_frames[i].r = p_src_frames[i].r * rvol + p_src_frames[i].l * (1.0 - lvol);
+ p_dst_frames[i].left = p_src_frames[i].left * lvol + p_src_frames[i].right * (1.0 - rvol);
+ p_dst_frames[i].right = p_src_frames[i].right * rvol + p_src_frames[i].left * (1.0 - lvol);
}
}
diff --git a/servers/audio/effects/audio_effect_phaser.cpp b/servers/audio/effects/audio_effect_phaser.cpp
index 76d2ca5689..8093fd01ca 100644
--- a/servers/audio/effects/audio_effect_phaser.cpp
+++ b/servers/audio/effects/audio_effect_phaser.cpp
@@ -61,20 +61,20 @@ void AudioEffectPhaserInstance::process(const AudioFrame *p_src_frames, AudioFra
allpass[0][2].update(
allpass[0][3].update(
allpass[0][4].update(
- allpass[0][5].update(p_src_frames[i].l + h.l * base->feedback))))));
- h.l = y;
+ allpass[0][5].update(p_src_frames[i].left + h.left * base->feedback))))));
+ h.left = y;
- p_dst_frames[i].l = p_src_frames[i].l + y * base->depth;
+ p_dst_frames[i].left = p_src_frames[i].left + y * base->depth;
y = allpass[1][0].update(
allpass[1][1].update(
allpass[1][2].update(
allpass[1][3].update(
allpass[1][4].update(
- allpass[1][5].update(p_src_frames[i].r + h.r * base->feedback))))));
- h.r = y;
+ allpass[1][5].update(p_src_frames[i].right + h.right * base->feedback))))));
+ h.right = y;
- p_dst_frames[i].r = p_src_frames[i].r + y * base->depth;
+ p_dst_frames[i].right = p_src_frames[i].right + y * base->depth;
}
}
diff --git a/servers/audio/effects/audio_effect_record.cpp b/servers/audio/effects/audio_effect_record.cpp
index e1e9270074..e30a8fa99e 100644
--- a/servers/audio/effects/audio_effect_record.cpp
+++ b/servers/audio/effects/audio_effect_record.cpp
@@ -87,8 +87,8 @@ void AudioEffectRecordInstance::_io_store_buffer() {
while (to_read) {
AudioFrame buffered_frame = rb_buf[ring_buffer_read_pos & ring_buffer_mask];
- recording_data.push_back(buffered_frame.l);
- recording_data.push_back(buffered_frame.r);
+ recording_data.push_back(buffered_frame.left);
+ recording_data.push_back(buffered_frame.right);
ring_buffer_read_pos++;
to_read--;
diff --git a/servers/audio/effects/audio_effect_reverb.cpp b/servers/audio/effects/audio_effect_reverb.cpp
index 00d21120fe..06d890fb58 100644
--- a/servers/audio/effects/audio_effect_reverb.cpp
+++ b/servers/audio/effects/audio_effect_reverb.cpp
@@ -51,20 +51,20 @@ void AudioEffectReverbInstance::process(const AudioFrame *p_src_frames, AudioFra
int to_mix = MIN(todo, Reverb::INPUT_BUFFER_MAX_SIZE);
for (int j = 0; j < to_mix; j++) {
- tmp_src[j] = p_src_frames[offset + j].l;
+ tmp_src[j] = p_src_frames[offset + j].left;
}
reverb[0].process(tmp_src, tmp_dst, to_mix);
for (int j = 0; j < to_mix; j++) {
- p_dst_frames[offset + j].l = tmp_dst[j];
- tmp_src[j] = p_src_frames[offset + j].r;
+ p_dst_frames[offset + j].left = tmp_dst[j];
+ tmp_src[j] = p_src_frames[offset + j].right;
}
reverb[1].process(tmp_src, tmp_dst, to_mix);
for (int j = 0; j < to_mix; j++) {
- p_dst_frames[offset + j].r = tmp_dst[j];
+ p_dst_frames[offset + j].right = tmp_dst[j];
}
offset += to_mix;
diff --git a/servers/audio/effects/audio_effect_spectrum_analyzer.cpp b/servers/audio/effects/audio_effect_spectrum_analyzer.cpp
index bd5b226e15..378ca2458f 100644
--- a/servers/audio/effects/audio_effect_spectrum_analyzer.cpp
+++ b/servers/audio/effects/audio_effect_spectrum_analyzer.cpp
@@ -115,9 +115,9 @@ void AudioEffectSpectrumAnalyzerInstance::process(const AudioFrame *p_src_frames
float *fftw = temporal_fft.ptrw();
for (int i = 0; i < to_fill; i++) { //left and right buffers
float window = -0.5 * Math::cos(to_fill_step * (double)temporal_fft_pos) + 0.5;
- fftw[temporal_fft_pos * 2] = window * p_src_frames->l;
+ fftw[temporal_fft_pos * 2] = window * p_src_frames->left;
fftw[temporal_fft_pos * 2 + 1] = 0;
- fftw[(temporal_fft_pos + fft_size * 2) * 2] = window * p_src_frames->r;
+ fftw[(temporal_fft_pos + fft_size * 2) * 2] = window * p_src_frames->right;
fftw[(temporal_fft_pos + fft_size * 2) * 2 + 1] = 0;
++p_src_frames;
++temporal_fft_pos;
@@ -135,8 +135,8 @@ void AudioEffectSpectrumAnalyzerInstance::process(const AudioFrame *p_src_frames
for (int i = 0; i < fft_size; i++) {
//abs(vec)/fft_size normalizes each frequency
- hw[i].l = Vector2(fftw[i * 2], fftw[i * 2 + 1]).length() / float(fft_size);
- hw[i].r = Vector2(fftw[fft_size * 4 + i * 2], fftw[fft_size * 4 + i * 2 + 1]).length() / float(fft_size);
+ hw[i].left = Vector2(fftw[i * 2], fftw[i * 2 + 1]).length() / float(fft_size);
+ hw[i].right = Vector2(fftw[fft_size * 4 + i * 2], fftw[fft_size * 4 + i * 2 + 1]).length() / float(fft_size);
}
fft_pos = next; //swap
@@ -199,8 +199,8 @@ Vector2 AudioEffectSpectrumAnalyzerInstance::get_magnitude_for_frequency_range(f
Vector2 max;
for (int i = begin_pos; i <= end_pos; i++) {
- max.x = MAX(max.x, r[i].l);
- max.y = MAX(max.y, r[i].r);
+ max.x = MAX(max.x, r[i].left);
+ max.y = MAX(max.y, r[i].right);
}
return max;
diff --git a/servers/audio/effects/audio_effect_stereo_enhance.cpp b/servers/audio/effects/audio_effect_stereo_enhance.cpp
index be9905724e..e0ea97f90f 100644
--- a/servers/audio/effects/audio_effect_stereo_enhance.cpp
+++ b/servers/audio/effects/audio_effect_stereo_enhance.cpp
@@ -39,8 +39,8 @@ void AudioEffectStereoEnhanceInstance::process(const AudioFrame *p_src_frames, A
unsigned int delay_frames = (base->time_pullout / 1000.0) * AudioServer::get_singleton()->get_mix_rate();
for (int i = 0; i < p_frame_count; i++) {
- float l = p_src_frames[i].l;
- float r = p_src_frames[i].r;
+ float l = p_src_frames[i].left;
+ float r = p_src_frames[i].right;
float center = (l + r) / 2.0f;
@@ -65,8 +65,8 @@ void AudioEffectStereoEnhanceInstance::process(const AudioFrame *p_src_frames, A
r = delay_ringbuff[(ringbuff_pos - delay_frames) & ringbuff_mask];
}
- p_dst_frames[i].l = l;
- p_dst_frames[i].r = r;
+ p_dst_frames[i].left = l;
+ p_dst_frames[i].right = r;
ringbuff_pos++;
}
}