#pragma once #include "../demod.h" #include #include namespace demod { class NFM : public Demodulator { public: NFM() {} NFM(std::string name, ConfigManager* config, dsp::stream* input, double bandwidth, EventHandler*> outputChangeHandler, double audioSR) { init(name, config, input, bandwidth, outputChangeHandler, audioSR); } ~NFM() { stop(); } void init(std::string name, ConfigManager* config, dsp::stream* input, double bandwidth, EventHandler*> outputChangeHandler, double audioSR) { this->name = name; this->outputChangeHandler = outputChangeHandler; // Define structure demod.init(input, getIFSampleRate(), bandwidth / 2.0f); } void start() { demod.start(); } void stop() { demod.stop(); } void showMenu() {} void setBandwidth(double bandwidth) { demod.setDeviation(bandwidth / 2.0f); } void setInput(dsp::stream* input) { demod.setInput(input); } void AFSampRateChanged(double newSR) {} // ============= INFO ============= const char* getName() { return "FM"; } double getIFSampleRate() { return 50000.0; } double getAFSampleRate() { return getIFSampleRate(); } double getDefaultBandwidth() { return 12500.0; } double getMinBandwidth() { return 1000.0; } double getMaxBandwidth() { return getIFSampleRate(); } bool getBandwidthLocked() { return false; } double getMaxAFBandwidth() { return getIFSampleRate() / 2.0; } double getDefaultSnapInterval() { return 2500.0; } int getVFOReference() { return ImGui::WaterfallVFO::REF_CENTER; } bool getDeempAllowed() { return true; } bool getPostProcEnabled() { return true; } int getDefaultDeemphasisMode() { return DEEMP_MODE_NONE; } double getAFBandwidth(double bandwidth) { return bandwidth / 2.0; } bool getDynamicAFBandwidth() { return true; } bool getFMIFNRAllowed() { return true; } bool getNBAllowed() { return false; } dsp::stream* getOutput() { return &demod.out; } private: dsp::FMDemod demod; std::string name; EventHandler*> outputChangeHandler; }; }