mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2025-06-25 12:07:49 +02:00
fix
This commit is contained in:
@ -23,7 +23,7 @@ public:
|
||||
bandWidth = 200000;
|
||||
bandWidthMin = 100000;
|
||||
bandWidthMax = 200000;
|
||||
sigPath.init(name, 200000, 1000);
|
||||
sigPath.init(name);
|
||||
sigPath.start();
|
||||
sigPath.setDemodulator(SigPath::DEMOD_FM, bandWidth);
|
||||
sigPath.vfo->setSnapInterval(100000.0);
|
||||
|
@ -1,33 +1,28 @@
|
||||
#include <path.h>
|
||||
#include <signal_path/audio.h>
|
||||
#include <spdlog/spdlog.h>
|
||||
|
||||
SigPath::SigPath() {
|
||||
|
||||
}
|
||||
|
||||
int SigPath::sampleRateChangeHandler(void* ctx, double sampleRate) {
|
||||
void SigPath::sampleRateChangeHandler(float _sampleRate, void* ctx) {
|
||||
SigPath* _this = (SigPath*)ctx;
|
||||
_this->outputSampleRate = sampleRate;
|
||||
_this->outputSampleRate = _sampleRate;
|
||||
_this->audioResamp.stop();
|
||||
_this->deemp.stop();
|
||||
float bw = std::min<float>(_this->bandwidth, sampleRate / 2.0f);
|
||||
float bw = std::min<float>(_this->bandwidth, _sampleRate / 2.0f);
|
||||
|
||||
|
||||
_this->audioResamp.setOutSampleRate(sampleRate);
|
||||
_this->audioWin.setSampleRate(_this->sampleRate * _this->audioResamp.getInterpolation());
|
||||
_this->audioResamp.setOutSampleRate(_sampleRate);
|
||||
_this->audioWin.setSampleRate(_this->demodOutputSamplerate * _this->audioResamp.getInterpolation());
|
||||
_this->audioResamp.updateWindow(&_this->audioWin);
|
||||
|
||||
_this->deemp.setSampleRate(sampleRate);
|
||||
_this->deemp.setSampleRate(_sampleRate);
|
||||
_this->audioResamp.start();
|
||||
_this->deemp.start();
|
||||
// Note: returning a block size should not be needed anymore
|
||||
return 1;
|
||||
}
|
||||
|
||||
void SigPath::init(std::string vfoName, uint64_t sampleRate, int blockSize) {
|
||||
this->sampleRate = sampleRate;
|
||||
this->blockSize = blockSize;
|
||||
void SigPath::init(std::string vfoName) {
|
||||
this->vfoName = vfoName;
|
||||
|
||||
vfo = sigpath::vfoManager.createVFO(vfoName, ImGui::WaterfallVFO::REF_CENTER, 0, 200000, 200000, 1000);
|
||||
@ -36,6 +31,7 @@ void SigPath::init(std::string vfoName, uint64_t sampleRate, int blockSize) {
|
||||
_deemp = DEEMP_50US;
|
||||
bandwidth = 200000;
|
||||
demodOutputSamplerate = 200000;
|
||||
outputSampleRate = 48000;
|
||||
|
||||
// TODO: Set default VFO options
|
||||
// TODO: ajust deemphasis for different output sample rates
|
||||
@ -53,16 +49,16 @@ void SigPath::init(std::string vfoName, uint64_t sampleRate, int blockSize) {
|
||||
audioResamp.updateWindow(&audioWin);
|
||||
|
||||
deemp.init(&audioResamp.out, 48000, 50e-6);
|
||||
|
||||
outputSampleRate = audio::registerMonoStream(&deemp.out, vfoName, vfoName, sampleRateChangeHandler, this);
|
||||
|
||||
setDemodulator(_demod, bandwidth);
|
||||
}
|
||||
m2s.setInput(&deemp.out);
|
||||
|
||||
void SigPath::setSampleRate(float sampleRate) {
|
||||
this->sampleRate = sampleRate;
|
||||
Event<float>::EventHandler evHandler;
|
||||
evHandler.handler = sampleRateChangeHandler;
|
||||
evHandler.ctx = this;
|
||||
stream.init(&m2s.out, evHandler, outputSampleRate);
|
||||
|
||||
sigpath::sinkManager.registerStream(vfoName, &stream);
|
||||
|
||||
// Reset the demodulator and audio systems
|
||||
setDemodulator(_demod, bandwidth);
|
||||
}
|
||||
|
||||
@ -215,10 +211,6 @@ void SigPath::setDemodulator(int demId, float bandWidth) {
|
||||
deemp.start();
|
||||
}
|
||||
|
||||
void SigPath::updateBlockSize() {
|
||||
setDemodulator(_demod, bandwidth);
|
||||
}
|
||||
|
||||
void SigPath::setDeemphasis(int deemph) {
|
||||
_deemp = deemph;
|
||||
deemp.stop();
|
||||
@ -290,6 +282,6 @@ void SigPath::start() {
|
||||
demod.start();
|
||||
audioResamp.start();
|
||||
deemp.start();
|
||||
//ns.start();
|
||||
audio::startStream(vfoName);
|
||||
m2s.start();
|
||||
stream.start();
|
||||
}
|
@ -4,19 +4,16 @@
|
||||
#include <dsp/filter.h>
|
||||
#include <dsp/window.h>
|
||||
#include <dsp/audio.h>
|
||||
#include <io/audio.h>
|
||||
#include <module.h>
|
||||
#include <signal_path/signal_path.h>
|
||||
#include <dsp/processing.h>
|
||||
#include <signal_path/sink.h>
|
||||
|
||||
class SigPath {
|
||||
public:
|
||||
SigPath();
|
||||
void init(std::string vfoName, uint64_t sampleRate, int blockSize);
|
||||
void init(std::string vfoName);
|
||||
void start();
|
||||
void setSampleRate(float sampleRate);
|
||||
void setVFOFrequency(uint64_t frequency);
|
||||
void updateBlockSize();
|
||||
void setDemodulator(int demod, float bandWidth);
|
||||
void setDeemphasis(int deemph);
|
||||
void setBandwidth(float bandWidth);
|
||||
@ -44,7 +41,7 @@ public:
|
||||
VFOManager::VFO* vfo;
|
||||
|
||||
private:
|
||||
static int sampleRateChangeHandler(void* ctx, double sampleRate);
|
||||
static void sampleRateChangeHandler(float _sampleRate, void* ctx);
|
||||
|
||||
dsp::stream<dsp::complex_t> input;
|
||||
|
||||
@ -57,17 +54,17 @@ private:
|
||||
dsp::AGC agc;
|
||||
|
||||
// Audio output
|
||||
dsp::MonoToStereo m2s;
|
||||
dsp::filter_window::BlackmanWindow audioWin;
|
||||
dsp::PolyphaseResampler<float> audioResamp;
|
||||
dsp::MonoToStereo m2s;
|
||||
SinkManager::Stream stream;
|
||||
|
||||
std::string vfoName;
|
||||
|
||||
float sampleRate;
|
||||
// TODO: FIx all this sample rate BS (multiple names for same thing)
|
||||
float bandwidth;
|
||||
float demodOutputSamplerate;
|
||||
float outputSampleRate;
|
||||
int blockSize;
|
||||
int _demod;
|
||||
int _deemp;
|
||||
float audioBw;
|
||||
|
Reference in New Issue
Block a user