mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2025-07-08 18:15:21 +02:00
lots o shit
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
#include "../demod.h"
|
||||
#include <dsp/demodulator.h>
|
||||
#include <dsp/filter.h>
|
||||
#include <dsp/demod/am.h>
|
||||
#include <dsp/convert/mono_to_stereo.h>
|
||||
|
||||
namespace demod {
|
||||
class AM : public Demodulator {
|
||||
@ -20,20 +20,17 @@ namespace demod {
|
||||
this->name = name;
|
||||
|
||||
// Define structure
|
||||
demod.init(input);
|
||||
agc.init(&demod.out, 20.0f, getIFSampleRate());
|
||||
m2s.init(&agc.out);
|
||||
demod.init(input, dsp::demod::AM::AGCMode::CARRIER, 200000.0 / getIFSampleRate());
|
||||
m2s.init(&demod.out);
|
||||
}
|
||||
|
||||
void start() {
|
||||
demod.start();
|
||||
agc.start();
|
||||
m2s.start();
|
||||
}
|
||||
|
||||
void stop() {
|
||||
demod.stop();
|
||||
agc.stop();
|
||||
m2s.stop();
|
||||
}
|
||||
|
||||
@ -71,9 +68,8 @@ namespace demod {
|
||||
dsp::stream<dsp::stereo_t>* getOutput() { return &m2s.out; }
|
||||
|
||||
private:
|
||||
dsp::AMDemod demod;
|
||||
dsp::AGC agc;
|
||||
dsp::MonoToStereo m2s;
|
||||
dsp::demod::AM demod;
|
||||
dsp::convert::MonoToStereo m2s;
|
||||
|
||||
std::string name;
|
||||
};
|
||||
|
@ -1,7 +1,9 @@
|
||||
#pragma once
|
||||
#include "../demod.h"
|
||||
#include <dsp/demodulator.h>
|
||||
#include <dsp/filter.h>
|
||||
#include <dsp/channel/frequency_xlator.h>
|
||||
#include <dsp/convert/complex_to_real.h>
|
||||
#include <dsp/convert/mono_to_stereo.h>
|
||||
#include <dsp/loop/agc.h>
|
||||
|
||||
namespace demod {
|
||||
class CW : public Demodulator {
|
||||
@ -30,9 +32,9 @@ namespace demod {
|
||||
config->release();
|
||||
|
||||
// Define structure
|
||||
xlator.init(input, getIFSampleRate(), tone);
|
||||
xlator.init(input, tone, getIFSampleRate());
|
||||
c2r.init(&xlator.out);
|
||||
agc.init(&c2r.out, 20.0f, getIFSampleRate());
|
||||
agc.init(&c2r.out, 1.0, 200000.0 / getIFSampleRate());
|
||||
m2s.init(&agc.out);
|
||||
}
|
||||
|
||||
@ -55,7 +57,7 @@ namespace demod {
|
||||
ImGui::FillWidth();
|
||||
if (ImGui::InputInt(("Stereo##_radio_cw_tone_" + name).c_str(), &tone, 10, 100)) {
|
||||
tone = std::clamp<int>(tone, 250, 1250);
|
||||
xlator.setFrequency(tone);
|
||||
xlator.setOffset(tone, getIFSampleRate());
|
||||
afbwChangeHandler.handler(getAFBandwidth(_bandwidth), afbwChangeHandler.ctx);
|
||||
_config->acquire();
|
||||
_config->conf[name][getName()]["tone"] = tone;
|
||||
@ -94,10 +96,10 @@ namespace demod {
|
||||
|
||||
private:
|
||||
ConfigManager* _config = NULL;
|
||||
dsp::FrequencyXlator<dsp::complex_t> xlator;
|
||||
dsp::ComplexToReal c2r;
|
||||
dsp::AGC agc;
|
||||
dsp::MonoToStereo m2s;
|
||||
dsp::channel::FrequencyXlator xlator;
|
||||
dsp::convert::ComplexToReal c2r;
|
||||
dsp::loop::AGC<float> agc;
|
||||
dsp::convert::MonoToStereo m2s;
|
||||
|
||||
std::string name;
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
#include "../demod.h"
|
||||
#include <dsp/demodulator.h>
|
||||
#include <dsp/filter.h>
|
||||
#include <dsp/demod/ssb.h>
|
||||
#include <dsp/convert/mono_to_stereo.h>
|
||||
|
||||
namespace demod {
|
||||
class DSB : public Demodulator {
|
||||
@ -20,20 +20,17 @@ namespace demod {
|
||||
this->name = name;
|
||||
|
||||
// Define structure
|
||||
demod.init(input, getIFSampleRate(), bandwidth, dsp::SSBDemod::MODE_DSB);
|
||||
agc.init(&demod.out, 20.0f, getIFSampleRate());
|
||||
m2s.init(&agc.out);
|
||||
demod.init(input, dsp::demod::SSB::Mode::DSB, bandwidth, getIFSampleRate(), 200000.0 / getIFSampleRate());
|
||||
m2s.init(&demod.out);
|
||||
}
|
||||
|
||||
void start() {
|
||||
demod.start();
|
||||
agc.start();
|
||||
m2s.start();
|
||||
}
|
||||
|
||||
void stop() {
|
||||
demod.stop();
|
||||
agc.stop();
|
||||
m2s.stop();
|
||||
}
|
||||
|
||||
@ -42,7 +39,7 @@ namespace demod {
|
||||
}
|
||||
|
||||
void setBandwidth(double bandwidth) {
|
||||
demod.setBandWidth(bandwidth);
|
||||
demod.setBandwidth(bandwidth);
|
||||
}
|
||||
|
||||
void setInput(dsp::stream<dsp::complex_t>* input) {
|
||||
@ -73,9 +70,8 @@ namespace demod {
|
||||
dsp::stream<dsp::stereo_t>* getOutput() { return &m2s.out; }
|
||||
|
||||
private:
|
||||
dsp::SSBDemod demod;
|
||||
dsp::AGC agc;
|
||||
dsp::MonoToStereo m2s;
|
||||
dsp::demod::SSB demod;
|
||||
dsp::convert::MonoToStereo m2s;
|
||||
|
||||
std::string name;
|
||||
};
|
||||
|
@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
#include "../demod.h"
|
||||
#include <dsp/demodulator.h>
|
||||
#include <dsp/filter.h>
|
||||
#include <dsp/demod/ssb.h>
|
||||
#include <dsp/convert/mono_to_stereo.h>
|
||||
|
||||
namespace demod {
|
||||
class LSB : public Demodulator {
|
||||
@ -20,20 +20,17 @@ namespace demod {
|
||||
this->name = name;
|
||||
|
||||
// Define structure
|
||||
demod.init(input, getIFSampleRate(), bandwidth, dsp::SSBDemod::MODE_LSB);
|
||||
agc.init(&demod.out, 20.0f, getIFSampleRate());
|
||||
m2s.init(&agc.out);
|
||||
demod.init(input, dsp::demod::SSB::Mode::LSB, bandwidth, getIFSampleRate(), 200000.0 / getIFSampleRate());
|
||||
m2s.init(&demod.out);
|
||||
}
|
||||
|
||||
void start() {
|
||||
demod.start();
|
||||
agc.start();
|
||||
m2s.start();
|
||||
}
|
||||
|
||||
void stop() {
|
||||
demod.stop();
|
||||
agc.stop();
|
||||
m2s.stop();
|
||||
}
|
||||
|
||||
@ -42,7 +39,7 @@ namespace demod {
|
||||
}
|
||||
|
||||
void setBandwidth(double bandwidth) {
|
||||
demod.setBandWidth(bandwidth);
|
||||
demod.setBandwidth(bandwidth);
|
||||
}
|
||||
|
||||
void setInput(dsp::stream<dsp::complex_t>* input) {
|
||||
@ -73,9 +70,8 @@ namespace demod {
|
||||
dsp::stream<dsp::stereo_t>* getOutput() { return &m2s.out; }
|
||||
|
||||
private:
|
||||
dsp::SSBDemod demod;
|
||||
dsp::AGC agc;
|
||||
dsp::MonoToStereo m2s;
|
||||
dsp::demod::SSB demod;
|
||||
dsp::convert::MonoToStereo m2s;
|
||||
|
||||
std::string name;
|
||||
};
|
||||
|
@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
#include "../demod.h"
|
||||
#include <dsp/demodulator.h>
|
||||
#include <dsp/filter.h>
|
||||
#include <dsp/demod/fm.h>
|
||||
#include <dsp/convert/mono_to_stereo.h>
|
||||
|
||||
namespace demod {
|
||||
class NFM : public Demodulator {
|
||||
@ -20,21 +20,24 @@ namespace demod {
|
||||
this->name = name;
|
||||
|
||||
// Define structure
|
||||
demod.init(input, getIFSampleRate(), bandwidth / 2.0f);
|
||||
demod.init(input, bandwidth / 2.0, getIFSampleRate());
|
||||
m2s.init(&demod.out);
|
||||
}
|
||||
|
||||
void start() {
|
||||
demod.start();
|
||||
m2s.start();
|
||||
}
|
||||
|
||||
void stop() {
|
||||
demod.stop();
|
||||
m2s.stop();
|
||||
}
|
||||
|
||||
void showMenu() {}
|
||||
|
||||
void setBandwidth(double bandwidth) {
|
||||
demod.setDeviation(bandwidth / 2.0f);
|
||||
demod.setDeviation(bandwidth / 2.0, getIFSampleRate());
|
||||
}
|
||||
|
||||
void setInput(dsp::stream<dsp::complex_t>* input) {
|
||||
@ -62,10 +65,11 @@ namespace demod {
|
||||
bool getDynamicAFBandwidth() { return true; }
|
||||
bool getFMIFNRAllowed() { return true; }
|
||||
bool getNBAllowed() { return false; }
|
||||
dsp::stream<dsp::stereo_t>* getOutput() { return &demod.out; }
|
||||
dsp::stream<dsp::stereo_t>* getOutput() { return &m2s.out; }
|
||||
|
||||
private:
|
||||
dsp::FMDemod demod;
|
||||
dsp::demod::FM demod;
|
||||
dsp::convert::MonoToStereo m2s;
|
||||
|
||||
std::string name;
|
||||
};
|
||||
|
@ -1,7 +1,6 @@
|
||||
#pragma once
|
||||
#include "../demod.h"
|
||||
#include <dsp/demodulator.h>
|
||||
#include <dsp/filter.h>
|
||||
#include <dsp/convert/complex_to_stereo.h>
|
||||
|
||||
namespace demod {
|
||||
class RAW : public Demodulator {
|
||||
@ -67,7 +66,7 @@ namespace demod {
|
||||
|
||||
private:
|
||||
double audioSampleRate;
|
||||
dsp::ComplexToStereo c2s;
|
||||
dsp::convert::ComplexToStereo c2s;
|
||||
|
||||
std::string name;
|
||||
};
|
||||
|
@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
#include "../demod.h"
|
||||
#include <dsp/demodulator.h>
|
||||
#include <dsp/filter.h>
|
||||
#include <dsp/demod/ssb.h>
|
||||
#include <dsp/convert/mono_to_stereo.h>
|
||||
|
||||
namespace demod {
|
||||
class USB : public Demodulator {
|
||||
@ -20,20 +20,17 @@ namespace demod {
|
||||
this->name = name;
|
||||
|
||||
// Define structure
|
||||
demod.init(input, getIFSampleRate(), bandwidth, dsp::SSBDemod::MODE_USB);
|
||||
agc.init(&demod.out, 20.0f, getIFSampleRate());
|
||||
m2s.init(&agc.out);
|
||||
demod.init(input, dsp::demod::SSB::Mode::USB, bandwidth, getIFSampleRate(), 200000.0 / getIFSampleRate());
|
||||
m2s.init(&demod.out);
|
||||
}
|
||||
|
||||
void start() {
|
||||
demod.start();
|
||||
agc.start();
|
||||
m2s.start();
|
||||
}
|
||||
|
||||
void stop() {
|
||||
demod.stop();
|
||||
agc.stop();
|
||||
m2s.stop();
|
||||
}
|
||||
|
||||
@ -42,7 +39,7 @@ namespace demod {
|
||||
}
|
||||
|
||||
void setBandwidth(double bandwidth) {
|
||||
demod.setBandWidth(bandwidth);
|
||||
demod.setBandwidth(bandwidth);
|
||||
}
|
||||
|
||||
void setInput(dsp::stream<dsp::complex_t>* input) {
|
||||
@ -73,9 +70,8 @@ namespace demod {
|
||||
dsp::stream<dsp::stereo_t>* getOutput() { return &m2s.out; }
|
||||
|
||||
private:
|
||||
dsp::SSBDemod demod;
|
||||
dsp::AGC agc;
|
||||
dsp::MonoToStereo m2s;
|
||||
dsp::demod::SSB demod;
|
||||
dsp::convert::MonoToStereo m2s;
|
||||
|
||||
std::string name;
|
||||
};
|
||||
|
@ -1,7 +1,6 @@
|
||||
#pragma once
|
||||
#include "../demod.h"
|
||||
#include <dsp/demodulator.h>
|
||||
#include <dsp/filter.h>
|
||||
#include <dsp/demod/broadcast_fm.h>
|
||||
|
||||
namespace demod {
|
||||
class WFM : public Demodulator {
|
||||
@ -25,41 +24,37 @@ namespace demod {
|
||||
_config->acquire();
|
||||
bool modified = false;
|
||||
if (config->conf[name][getName()].contains("stereo")) {
|
||||
stereo = config->conf[name][getName()]["stereo"];
|
||||
_stereo = config->conf[name][getName()]["stereo"];
|
||||
}
|
||||
_config->release(modified);
|
||||
|
||||
// Define structure
|
||||
demod.init(input, getIFSampleRate(), bandwidth / 2.0f);
|
||||
demodStereo.init(input, getIFSampleRate(), bandwidth / 2.0f);
|
||||
demod.init(input, bandwidth / 2.0f, getIFSampleRate(), _stereo);
|
||||
}
|
||||
|
||||
void start() {
|
||||
stereo ? demodStereo.start() : demod.start();
|
||||
demod.start();
|
||||
}
|
||||
|
||||
void stop() {
|
||||
demod.stop();
|
||||
demodStereo.stop();
|
||||
}
|
||||
|
||||
void showMenu() {
|
||||
if (ImGui::Checkbox(("Stereo##_radio_wfm_stereo_" + name).c_str(), &stereo)) {
|
||||
setStereo(stereo);
|
||||
if (ImGui::Checkbox(("Stereo##_radio_wfm_stereo_" + name).c_str(), &_stereo)) {
|
||||
setStereo(_stereo);
|
||||
_config->acquire();
|
||||
_config->conf[name][getName()]["stereo"] = stereo;
|
||||
_config->conf[name][getName()]["stereo"] = _stereo;
|
||||
_config->release(true);
|
||||
}
|
||||
}
|
||||
|
||||
void setBandwidth(double bandwidth) {
|
||||
demod.setDeviation(bandwidth / 2.0f);
|
||||
demodStereo.setDeviation(bandwidth / 2.0f);
|
||||
}
|
||||
|
||||
void setInput(dsp::stream<dsp::complex_t>* input) {
|
||||
demod.setInput(input);
|
||||
demodStereo.setInput(input);
|
||||
}
|
||||
|
||||
void AFSampRateChanged(double newSR) {}
|
||||
@ -83,31 +78,21 @@ namespace demod {
|
||||
bool getDynamicAFBandwidth() { return false; }
|
||||
bool getFMIFNRAllowed() { return true; }
|
||||
bool getNBAllowed() { return false; }
|
||||
dsp::stream<dsp::stereo_t>* getOutput() { return stereo ? demodStereo.out : &demod.out; }
|
||||
dsp::stream<dsp::stereo_t>* getOutput() { return &demod.out; }
|
||||
|
||||
// ============= DEDICATED FUNCTIONS =============
|
||||
|
||||
void setStereo(bool _stereo) {
|
||||
stereo = _stereo;
|
||||
if (stereo) {
|
||||
demod.stop();
|
||||
outputChangeHandler.handler(demodStereo.out, outputChangeHandler.ctx);
|
||||
demodStereo.start();
|
||||
}
|
||||
else {
|
||||
demodStereo.stop();
|
||||
outputChangeHandler.handler(&demod.out, outputChangeHandler.ctx);
|
||||
demod.start();
|
||||
}
|
||||
void setStereo(bool stereo) {
|
||||
_stereo = stereo;
|
||||
demod.setStereo(_stereo);
|
||||
}
|
||||
|
||||
private:
|
||||
dsp::FMDemod demod;
|
||||
dsp::StereoFMDemod demodStereo;
|
||||
dsp::demod::BroadcastFM demod;
|
||||
|
||||
ConfigManager* _config = NULL;
|
||||
|
||||
bool stereo = false;
|
||||
bool _stereo = false;
|
||||
|
||||
std::string name;
|
||||
EventHandler<dsp::stream<dsp::stereo_t>*> outputChangeHandler;
|
||||
|
Reference in New Issue
Block a user