#pragma once #include #include #include #include #include #include class SignalPath { public: SignalPath(); void init(uint64_t sampleRate, int fftRate, int fftSize, dsp::stream* input, dsp::complex_t* fftBuffer, void fftHandler(dsp::complex_t*,int,void*), void* fftHandlerCtx); void start(); void stop(); void setSampleRate(double sampleRate); double getSampleRate(); dsp::VFO* addVFO(std::string name, double outSampleRate, double bandwidth, double offset); void removeVFO(std::string name); void setInput(dsp::stream* input); void bindIQStream(dsp::stream* stream); void unbindIQStream(dsp::stream* stream); void setFFTSize(int size); void setFFTRate(double rate); void startFFT(); void stopFFT(); void setBuffering(bool enabled); void setDecimation(int dec); void setIQCorrection(bool enabled); dsp::SampleFrameBuffer inputBuffer; double sourceSampleRate = 0; int decimation = 0; private: struct VFO_t { dsp::stream* inputStream; dsp::VFO* vfo; }; dsp::Splitter split; dsp::IQCorrector corrector; // FFT dsp::stream fftStream; dsp::Reshaper reshape; dsp::HandlerSink fftHandlerSink; // VFO std::map vfos; std::vector*> decimators; dsp::filter_window::BlackmanWindow halfBandWindow; double sampleRate; double fftRate; int fftSize; int inputBlockSize; bool bufferingEnabled = false; bool running = false; bool iqCorrection = false; };