mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2025-06-25 12:07:49 +02:00
new fixes
This commit is contained in:
@ -66,7 +66,7 @@ private:
|
||||
if (ImGui::RadioButton(CONCAT("AM##_", _this->name), _this->demod == 2) && _this->demod != 2) {
|
||||
_this->demod = 2;
|
||||
_this->bandWidth = 12500;
|
||||
_this->bandWidthMin = 6250;
|
||||
_this->bandWidthMin = 1500;
|
||||
_this->bandWidthMax = 12500;
|
||||
_this->sigPath.setDemodulator(SigPath::DEMOD_AM, _this->bandWidth);
|
||||
}
|
||||
@ -120,6 +120,9 @@ private:
|
||||
_this->bandWidth = std::clamp<int>(_this->bandWidth, _this->bandWidthMin, _this->bandWidthMax);
|
||||
_this->sigPath.setBandwidth(_this->bandWidth);
|
||||
}
|
||||
|
||||
ImGui::SliderFloat(CONCAT("##_squelch_select_", _this->name), &_this->sigPath.squelch.level, -100, 0);
|
||||
|
||||
ImGui::PopItemWidth();
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@ SigPath::SigPath() {
|
||||
|
||||
}
|
||||
|
||||
int SigPath::sampleRateChangeHandler(void* ctx, float sampleRate) {
|
||||
int SigPath::sampleRateChangeHandler(void* ctx, double sampleRate) {
|
||||
SigPath* _this = (SigPath*)ctx;
|
||||
_this->outputSampleRate = sampleRate;
|
||||
_this->audioResamp.stop();
|
||||
@ -29,15 +29,21 @@ void SigPath::init(std::string vfoName, uint64_t sampleRate, int blockSize) {
|
||||
_demod = DEMOD_FM;
|
||||
_deemp = DEEMP_50US;
|
||||
bandwidth = 200000;
|
||||
demodOutputSamplerate = 200000;
|
||||
|
||||
// TODO: Set default VFO options
|
||||
// TODO: ajust deemphasis for different output sample rates
|
||||
// TODO: Add a mono to stereo for different modes
|
||||
|
||||
demod.init(vfo->output, 100000, 200000, 800);
|
||||
amDemod.init(vfo->output, 50);
|
||||
ssbDemod.init(vfo->output, 6000, 3000, 22);
|
||||
cpx2stereo.init(vfo->output, 22);
|
||||
squelch.init(vfo->output, 800);
|
||||
squelch.level = 40;
|
||||
squelch.onCount = 1;
|
||||
squelch.offCount = 2560;
|
||||
|
||||
demod.init(squelch.out[0], 100000, 200000, 800);
|
||||
amDemod.init(squelch.out[0], 50);
|
||||
ssbDemod.init(squelch.out[0], 6000, 3000, 22);
|
||||
cpx2stereo.init(squelch.out[0], 22);
|
||||
|
||||
audioResamp.init(&demod.output, 200000, 48000, 800);
|
||||
deemp.init(&audioResamp.output, 800, 50e-6, 48000);
|
||||
@ -91,10 +97,13 @@ void SigPath::setDemodulator(int demId, float bandWidth) {
|
||||
spdlog::error("UNIMPLEMENTED DEMODULATOR IN SigPath::setDemodulator (stop)");
|
||||
}
|
||||
_demod = demId;
|
||||
|
||||
squelch.stop();
|
||||
|
||||
// Set input of the audio resampler
|
||||
// TODO: Set bandwidth from argument
|
||||
if (demId == DEMOD_FM) {
|
||||
demodOutputSamplerate = 200000;
|
||||
vfo->setSampleRate(200000, bandwidth);
|
||||
demod.setBlockSize(vfo->getOutputBlockSize());
|
||||
demod.setSampleRate(200000);
|
||||
@ -107,6 +116,7 @@ void SigPath::setDemodulator(int demId, float bandWidth) {
|
||||
demod.start();
|
||||
}
|
||||
else if (demId == DEMOD_NFM) {
|
||||
demodOutputSamplerate = 16000;
|
||||
vfo->setSampleRate(16000, bandwidth);
|
||||
demod.setBlockSize(vfo->getOutputBlockSize());
|
||||
demod.setSampleRate(16000);
|
||||
@ -119,6 +129,7 @@ void SigPath::setDemodulator(int demId, float bandWidth) {
|
||||
demod.start();
|
||||
}
|
||||
else if (demId == DEMOD_AM) {
|
||||
demodOutputSamplerate = 125000;
|
||||
vfo->setSampleRate(12500, bandwidth);
|
||||
amDemod.setBlockSize(vfo->getOutputBlockSize());
|
||||
audioResamp.setInput(&amDemod.output);
|
||||
@ -129,6 +140,7 @@ void SigPath::setDemodulator(int demId, float bandWidth) {
|
||||
amDemod.start();
|
||||
}
|
||||
else if (demId == DEMOD_USB) {
|
||||
demodOutputSamplerate = 6000;
|
||||
vfo->setSampleRate(6000, bandwidth);
|
||||
ssbDemod.setBlockSize(vfo->getOutputBlockSize());
|
||||
ssbDemod.setMode(dsp::SSBDemod::MODE_USB);
|
||||
@ -140,6 +152,7 @@ void SigPath::setDemodulator(int demId, float bandWidth) {
|
||||
ssbDemod.start();
|
||||
}
|
||||
else if (demId == DEMOD_LSB) {
|
||||
demodOutputSamplerate = 6000;
|
||||
vfo->setSampleRate(6000, bandwidth);
|
||||
ssbDemod.setBlockSize(vfo->getOutputBlockSize());
|
||||
ssbDemod.setMode(dsp::SSBDemod::MODE_LSB);
|
||||
@ -151,6 +164,7 @@ void SigPath::setDemodulator(int demId, float bandWidth) {
|
||||
ssbDemod.start();
|
||||
}
|
||||
else if (demId == DEMOD_DSB) {
|
||||
demodOutputSamplerate = 6000;
|
||||
vfo->setSampleRate(6000, bandwidth);
|
||||
ssbDemod.setBlockSize(vfo->getOutputBlockSize());
|
||||
ssbDemod.setMode(dsp::SSBDemod::MODE_DSB);
|
||||
@ -162,6 +176,7 @@ void SigPath::setDemodulator(int demId, float bandWidth) {
|
||||
ssbDemod.start();
|
||||
}
|
||||
else if (demId == DEMOD_RAW) {
|
||||
demodOutputSamplerate = 10000;
|
||||
vfo->setSampleRate(10000, bandwidth);
|
||||
cpx2stereo.setBlockSize(vfo->getOutputBlockSize());
|
||||
//audioResamp.setInput(&cpx2stereo.output);
|
||||
@ -174,6 +189,9 @@ void SigPath::setDemodulator(int demId, float bandWidth) {
|
||||
spdlog::error("UNIMPLEMENTED DEMODULATOR IN SigPath::setDemodulator (start): {0}", demId);
|
||||
}
|
||||
|
||||
squelch.setBlockSize(vfo->getOutputBlockSize());
|
||||
squelch.start();
|
||||
|
||||
deemp.setBlockSize(audioResamp.getOutputBlockSize());
|
||||
|
||||
audioResamp.start();
|
||||
@ -242,12 +260,15 @@ void SigPath::setBandwidth(float bandWidth) {
|
||||
if (audioBw != _audioBw) {
|
||||
audioBw = _audioBw;
|
||||
audioResamp.stop();
|
||||
audioResamp.setInputSampleRate(6000, vfo->getOutputBlockSize(), audioBw, audioBw);
|
||||
audioResamp.setFilterParams(audioBw, audioBw);
|
||||
audioResamp.setBlockSize(vfo->getOutputBlockSize());
|
||||
//audioResamp.setInputSampleRate(demodOutputSamplerate, vfo->getOutputBlockSize(), audioBw, audioBw);
|
||||
audioResamp.start();
|
||||
}
|
||||
}
|
||||
|
||||
void SigPath::start() {
|
||||
squelch.start();
|
||||
demod.start();
|
||||
audioResamp.start();
|
||||
deemp.start();
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include <dsp/sink.h>
|
||||
#include <dsp/correction.h>
|
||||
#include <dsp/vfo.h>
|
||||
#include <dsp/block.h>
|
||||
#include <io/audio.h>
|
||||
#include <module.h>
|
||||
#include <signal_path/signal_path.h>
|
||||
@ -44,14 +45,17 @@ public:
|
||||
|
||||
|
||||
dsp::FMDeemphasis deemp;
|
||||
dsp::Squelch squelch;
|
||||
|
||||
private:
|
||||
static int sampleRateChangeHandler(void* ctx, float sampleRate);
|
||||
static int sampleRateChangeHandler(void* ctx, double sampleRate);
|
||||
|
||||
VFOManager::VFO* vfo;
|
||||
|
||||
dsp::stream<dsp::complex_t> input;
|
||||
|
||||
|
||||
|
||||
// Demodulators
|
||||
dsp::FMDemodulator demod;
|
||||
dsp::AMDemodulator amDemod;
|
||||
@ -66,6 +70,7 @@ private:
|
||||
|
||||
float sampleRate;
|
||||
float bandwidth;
|
||||
float demodOutputSamplerate;
|
||||
float outputSampleRate;
|
||||
int blockSize;
|
||||
int _demod;
|
||||
|
Reference in New Issue
Block a user