Fixed SSB demod bug

This commit is contained in:
Ryzerth 2020-12-06 19:51:56 +01:00
parent c612620ca5
commit fe1de4bed9
5 changed files with 15 additions and 12 deletions

View File

@ -145,8 +145,6 @@ private:
float sampleRate = dev->sampleRates[dev->srId];
int bufferSize = sampleRate / 60.0f;
spdlog::warn("Audio SamplRate: {0}", sampleRate);
if (dev->channels == 2) {
stereoRB.data.setMaxLatency(bufferSize * 2);
stereoRB.start();

View File

@ -166,7 +166,10 @@ namespace dsp {
SSBDemod(stream<complex_t>* in, float sampleRate, float bandWidth, int mode) { init(in, sampleRate, bandWidth, mode); }
~SSBDemod() { generic_block<SSBDemod>::stop(); }
~SSBDemod() {
generic_block<SSBDemod>::stop();
delete[] buffer;
}
enum {
MODE_USB,
@ -191,6 +194,7 @@ namespace dsp {
phaseDelta = lv_cmake(1.0f, 0.0f);
break;
}
buffer = new lv_32fc_t[STREAM_BUFFER_SIZE];
generic_block<SSBDemod>::registerInput(_in);
generic_block<SSBDemod>::registerOutput(&out);
}
@ -256,8 +260,8 @@ namespace dsp {
if (count < 0) { return -1; }
if (out.aquire() < 0) { return -1; }
volk_32fc_s32fc_x2_rotator_32fc((lv_32fc_t*)out.data, (lv_32fc_t*)_in->data, phaseDelta, &phase, count);
volk_32fc_deinterleave_real_32f(out.data, (lv_32fc_t*)_in->data, count);
volk_32fc_s32fc_x2_rotator_32fc(buffer, (lv_32fc_t*)_in->data, phaseDelta, &phase, count);
volk_32fc_deinterleave_real_32f(out.data, buffer, count);
_in->flush();
out.write(count);
@ -271,6 +275,7 @@ namespace dsp {
int _mode;
float _sampleRate, _bandWidth;
stream<complex_t>* _in;
lv_32fc_t* buffer;
lv_32fc_t phase;
lv_32fc_t phaseDelta;

View File

@ -24,7 +24,7 @@ public:
agc.init(&demod.out, 1.0f / 125.0f);
float audioBW = std::min<float>(audioSampRate / 2.0f, bw / 2.0f);
float audioBW = std::min<float>(audioSampRate / 2.0f, bw);
win.init(audioBW, audioBW, bbSampRate);
resamp.init(&agc.out, &win, bbSampRate, audioSampRate);
win.setSampleRate(bbSampRate * resamp.getInterpolation());
@ -73,7 +73,7 @@ public:
resamp.stop();
}
audioSampRate = sampleRate;
float audioBW = std::min<float>(audioSampRate / 2.0f, bw / 2.0f);
float audioBW = std::min<float>(audioSampRate / 2.0f, bw);
resamp.setOutSampleRate(audioSampRate);
win.setSampleRate(bbSampRate * resamp.getInterpolation());
win.setCutoff(audioBW);

View File

@ -24,7 +24,7 @@ public:
agc.init(&demod.out, 1.0f / 125.0f);
float audioBW = std::min<float>(audioSampRate / 2.0f, bw / 2.0f);
float audioBW = std::min<float>(audioSampRate / 2.0f, bw);
win.init(audioBW, audioBW, bbSampRate);
resamp.init(&agc.out, &win, bbSampRate, audioSampRate);
win.setSampleRate(bbSampRate * resamp.getInterpolation());
@ -73,7 +73,7 @@ public:
resamp.stop();
}
audioSampRate = sampleRate;
float audioBW = std::min<float>(audioSampRate / 2.0f, bw / 2.0f);
float audioBW = std::min<float>(audioSampRate / 2.0f, bw);
resamp.setOutSampleRate(audioSampRate);
win.setSampleRate(bbSampRate * resamp.getInterpolation());
win.setCutoff(audioBW);

View File

@ -19,7 +19,7 @@
"bandPlan": "General",
"bandPlanEnabled": true,
"fftHeight": 296,
"frequency": 96400000,
"frequency": 95000000,
"max": 0.0,
"maximized": false,
"menuOrder": [
@ -33,7 +33,7 @@
"Display"
],
"menuWidth": 300,
"min": -72.05882263183594,
"min": -54.41176986694336,
"offset": 0.0,
"showWaterfall": true,
"source": "SoapySDR",
@ -42,7 +42,7 @@
"Radio": {
"muted": false,
"sink": "Audio",
"volume": 0.6858407258987427
"volume": 0.831632673740387
},
"Radio 1": {
"muted": true,