/** inc/complex_frames.h Defines the interface for the `RealtimeHilbert` class. This is a stateful processor designed for continuous, low-latency, real-time audio streaming. It uses an internal history buffer and an overlap-add to prevent artifacts that would occur with block-based processing of the same chunk-sizes. The point of this is to provide a complex stream alongside the raw real stream simultaneously. It's kind of the core of this whole engine. This is what allowed the spiral visualizer idea to work in real-time. **/ #ifndef COMPLEX_FRAMES_H #define COMPLEX_FRAMES_H #include #include #include #include class RealtimeHilbert { public: RealtimeHilbert(); ~RealtimeHilbert(); void reinit(size_t fft_size); std::pair>, std::vector>> process(const std::vector& left_input_block, const std::vector& right_input_block); private: void cleanup(); size_t m_fft_size; size_t m_hop_size; std::vector m_history_buffer_L; std::vector m_history_buffer_R; // --- Left Channel Resources --- fftw_plan m_plan_forward_L; fftw_plan m_plan_backward_L; double* m_fft_input_real_L; fftw_complex* m_fft_output_spectrum_L; fftw_complex* m_ifft_input_spectrum_L; fftw_complex* m_ifft_output_complex_L; // --- Right Channel Resources --- fftw_plan m_plan_forward_R; fftw_plan m_plan_backward_R; double* m_fft_input_real_R; fftw_complex* m_fft_output_spectrum_R; fftw_complex* m_ifft_input_spectrum_R; fftw_complex* m_ifft_output_complex_R; }; #endif // COMPLEX_FRAMES_H