pub fn new(num_channels: usize) -> (SpectrumInput, SpectrumOutput) {
        let (triple_buffer_input, triple_buffer_output) =
            TripleBuffer::new(&[0.0; SPECTRUM_WINDOW_SIZE / 2]).split();

        let input = Self {
            stft: util::StftHelper::new(num_channels, SPECTRUM_WINDOW_SIZE),
            num_channels,

            triple_buffer_input,
            spectrum_result_buffer: [0.0; SPECTRUM_WINDOW_SIZE / 2],

            plan: Plan {
                r2c_plan: R2CPlan32::aligned(
                    &[SPECTRUM_WINDOW_SIZE],
                    Flag::MEASURE | Flag::DESTROYINPUT,
                )
                .unwrap(),
            },
            compensated_window_function: util::window::hann(SPECTRUM_WINDOW_SIZE)
                .into_iter()
                // Include the gain compensation in the window function to save some multiplications
                .map(|x| x / SPECTRUM_WINDOW_SIZE as f32)
                .collect(),
            complex_fft_scratch_buffer: AlignedVec::new(SPECTRUM_WINDOW_SIZE / 2 + 1),
        };

        (input, triple_buffer_output)
    }
/// Create a new spectrum input and output pair. The output should be moved to the editor.
Create a new spectrum input and output pair. The output should be moved to the editor.
Create a new spectrum input and output pair . The output should be moved to the editor .
pub fn new(num_channels: usize) -> (SpectrumInput, SpectrumOutput) {
        let (triple_buffer_input, triple_buffer_output) =
            TripleBuffer::new(&[0.0; SPECTRUM_WINDOW_SIZE / 2]).split();
        let input = Self {
            stft: util::StftHelper::new(num_channels, SPECTRUM_WINDOW_SIZE),
            num_channels,
            triple_buffer_input,
            spectrum_result_buffer: [0.0; SPECTRUM_WINDOW_SIZE / 2],
            plan: Plan {
                r2c_plan: R2CPlan32::aligned(
                    &[SPECTRUM_WINDOW_SIZE],
                    Flag::MEASURE | Flag::DESTROYINPUT,
                )
                .unwrap(),
            },
            compensated_window_function: util::window::hann(SPECTRUM_WINDOW_SIZE)
                .into_iter()
                // Include the gain compensation in the window function to save some multiplications
                .map(|x| x / SPECTRUM_WINDOW_SIZE as f32)
                .collect(),
            complex_fft_scratch_buffer: AlignedVec::new(SPECTRUM_WINDOW_SIZE / 2 + 1),
        };
        (input, triple_buffer_output)
    }
pub fn new ( num_channels : usize ) -> ( SpectrumInput , SpectrumOutput ) { let ( triple_buffer_input , triple_buffer_output ) = TripleBuffer :: new ( & [ 0.0 ; SPECTRUM_WINDOW_SIZE / 2 ] ) . split ( ) ; let input = Self { stft : util :: StftHelper :: new ( num_channels , SPECTRUM_WINDOW_SIZE ) , num_channels , triple_buffer_input , spectrum_result_buffer : [ 0.0 ; SPECTRUM_WINDOW_SIZE / 2 ] , plan : Plan { r2c_plan : R2CPlan32 :: aligned ( & [ SPECTRUM_WINDOW_SIZE ] , Flag :: MEASURE | Flag :: DESTROYINPUT , ) . unwrap ( ) , } , compensated_window_function : util :: window :: hann ( SPECTRUM_WINDOW_SIZE ) . into_iter ( ) // Include the gain compensation in the window function to save some multiplications . map ( | x | x / SPECTRUM_WINDOW_SIZE as f32 ) . collect ( ) , complex_fft_scratch_buffer : AlignedVec :: new ( SPECTRUM_WINDOW_SIZE / 2 + 1 ) , } ; ( input , triple_buffer_output ) }
Create a new spectrum input and output pair.
Create a new spectrum input and output pair .
num_channels
usize
num_channels
usize