more fixes to stereo FM

pull/276/head
Ryzerth 2021-07-23 16:18:47 +02:00
rodzic 8454b40d54
commit a888065624
3 zmienionych plików z 27 dodań i 9 usunięć

Wyświetl plik

@ -686,7 +686,7 @@ namespace dsp {
pilotFilter.init(&r2c.out, &PilotFirWin);
demux.init(&pilotFilter.dataOut, &pilotFilter.pilotOut, 1.0f);
demux.init(&pilotFilter.dataOut, &pilotFilter.pilotOut, 0.1f);
recon.init(&demux.AplusBOut, &demux.AminusBOut);

Wyświetl plik

@ -157,8 +157,9 @@ namespace dsp {
for (int i = 0; i < count; i++) {
// Double the VCO, then mix it with the input data.
// IMPORTANT: THERE SHOULDN'T BE A NEED FOR A GAIN HERE
doubledVCO = lastVCO*lastVCO;
AminusBOut.writeBuf[i] = (_data->readBuf[i].re * doubledVCO.re) + (_data->readBuf[i].im * doubledVCO.im);
AminusBOut.writeBuf[i] = (_data->readBuf[i].re * doubledVCO.re) * 2.0f;
// Calculate the phase error estimation
error = _pilot->readBuf[i].phase() - vcoPhase;
@ -191,6 +192,8 @@ namespace dsp {
stream<float> AplusBOut;
stream<float> AminusBOut;
float gain = 2.0f;
private:
float _loopBandwidth = 0.01f;
@ -257,8 +260,8 @@ namespace dsp {
return 0;
}
volk_32f_x2_add_32f(leftBuf, _aplusb->readBuf, _aminusb->readBuf, a_count);
volk_32f_x2_subtract_32f(rightBuf, _aplusb->readBuf, _aminusb->readBuf, a_count);
volk_32f_x2_add_32f(rightBuf, _aplusb->readBuf, _aminusb->readBuf, a_count);
volk_32f_x2_subtract_32f(leftBuf, _aplusb->readBuf, _aminusb->readBuf, a_count);
_aplusb->flush();
_aminusb->flush();

Wyświetl plik

@ -26,22 +26,29 @@ public:
_config->acquire();
if(_config->conf.contains(prefix)) {
if(!_config->conf[prefix].contains("WFM")) {
if (!_config->conf[prefix]["WFM"].contains("bandwidth")) { _config->conf[prefix]["WFM"]["bandwidth"] = bw; }
if (!_config->conf[prefix]["WFM"].contains("snapInterval")) { _config->conf[prefix]["WFM"]["snapInterval"] = snapInterval; }
if (!_config->conf[prefix]["WFM"].contains("deempMode")) { _config->conf[prefix]["WFM"]["deempMode"] = deempId; }
if (!_config->conf[prefix]["WFM"].contains("squelchLevel")) { _config->conf[prefix]["WFM"]["squelchLevel"] = squelchLevel; }
_config->conf[prefix]["WFM"]["bandwidth"] = bw;
_config->conf[prefix]["WFM"]["snapInterval"] = snapInterval;
_config->conf[prefix]["WFM"]["deempMode"] = deempId;
_config->conf[prefix]["WFM"]["squelchLevel"] = squelchLevel;
_config->conf[prefix]["WFM"]["stereo"] = false;
}
// Correct for new settings
if (!config->conf[prefix]["WFM"].contains("stereo")) { _config->conf[prefix]["WFM"]["stereo"] = false;}
json conf = _config->conf[prefix]["WFM"];
bw = conf["bandwidth"];
snapInterval = conf["snapInterval"];
deempId = conf["deempMode"];
squelchLevel = conf["squelchLevel"];
stereo = conf["stereo"];
}
else {
_config->conf[prefix]["WFM"]["bandwidth"] = bw;
_config->conf[prefix]["WFM"]["snapInterval"] = snapInterval;
_config->conf[prefix]["WFM"]["deempMode"] = deempId;
_config->conf[prefix]["WFM"]["squelchLevel"] = squelchLevel;
_config->conf[prefix]["WFM"]["stereo"] = false;
}
_config->release(true);
@ -52,7 +59,12 @@ public:
float audioBW = std::min<float>(audioSampleRate / 2.0f, 16000.0f);
win.init(audioBW, audioBW, bbSampRate);
resamp.init(&demod.out, &win, bbSampRate, audioSampRate);
if (stereo) {
resamp.init(demodStereo.out, &win, bbSampRate, audioSampRate);
}
else {
resamp.init(&demod.out, &win, bbSampRate, audioSampRate);
}
win.setSampleRate(bbSampRate * resamp.getInterpolation());
resamp.updateWindow(&win);
@ -190,6 +202,9 @@ public:
if (ImGui::Checkbox("Stereo##radio_wfm_demod", &stereo)) {
setStereo(stereo);
_config->acquire();
_config->conf[uiPrefix]["WFM"]["stereo"] = stereo;
_config->release(true);
}
}