mirror of
				https://github.com/AlexandreRouma/SDRPlusPlus.git
				synced 2025-11-04 02:39:11 +01:00 
			
		
		
		
	more fixes to stereo FM
This commit is contained in:
		@@ -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);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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();
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user