bang head

This commit is contained in:
TerraMaster85 2025-01-15 23:14:42 -05:00
parent e56b9ef454
commit 9599800c21

View file

@ -28,7 +28,6 @@ pub fn take_input_pcm<T>(
let mut fft_planner = FftPlanner::<f64>::new(); let mut fft_planner = FftPlanner::<f64>::new();
// Zero-pad for a better freq resolution. 8192 fft should be fast enough
let mut window_offset = 0; let mut window_offset = 0;
let mut prev_phase = f64::MAX; let mut prev_phase = f64::MAX;
@ -36,9 +35,12 @@ pub fn take_input_pcm<T>(
while !carrier.acquired && window_offset + fft_size < pcm_buffer.len() { while !carrier.acquired && window_offset + fft_size < pcm_buffer.len() {
trace!("carrier acq: trying, window offset {window_offset}"); trace!("carrier acq: trying, window offset {window_offset}");
let pcm_buffer_contiguous = pcm_buffer.make_contiguous(); let pcm_buffer_contiguous = pcm_buffer.make_contiguous();
let mut fft_frame: Vec<Complex<f64>> = if fft_size < 8192 { // Zero-pad for a better freq resolution. 8192 fft should be fast enough
const MAX_ZERO_PAD: usize = 8192;
let mut fft_frame: Vec<Complex<f64>> = if fft_size < MAX_ZERO_PAD {
let mut frm = let mut frm =
[Complex { re: 0.0f64, im: 0.0f64 }].repeat(8192 - fft_size); [Complex { re: 0.0f64, im: 0.0f64 }]
.repeat(MAX_ZERO_PAD - fft_size);
frm.extend( frm.extend(
&pcm_buffer_contiguous[window_offset..(fft_size+window_offset)] &pcm_buffer_contiguous[window_offset..(fft_size+window_offset)]
); );