diff options
| author | skal <pascal.massimino@gmail.com> | 2026-01-31 00:17:19 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-01-31 00:17:19 +0100 |
| commit | 0f757ca901dbf00a953a39bd2d452ff423a45969 (patch) | |
| tree | 9cf5329dfde02cfd1ec5ea7a5c7171cc4de9c5db /src/audio | |
| parent | 4a8554fe08ce0491cf64514ad374fd118066ed1b (diff) | |
enforce code style
Diffstat (limited to 'src/audio')
| -rw-r--r-- | src/audio/synth.cc | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/audio/synth.cc b/src/audio/synth.cc index b9af771..02d7133 100644 --- a/src/audio/synth.cc +++ b/src/audio/synth.cc @@ -7,7 +7,7 @@ #include "audio/window.h" #include <atomic> #include <math.h> -#include <stdio.h> // For printf +#include <stdio.h> // For printf #include <string.h> // For memset struct Voice { @@ -33,7 +33,8 @@ static struct { } g_synth_data; static Voice g_voices[MAX_VOICES]; -static volatile float g_current_output_peak = 0.0f; // Global peak for visualization +static volatile float g_current_output_peak = + 0.0f; // Global peak for visualization static float g_hamming_window[WINDOW_SIZE]; // Static window for optimization void synth_init() { @@ -76,11 +77,9 @@ float *synth_begin_update(int spectrogram_id) { g_synth_data.active_spectrogram_data[spectrogram_id]; if (active_ptr == g_synth_data.spectrograms[spectrogram_id].spectral_data_a) { - return const_cast<float *>( - g_synth_data.spectrograms[spectrogram_id].spectral_data_b); + return (float *)(g_synth_data.spectrograms[spectrogram_id].spectral_data_b); } else { - return const_cast<float *>( - g_synth_data.spectrograms[spectrogram_id].spectral_data_a); + return (float *)(g_synth_data.spectrograms[spectrogram_id].spectral_data_a); } } @@ -165,7 +164,8 @@ void synth_render(float *output_buffer, int num_frames) { float windowed_frame[DCT_SIZE]; for (int j = 0; j < DCT_SIZE; ++j) { - windowed_frame[j] = spectral_frame[j] * g_hamming_window[j]; // Use static window + windowed_frame[j] = + spectral_frame[j] * g_hamming_window[j]; // Use static window } idct_512(windowed_frame, v.time_domain_buffer); @@ -178,16 +178,15 @@ void synth_render(float *output_buffer, int num_frames) { left_sample += voice_sample * v.pan_left; right_sample += voice_sample * v.pan_right; - v.buffer_pos++; + ++v.buffer_pos; } output_buffer[i * 2] = left_sample; output_buffer[i * 2 + 1] = right_sample; // Update the peak with the new max (attack) - g_current_output_peak = - fmaxf(g_current_output_peak, - fmaxf(fabsf(left_sample), fabsf(right_sample))); + g_current_output_peak = fmaxf( + g_current_output_peak, fmaxf(fabsf(left_sample), fabsf(right_sample))); } } |
