diff --git a/CMakeLists.txt b/CMakeLists.txt index 2e5b2f1b1..8e6359a87 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,7 +28,7 @@ option(V4L-MSI "Use Linux Kernel MSI2500 Source." OFF) option(BUILD_TYPE "Build type (RELEASE, RELEASEWITHDBGINFO, DEBUG" RELEASE) option(DEBUG_OUTPUT "Print debug messages" OFF) option(HOST_RPI "Compiling on RPi" OFF) -option(SAMPLE_24BIT "Internal 24 bit DSP" OFF) +option(RX_SAMPLE_24BIT "Internal 24 bit Rx DSP" OFF) list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules) @@ -187,8 +187,8 @@ elseif (${ARCHITECTURE} MATCHES "aarch64") endif() # Compiler flags. -if (SAMPLE_24BIT) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSDR_SAMPLE_24BIT") +if (RX_SAMPLE_24BIT) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSDR_RX_SAMPLE_24BIT") endif() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -fmax-errors=10 -ffast-math -ftree-vectorize ${EXTRA_FLAGS}") diff --git a/devices/plutosdr/deviceplutosdrbox.cpp b/devices/plutosdr/deviceplutosdrbox.cpp index 0ac0c7203..e5690c17e 100644 --- a/devices/plutosdr/deviceplutosdrbox.cpp +++ b/devices/plutosdr/deviceplutosdrbox.cpp @@ -639,7 +639,7 @@ void DevicePlutoSDRBox::formatFIRCoefficients(std::ostringstream& ostr, uint32_t WFIR::BasicFIR(fcoeffs, nbTaps, WFIR::LPF, normalizedBW, 0.0, normalizedBW < 0.2 ? WFIR::wtHAMMING : WFIR::wtBLACKMAN_HARRIS, 0.0); for (unsigned int i = 0; i < nbTaps; i++) { - ostr << (int16_t) (fcoeffs[i] * SDR_SCALEF) << ", " << (int16_t) (fcoeffs[i] * SDR_SCALEF) << std::endl; + ostr << (int16_t) (fcoeffs[i] * 32768.0f) << ", " << (int16_t) (fcoeffs[i] * 32768.0f) << std::endl; } delete[] fcoeffs; diff --git a/plugins/channelrx/chanalyzer/chanalyzer.cpp b/plugins/channelrx/chanalyzer/chanalyzer.cpp index cb4e627bd..c8f80498f 100644 --- a/plugins/channelrx/chanalyzer/chanalyzer.cpp +++ b/plugins/channelrx/chanalyzer/chanalyzer.cpp @@ -114,8 +114,8 @@ void ChannelAnalyzer::feed(const SampleVector::const_iterator& begin, const Samp if (!(m_undersampleCount++ & decim_mask)) { m_sum /= decim; - Real re = m_sum.real() / SDR_SCALED; - Real im = m_sum.imag() / SDR_SCALED; + Real re = m_sum.real() / SDR_RX_SCALED; + Real im = m_sum.imag() / SDR_RX_SCALED; m_magsq = re*re + im*im; if (m_ssb & !m_usb) diff --git a/plugins/channelrx/chanalyzerng/chanalyzerng.h b/plugins/channelrx/chanalyzerng/chanalyzerng.h index 5734ee235..aea652558 100644 --- a/plugins/channelrx/chanalyzerng/chanalyzerng.h +++ b/plugins/channelrx/chanalyzerng/chanalyzerng.h @@ -229,8 +229,8 @@ private: if (!(m_undersampleCount++ & (decim - 1))) // counter LSB bit mask for decimation by 2^(m_scaleLog2 - 1) { m_sum /= decim; - Real re = m_sum.real() / SDR_SCALED; - Real im = m_sum.imag() / SDR_SCALED; + Real re = m_sum.real() / SDR_RX_SCALED; + Real im = m_sum.imag() / SDR_RX_SCALED; m_magsq = re*re + im*im; if (m_running.m_ssb & !m_usb) diff --git a/plugins/channelrx/demodam/amdemod.h b/plugins/channelrx/demodam/amdemod.h index 01ebe092a..ccbab6fb5 100644 --- a/plugins/channelrx/demodam/amdemod.h +++ b/plugins/channelrx/demodam/amdemod.h @@ -161,8 +161,8 @@ private: void processOneSample(Complex &ci) { - Real re = ci.real() / SDR_SCALED; - Real im = ci.imag() / SDR_SCALED; + Real re = ci.real() / SDR_RX_SCALED; + Real im = ci.imag() / SDR_RX_SCALED; Real magsq = re*re + im*im; m_movingAverage.feed(magsq); m_magsq = m_movingAverage.average(); @@ -210,7 +210,7 @@ private: Real attack = (m_squelchCount - 0.05f * m_settings.m_audioSampleRate) / (0.05f * m_settings.m_audioSampleRate); sample = demod * attack * 2048 * m_settings.m_volume; - if (m_settings.m_copyAudioToUDP) m_udpBufferAudio->write(demod * attack * SDR_SCALEF); + if (m_settings.m_copyAudioToUDP) m_udpBufferAudio->write(demod * attack * SDR_RX_SCALEF); m_squelchOpen = true; } diff --git a/plugins/channelrx/demodatv/atvdemod.cpp b/plugins/channelrx/demodatv/atvdemod.cpp index d1acb0355..1eb83fa25 100644 --- a/plugins/channelrx/demodatv/atvdemod.cpp +++ b/plugins/channelrx/demodatv/atvdemod.cpp @@ -338,7 +338,7 @@ void ATVDemod::demod(Complex& c) magSq = fltI*fltI + fltQ*fltQ; m_objMagSqAverage.feed(magSq); fltNorm = sqrt(magSq); - fltVal = fltNorm / SDR_SCALEF; + fltVal = fltNorm / SDR_RX_SCALEF; //********** Mini and Maxi Amplitude tracking ********** diff --git a/plugins/channelrx/demodatv/atvdemodgui.cpp b/plugins/channelrx/demodatv/atvdemodgui.cpp index 586f79d52..530f9e95f 100644 --- a/plugins/channelrx/demodatv/atvdemodgui.cpp +++ b/plugins/channelrx/demodatv/atvdemodgui.cpp @@ -474,7 +474,7 @@ void ATVDemodGUI::tick() if (m_atvDemod) { m_objMagSqAverage.feed(m_atvDemod->getMagSq()); - double magSqDB = CalcDb::dbPower(m_objMagSqAverage.average() / (SDR_SCALED*SDR_SCALED)); + double magSqDB = CalcDb::dbPower(m_objMagSqAverage.average() / (SDR_RX_SCALED*SDR_RX_SCALED)); ui->channePowerText->setText(tr("%1 dB").arg(magSqDB, 0, 'f', 1)); if (m_atvDemod->getBFOLocked()) { diff --git a/plugins/channelrx/demodbfm/bfmdemod.cpp b/plugins/channelrx/demodbfm/bfmdemod.cpp index 4f1a54774..8e432c33a 100644 --- a/plugins/channelrx/demodbfm/bfmdemod.cpp +++ b/plugins/channelrx/demodbfm/bfmdemod.cpp @@ -125,7 +125,7 @@ void BFMDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto for (SampleVector::const_iterator it = begin; it != end; ++it) { - Complex c(it->real() / SDR_SCALEF, it->imag() / SDR_SCALEF); + Complex c(it->real() / SDR_RX_SCALEF, it->imag() / SDR_RX_SCALEF); c *= m_nco.nextIQ(); rf_out = m_rfFilter->runFilt(c, &rf); // filter RF before demod @@ -163,7 +163,7 @@ void BFMDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto if (!m_settings.m_showPilot) { - m_sampleBuffer.push_back(Sample(demod * SDR_SCALEF, 0.0)); + m_sampleBuffer.push_back(Sample(demod * SDR_RX_SCALEF, 0.0)); } if (m_settings.m_rdsActive) @@ -197,7 +197,7 @@ void BFMDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto if (m_settings.m_showPilot) { - m_sampleBuffer.push_back(Sample(m_pilotPLLSamples[1] * SDR_SCALEF, 0.0)); // debug 38 kHz pilot + m_sampleBuffer.push_back(Sample(m_pilotPLLSamples[1] * SDR_RX_SCALEF, 0.0)); // debug 38 kHz pilot } if (m_settings.m_lsbStereo) diff --git a/plugins/channelrx/demoddsd/dsddemod.cpp b/plugins/channelrx/demoddsd/dsddemod.cpp index 451e21497..d067bfa4e 100644 --- a/plugins/channelrx/demoddsd/dsddemod.cpp +++ b/plugins/channelrx/demoddsd/dsddemod.cpp @@ -128,8 +128,8 @@ void DSDDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto { qint16 sample, delayedSample; - Real re = ci.real() / SDR_SCALED; - Real im = ci.imag() / SDR_SCALED; + Real re = ci.real() / SDR_RX_SCALED; + Real im = ci.imag() / SDR_RX_SCALED; Real magsq = re*re + im*im; m_movingAverage.feed(magsq); @@ -142,7 +142,7 @@ void DSDDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto m_magsqCount++; - Real demod = SDR_SCALEF * m_phaseDiscri.phaseDiscriminator(ci) * m_settings.m_demodGain; + Real demod = SDR_RX_SCALEF * m_phaseDiscri.phaseDiscriminator(ci) * m_settings.m_demodGain; m_sampleCount++; // AF processing diff --git a/plugins/channelrx/demodlora/lorademod.cpp b/plugins/channelrx/demodlora/lorademod.cpp index cd30f01a6..b0b397279 100644 --- a/plugins/channelrx/demodlora/lorademod.cpp +++ b/plugins/channelrx/demodlora/lorademod.cpp @@ -261,7 +261,7 @@ void LoRaDemod::feed(const SampleVector::const_iterator& begin, const SampleVect for(SampleVector::const_iterator it = begin; it < end; ++it) { - Complex c(it->real() / SDR_SCALEF, it->imag() / SDR_SCALEF); + Complex c(it->real() / SDR_RX_SCALEF, it->imag() / SDR_RX_SCALEF); c *= m_nco.nextIQ(); if(m_interpolator.decimate(&m_sampleDistanceRemain, c, &ci)) diff --git a/plugins/channelrx/demodnfm/nfmdemod.cpp b/plugins/channelrx/demodnfm/nfmdemod.cpp index 7fdcb54eb..db7243800 100644 --- a/plugins/channelrx/demodnfm/nfmdemod.cpp +++ b/plugins/channelrx/demodnfm/nfmdemod.cpp @@ -153,7 +153,7 @@ void NFMDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto Real demod = m_phaseDiscri.phaseDiscriminatorDelta(ci, magsqRaw, deviation); - Real magsq = magsqRaw / (SDR_SCALED*SDR_SCALED); + Real magsq = magsqRaw / (SDR_RX_SCALED*SDR_RX_SCALED); m_movingAverage.feed(magsq); m_magsqSum += magsq; diff --git a/plugins/channelrx/demodssb/ssbdemod.cpp b/plugins/channelrx/demodssb/ssbdemod.cpp index 44f880e98..743985adb 100644 --- a/plugins/channelrx/demodssb/ssbdemod.cpp +++ b/plugins/channelrx/demodssb/ssbdemod.cpp @@ -77,7 +77,7 @@ SSBDemod::SSBDemod(DeviceSourceAPI *deviceAPI) : m_magsqPeak = 0.0f; m_magsqCount = 0; - m_agc.setClampMax(SDR_SCALED*SDR_SCALED); + m_agc.setClampMax(SDR_RX_SCALED*SDR_RX_SCALED); m_agc.setClamping(m_agcClamping); SSBFilter = new fftfilt(m_LowCutoff / m_audioSampleRate, m_Bandwidth / m_audioSampleRate, ssbFftLen); @@ -186,7 +186,7 @@ void SSBDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto { Real avgr = m_sum.real() / decim; Real avgi = m_sum.imag() / decim; - m_magsq = (avgr * avgr + avgi * avgi) / (SDR_SCALED*SDR_SCALED); + m_magsq = (avgr * avgr + avgi * avgi) / (SDR_RX_SCALED*SDR_RX_SCALED); m_magsqSum += m_magsq; @@ -427,7 +427,7 @@ void SSBDemod::applySettings(const SSBDemodSettings& settings, bool force) { int agcNbSamples = 48 * (1< 0)) { for(SampleVector::const_iterator it = m_sampleBuffer.begin(); it != m_sampleBuffer.end(); ++it) { - Complex cj(it->real() / SDR_SCALEF, it->imag() / SDR_SCALEF); + Complex cj(it->real() / SDR_RX_SCALEF, it->imag() / SDR_RX_SCALEF); // An FFT filter here is overkill, but was already set up for SSB int n_out = TCPFilter->runFilt(cj, &sideband); if (n_out) { diff --git a/plugins/channelrx/udpsrc/udpsrc.cpp b/plugins/channelrx/udpsrc/udpsrc.cpp index 6652c53ab..01b45a35a 100644 --- a/plugins/channelrx/udpsrc/udpsrc.cpp +++ b/plugins/channelrx/udpsrc/udpsrc.cpp @@ -92,7 +92,7 @@ UDPSrc::UDPSrc(DeviceSourceAPI *deviceAPI) : qWarning("UDPSrc::UDPSrc: cannot bind audio port"); } - m_agc.setClampMax(SDR_SCALED*SDR_SCALED); + m_agc.setClampMax(SDR_RX_SCALED*SDR_RX_SCALED); m_agc.setClamping(true); //DSPEngine::instance()->addAudioSink(&m_audioFifo); @@ -158,7 +158,7 @@ void UDPSrc::feed(const SampleVector::const_iterator& begin, const SampleVector: inMagSq = ci.real()*ci.real() + ci.imag()*ci.imag(); } - m_inMovingAverage.feed(inMagSq / (SDR_SCALED*SDR_SCALED)); + m_inMovingAverage.feed(inMagSq / (SDR_RX_SCALED*SDR_RX_SCALED)); m_inMagsq = m_inMovingAverage.average(); Sample ss(ci.real(), ci.imag()); @@ -180,7 +180,7 @@ void UDPSrc::feed(const SampleVector::const_iterator& begin, const SampleVector: l = m_squelchOpen ? sideband[i].real() * m_settings.m_gain : 0; r = m_squelchOpen ? sideband[i].imag() * m_settings.m_gain : 0; m_udpBuffer->write(Sample(l, r)); - m_outMovingAverage.feed((l*l + r*r) / (SDR_SCALED*SDR_SCALED)); + m_outMovingAverage.feed((l*l + r*r) / (SDR_RX_SCALED*SDR_RX_SCALED)); } } } @@ -196,21 +196,21 @@ void UDPSrc::feed(const SampleVector::const_iterator& begin, const SampleVector: l = m_squelchOpen ? sideband[i].real() * m_settings.m_gain : 0; r = m_squelchOpen ? sideband[i].imag() * m_settings.m_gain : 0; m_udpBuffer->write(Sample(l, r)); - m_outMovingAverage.feed((l*l + r*r) / (SDR_SCALED*SDR_SCALED)); + m_outMovingAverage.feed((l*l + r*r) / (SDR_RX_SCALED*SDR_RX_SCALED)); } } } else if (m_settings.m_sampleFormat == UDPSrcSettings::FormatNFM) { - double demod = m_squelchOpen ? SDR_SCALED * m_phaseDiscri.phaseDiscriminator(ci) * m_settings.m_gain : 0; + double demod = m_squelchOpen ? SDR_RX_SCALED * m_phaseDiscri.phaseDiscriminator(ci) * m_settings.m_gain : 0; m_udpBuffer->write(Sample(demod, demod)); - m_outMovingAverage.feed((demod * demod) / (SDR_SCALED*SDR_SCALED)); + m_outMovingAverage.feed((demod * demod) / (SDR_RX_SCALED*SDR_RX_SCALED)); } else if (m_settings.m_sampleFormat == UDPSrcSettings::FormatNFMMono) { - FixReal demod = m_squelchOpen ? (FixReal) (SDR_SCALEF * m_phaseDiscri.phaseDiscriminator(ci) * m_settings.m_gain) : 0; + FixReal demod = m_squelchOpen ? (FixReal) (SDR_RX_SCALEF * m_phaseDiscri.phaseDiscriminator(ci) * m_settings.m_gain) : 0; m_udpBufferMono->write(demod); - m_outMovingAverage.feed((demod * demod) / 1073741824.0); + m_outMovingAverage.feed((demod * demod) / SDR_RX_SCALED*SDR_RX_SCALED); } else if (m_settings.m_sampleFormat == UDPSrcSettings::FormatLSBMono) // Monaural LSB { @@ -223,7 +223,7 @@ void UDPSrc::feed(const SampleVector::const_iterator& begin, const SampleVector: { l = m_squelchOpen ? (sideband[i].real() + sideband[i].imag()) * 0.7 * m_settings.m_gain : 0; m_udpBufferMono->write(l); - m_outMovingAverage.feed((l * l) / (SDR_SCALED*SDR_SCALED)); + m_outMovingAverage.feed((l * l) / (SDR_RX_SCALED*SDR_RX_SCALED)); } } } @@ -238,7 +238,7 @@ void UDPSrc::feed(const SampleVector::const_iterator& begin, const SampleVector: { l = m_squelchOpen ? (sideband[i].real() + sideband[i].imag()) * 0.7 * m_settings.m_gain : 0; m_udpBufferMono->write(l); - m_outMovingAverage.feed((l * l) / (SDR_SCALED*SDR_SCALED)); + m_outMovingAverage.feed((l * l) / (SDR_RX_SCALED*SDR_RX_SCALED)); } } } @@ -246,7 +246,7 @@ void UDPSrc::feed(const SampleVector::const_iterator& begin, const SampleVector: { FixReal demod = m_squelchOpen ? (FixReal) (sqrt(inMagSq) * agcFactor * m_settings.m_gain) : 0; m_udpBufferMono->write(demod); - m_outMovingAverage.feed((demod * demod) / 1073741824.0); + m_outMovingAverage.feed((demod * demod) / SDR_RX_SCALED*SDR_RX_SCALED); } else if (m_settings.m_sampleFormat == UDPSrcSettings::FormatAMNoDCMono) { @@ -256,7 +256,7 @@ void UDPSrc::feed(const SampleVector::const_iterator& begin, const SampleVector: m_amMovingAverage.feed(demodf); FixReal demod = (FixReal) ((demodf - m_amMovingAverage.average()) * agcFactor * m_settings.m_gain); m_udpBufferMono->write(demod); - m_outMovingAverage.feed((demod * demod) / 1073741824.0); + m_outMovingAverage.feed((demod * demod) / SDR_RX_SCALED*SDR_RX_SCALED); } else { @@ -273,7 +273,7 @@ void UDPSrc::feed(const SampleVector::const_iterator& begin, const SampleVector: demodf /= 301.0; FixReal demod = (FixReal) (demodf * agcFactor * m_settings.m_gain); m_udpBufferMono->write(demod); - m_outMovingAverage.feed((demod * demod) / 1073741824.0); + m_outMovingAverage.feed((demod * demod) / SDR_RX_SCALED*SDR_RX_SCALED); } else { @@ -287,7 +287,7 @@ void UDPSrc::feed(const SampleVector::const_iterator& begin, const SampleVector: { Sample s(ci.real() * m_settings.m_gain, ci.imag() * m_settings.m_gain); m_udpBuffer->write(s); - m_outMovingAverage.feed((inMagSq*m_settings.m_gain*m_settings.m_gain) / (SDR_SCALED*SDR_SCALED)); + m_outMovingAverage.feed((inMagSq*m_settings.m_gain*m_settings.m_gain) / (SDR_RX_SCALED*SDR_RX_SCALED)); } else { diff --git a/plugins/channeltx/modam/ammod.cpp b/plugins/channeltx/modam/ammod.cpp index 17672a523..479eb39c2 100644 --- a/plugins/channeltx/modam/ammod.cpp +++ b/plugins/channeltx/modam/ammod.cpp @@ -130,7 +130,7 @@ void AMMod::pull(Sample& sample) m_settingsMutex.unlock(); double magsq = ci.real() * ci.real() + ci.imag() * ci.imag(); - magsq /= (SDR_SCALED*SDR_SCALED); + magsq /= (SDR_TX_SCALED*SDR_TX_SCALED); m_movingAverage.feed(magsq); m_magsq = m_movingAverage.average(); diff --git a/plugins/channeltx/modatv/atvmod.cpp b/plugins/channeltx/modatv/atvmod.cpp index bbc079a25..35dc83fdf 100644 --- a/plugins/channeltx/modatv/atvmod.cpp +++ b/plugins/channeltx/modatv/atvmod.cpp @@ -164,7 +164,7 @@ void ATVMod::pullFinalize(Complex& ci, Sample& sample) m_settingsMutex.unlock(); double magsq = ci.real() * ci.real() + ci.imag() * ci.imag(); - magsq /= (SDR_SCALED*SDR_SCALED); + magsq /= (SDR_TX_SCALED*SDR_TX_SCALED); m_movingAverage.feed(magsq); sample.m_real = (FixReal) ci.real(); diff --git a/plugins/channeltx/modatv/atvmodsettings.cpp b/plugins/channeltx/modatv/atvmodsettings.cpp index 192c98db9..dc32d0371 100644 --- a/plugins/channeltx/modatv/atvmodsettings.cpp +++ b/plugins/channeltx/modatv/atvmodsettings.cpp @@ -43,7 +43,7 @@ void ATVModSettings::resetToDefaults() m_cameraPlay = false; m_channelMute = false; m_invertedVideo = false; - m_rfScalingFactor = 0.891235351562f * SDR_SCALEF; // -1dB + m_rfScalingFactor = 0.891235351562f * SDR_TX_SCALEF; // -1dB m_fmExcursion = 0.5f; // half bandwidth m_forceDecimator = false; m_overlayText = "ATV"; diff --git a/plugins/channeltx/modnfm/nfmmod.cpp b/plugins/channeltx/modnfm/nfmmod.cpp index 812e52332..2d49ef740 100644 --- a/plugins/channeltx/modnfm/nfmmod.cpp +++ b/plugins/channeltx/modnfm/nfmmod.cpp @@ -136,7 +136,7 @@ void NFMMod::pull(Sample& sample) m_settingsMutex.unlock(); double magsq = ci.real() * ci.real() + ci.imag() * ci.imag(); - magsq /= (SDR_SCALED*SDR_SCALED); + magsq /= (SDR_TX_SCALED*SDR_TX_SCALED); m_movingAverage.feed(magsq); m_magsq = m_movingAverage.average(); @@ -175,8 +175,8 @@ void NFMMod::modulateSample() m_modPhasor += (m_settings.m_fmDeviation / (float) m_settings.m_audioSampleRate) * m_bandpass.filter(t) * (M_PI / 378.0f); } - m_modSample.real(cos(m_modPhasor) * 0.891235351562f * SDR_SCALEF); // -1 dB - m_modSample.imag(sin(m_modPhasor) * 0.891235351562f * SDR_SCALEF); + m_modSample.real(cos(m_modPhasor) * 0.891235351562f * SDR_TX_SCALEF); // -1 dB + m_modSample.imag(sin(m_modPhasor) * 0.891235351562f * SDR_TX_SCALEF); } void NFMMod::pullAF(Real& sample) diff --git a/plugins/channeltx/modssb/ssbmod.cpp b/plugins/channeltx/modssb/ssbmod.cpp index 84d8e7a72..662abc634 100644 --- a/plugins/channeltx/modssb/ssbmod.cpp +++ b/plugins/channeltx/modssb/ssbmod.cpp @@ -160,12 +160,12 @@ void SSBMod::pull(Sample& sample) m_interpolatorDistanceRemain += m_interpolatorDistance; ci *= m_carrierNco.nextIQ(); // shift to carrier frequency - ci *= 0.891235351562f * SDR_SCALEF; //scaling at -1 dB to account for possible filter overshoot + ci *= 0.891235351562f * SDR_TX_SCALEF; //scaling at -1 dB to account for possible filter overshoot m_settingsMutex.unlock(); double magsq = ci.real() * ci.real() + ci.imag() * ci.imag(); - magsq /= (SDR_SCALED*SDR_SCALED); + magsq /= (SDR_TX_SCALED*SDR_TX_SCALED); m_movingAverage.feed(magsq); m_magsq = m_movingAverage.average(); @@ -298,13 +298,13 @@ void SSBMod::pullAF(Complex& sample) { if (m_settings.m_audioFlipChannels) { - ci.real((m_audioBuffer[m_audioBufferFill].r / SDR_SCALEF) * m_settings.m_volumeFactor); - ci.imag((m_audioBuffer[m_audioBufferFill].l / SDR_SCALEF) * m_settings.m_volumeFactor); + ci.real((m_audioBuffer[m_audioBufferFill].r / SDR_TX_SCALEF) * m_settings.m_volumeFactor); + ci.imag((m_audioBuffer[m_audioBufferFill].l / SDR_TX_SCALEF) * m_settings.m_volumeFactor); } else { - ci.real((m_audioBuffer[m_audioBufferFill].l / SDR_SCALEF) * m_settings.m_volumeFactor); - ci.imag((m_audioBuffer[m_audioBufferFill].r / SDR_SCALEF) * m_settings.m_volumeFactor); + ci.real((m_audioBuffer[m_audioBufferFill].l / SDR_TX_SCALEF) * m_settings.m_volumeFactor); + ci.imag((m_audioBuffer[m_audioBufferFill].r / SDR_TX_SCALEF) * m_settings.m_volumeFactor); } } else @@ -419,8 +419,8 @@ void SSBMod::pullAF(Complex& sample) if (!(m_undersampleCount++ & decim_mask)) { - Real avgr = (m_sum.real() / decim) * 0.891235351562f * SDR_SCALEF; //scaling at -1 dB to account for possible filter overshoot - Real avgi = (m_sum.imag() / decim) * 0.891235351562f * SDR_SCALEF; + Real avgr = (m_sum.real() / decim) * 0.891235351562f * SDR_TX_SCALEF; //scaling at -1 dB to account for possible filter overshoot + Real avgi = (m_sum.imag() / decim) * 0.891235351562f * SDR_TX_SCALEF; if (!m_settings.m_dsb & !m_settings.m_usb) { // invert spectrum for LSB @@ -443,8 +443,8 @@ void SSBMod::pullAF(Complex& sample) if (!(m_undersampleCount++ & decim_mask)) { - Real avgr = (m_sum.real() / decim) * 0.891235351562f * SDR_SCALEF; //scaling at -1 dB to account for possible filter overshoot - Real avgi = (m_sum.imag() / decim) * 0.891235351562f * SDR_SCALEF; + Real avgr = (m_sum.real() / decim) * 0.891235351562f * SDR_TX_SCALEF; //scaling at -1 dB to account for possible filter overshoot + Real avgi = (m_sum.imag() / decim) * 0.891235351562f * SDR_TX_SCALEF; if (!m_settings.m_dsb & !m_settings.m_usb) { // invert spectrum for LSB diff --git a/plugins/channeltx/modwfm/wfmmod.cpp b/plugins/channeltx/modwfm/wfmmod.cpp index 7492b6a77..87bf31fc6 100644 --- a/plugins/channeltx/modwfm/wfmmod.cpp +++ b/plugins/channeltx/modwfm/wfmmod.cpp @@ -139,8 +139,8 @@ void WFMMod::pull(Sample& sample) } m_modPhasor += (m_settings.m_fmDeviation / (float) m_outputSampleRate) * ri.real() * M_PI * 2.0f; - ci.real(cos(m_modPhasor) * 0.891235351562f * SDR_SCALEF); // -1 dB - ci.imag(sin(m_modPhasor) * 0.891235351562f * SDR_SCALEF); + ci.real(cos(m_modPhasor) * 0.891235351562f * SDR_TX_SCALEF); // -1 dB + ci.imag(sin(m_modPhasor) * 0.891235351562f * SDR_TX_SCALEF); // RF filtering rf_out = m_rfFilter->runFilt(ci, &rf); @@ -158,7 +158,7 @@ void WFMMod::pull(Sample& sample) m_settingsMutex.unlock(); double magsq = ci.real() * ci.real() + ci.imag() * ci.imag(); - magsq /= (SDR_SCALED*SDR_SCALED); + magsq /= (SDR_TX_SCALED*SDR_TX_SCALED); m_movingAverage.feed(magsq); m_magsq = m_movingAverage.average(); diff --git a/plugins/channeltx/udpsink/udpsink.cpp b/plugins/channeltx/udpsink/udpsink.cpp index f36fd1737..3915fabf4 100644 --- a/plugins/channeltx/udpsink/udpsink.cpp +++ b/plugins/channeltx/udpsink/udpsink.cpp @@ -134,7 +134,7 @@ void UDPSink::pull(Sample& sample) m_settingsMutex.unlock(); double magsq = ci.real() * ci.real() + ci.imag() * ci.imag(); - magsq /= (SDR_SCALED*SDR_SCALED); + magsq /= (SDR_TX_SCALED*SDR_TX_SCALED); m_movingAverage.feed(magsq); m_magsq = m_movingAverage.average(); @@ -151,7 +151,7 @@ void UDPSink::modulateSample() m_udpHandler.readSample(s); uint64_t magsq = s.m_real * s.m_real + s.m_imag * s.m_imag; - m_inMovingAverage.feed(magsq/1073741824.0); + m_inMovingAverage.feed(magsq/(SDR_TX_SCALED*SDR_TX_SCALED)); m_inMagsq = m_inMovingAverage.average(); calculateSquelch(m_inMagsq); @@ -180,9 +180,9 @@ void UDPSink::modulateSample() if (m_squelchOpen) { - m_modPhasor += (m_settings.m_fmDeviation / m_settings.m_inputSampleRate) * (t / SDR_SCALEF) * M_PI * 2.0f; - m_modSample.real(cos(m_modPhasor) * 0.3162292f * SDR_SCALEF * m_settings.m_gainOut); - m_modSample.imag(sin(m_modPhasor) * 0.3162292f * SDR_SCALEF * m_settings.m_gainOut); + m_modPhasor += (m_settings.m_fmDeviation / m_settings.m_inputSampleRate) * (t / SDR_TX_SCALEF) * M_PI * 2.0f; + m_modSample.real(cos(m_modPhasor) * 0.3162292f * SDR_TX_SCALEF * m_settings.m_gainOut); + m_modSample.imag(sin(m_modPhasor) * 0.3162292f * SDR_TX_SCALEF * m_settings.m_gainOut); calculateLevel(m_modSample); } else @@ -195,14 +195,14 @@ void UDPSink::modulateSample() { FixReal t; readMonoSample(t); - m_inMovingAverage.feed((t*t)/(SDR_SCALED*SDR_SCALED)); + m_inMovingAverage.feed((t*t)/(SDR_TX_SCALED*SDR_TX_SCALED)); m_inMagsq = m_inMovingAverage.average(); calculateSquelch(m_inMagsq); if (m_squelchOpen) { - m_modSample.real(((t / SDR_SCALEF)*m_settings.m_amModFactor*m_settings.m_gainOut + 1.0f) * (SDR_SCALEF/2)); // modulate and scale zero frequency carrier + m_modSample.real(((t / SDR_TX_SCALEF)*m_settings.m_amModFactor*m_settings.m_gainOut + 1.0f) * (SDR_TX_SCALEF/2)); // modulate and scale zero frequency carrier m_modSample.imag(0.0f); calculateLevel(m_modSample); } @@ -220,14 +220,14 @@ void UDPSink::modulateSample() int n_out = 0; readMonoSample(t); - m_inMovingAverage.feed((t*t)/1073741824.0); + m_inMovingAverage.feed((t*t)/(SDR_TX_SCALED*SDR_TX_SCALED)); m_inMagsq = m_inMovingAverage.average(); calculateSquelch(m_inMagsq); if (m_squelchOpen) { - ci.real((t / SDR_SCALEF) * m_settings.m_gainOut); + ci.real((t / SDR_TX_SCALEF) * m_settings.m_gainOut); ci.imag(0.0f); n_out = m_SSBFilter->runSSB(ci, &filtered, (m_settings.m_sampleFormat == UDPSinkSettings::FormatUSB)); @@ -239,8 +239,8 @@ void UDPSink::modulateSample() } c = m_SSBFilterBuffer[m_SSBFilterBufferIndex]; - m_modSample.real(m_SSBFilterBuffer[m_SSBFilterBufferIndex].real() * SDR_SCALEF); - m_modSample.imag(m_SSBFilterBuffer[m_SSBFilterBufferIndex].imag() * SDR_SCALEF); + m_modSample.real(m_SSBFilterBuffer[m_SSBFilterBufferIndex].real() * SDR_TX_SCALEF); + m_modSample.imag(m_SSBFilterBuffer[m_SSBFilterBufferIndex].imag() * SDR_TX_SCALEF); m_SSBFilterBufferIndex++; calculateLevel(m_modSample); @@ -305,8 +305,8 @@ void UDPSink::calculateLevel(Complex sample) } else { - qreal rmsLevel = m_levelSum > 0.0 ? sqrt((m_levelSum/(SDR_SCALED*SDR_SCALED)) / m_levelNbSamples) : 0.0; - emit levelChanged(rmsLevel, m_peakLevel / SDR_SCALEF, m_levelNbSamples); + qreal rmsLevel = m_levelSum > 0.0 ? sqrt((m_levelSum/(SDR_TX_SCALED*SDR_TX_SCALED)) / m_levelNbSamples) : 0.0; + emit levelChanged(rmsLevel, m_peakLevel / SDR_TX_SCALEF, m_levelNbSamples); m_peakLevel = 0.0f; m_levelSum = 0.0f; m_levelCalcCount = 0; diff --git a/plugins/samplesink/bladerfoutput/bladerfoutputthread.h b/plugins/samplesink/bladerfoutput/bladerfoutputthread.h index 7a973161b..4a93140e0 100644 --- a/plugins/samplesink/bladerfoutput/bladerfoutputthread.h +++ b/plugins/samplesink/bladerfoutput/bladerfoutputthread.h @@ -51,7 +51,7 @@ private: unsigned int m_log2Interp; int m_fcPos; - Interpolators m_interpolators; + Interpolators m_interpolators; void run(); void callback(qint16* buf, qint32 len); diff --git a/plugins/samplesink/filesink/filesinkthread.h b/plugins/samplesink/filesink/filesinkthread.h index e408d0b39..3c7b820f7 100644 --- a/plugins/samplesink/filesink/filesinkthread.h +++ b/plugins/samplesink/filesink/filesinkthread.h @@ -70,7 +70,7 @@ private: QElapsedTimer m_elapsedTimer; bool m_throttleToggle; - Interpolators m_interpolators; + Interpolators m_interpolators; int16_t *m_buf; void run(); diff --git a/plugins/samplesink/hackrfoutput/hackrfoutputthread.h b/plugins/samplesink/hackrfoutput/hackrfoutputthread.h index 5e51cff2d..f44139a0e 100644 --- a/plugins/samplesink/hackrfoutput/hackrfoutputthread.h +++ b/plugins/samplesink/hackrfoutput/hackrfoutputthread.h @@ -49,7 +49,7 @@ private: unsigned int m_log2Interp; - Interpolators m_interpolators; + Interpolators m_interpolators; void run(); void callback(qint8* buf, qint32 len); diff --git a/plugins/samplesink/limesdroutput/limesdroutputthread.h b/plugins/samplesink/limesdroutput/limesdroutputthread.h index 7acd125cc..e543d510c 100644 --- a/plugins/samplesink/limesdroutput/limesdroutputthread.h +++ b/plugins/samplesink/limesdroutput/limesdroutputthread.h @@ -56,7 +56,7 @@ private: unsigned int m_log2Interp; // soft decimation int m_fcPos; - Interpolators m_interpolators; + Interpolators m_interpolators; void run(); void callback(qint16* buf, qint32 len); diff --git a/plugins/samplesink/plutosdroutput/plutosdroutputthread.h b/plugins/samplesink/plutosdroutput/plutosdroutputthread.h index 7669fceca..782c6e389 100644 --- a/plugins/samplesink/plutosdroutput/plutosdroutputthread.h +++ b/plugins/samplesink/plutosdroutput/plutosdroutputthread.h @@ -54,7 +54,7 @@ private: unsigned int m_log2Interp; // soft interpolation - Interpolators m_interpolators; + Interpolators m_interpolators; void run(); void convert(qint16* buf, qint32 len); diff --git a/plugins/samplesource/airspy/airspythread.h b/plugins/samplesource/airspy/airspythread.h index a5d62feda..b21c894d3 100644 --- a/plugins/samplesource/airspy/airspythread.h +++ b/plugins/samplesource/airspy/airspythread.h @@ -55,10 +55,10 @@ private: int m_fcPos; static AirspyThread *m_this; -#ifdef SDR_SAMPLE_24BIT - Decimators m_decimators; +#ifdef SDR_RX_SAMPLE_24BIT + Decimators m_decimators; #else - Decimators m_decimators; + Decimators m_decimators; #endif void run(); diff --git a/plugins/samplesource/airspyhf/airspyhfthread.h b/plugins/samplesource/airspyhf/airspyhfthread.h index 9f22cb6f0..615bf8275 100644 --- a/plugins/samplesource/airspyhf/airspyhfthread.h +++ b/plugins/samplesource/airspyhf/airspyhfthread.h @@ -53,10 +53,10 @@ private: unsigned int m_log2Decim; static AirspyHFThread *m_this; -#ifdef SDR_SAMPLE_24BIT - Decimators m_decimators; +#ifdef SDR_RX_SAMPLE_24BIT + Decimators m_decimators; #else - Decimators m_decimators; + Decimators m_decimators; #endif void run(); diff --git a/plugins/samplesource/bladerfinput/bladerfinputthread.h b/plugins/samplesource/bladerfinput/bladerfinputthread.h index 60e21a2d7..8230c5c90 100644 --- a/plugins/samplesource/bladerfinput/bladerfinputthread.h +++ b/plugins/samplesource/bladerfinput/bladerfinputthread.h @@ -51,10 +51,10 @@ private: unsigned int m_log2Decim; int m_fcPos; -#ifdef SDR_SAMPLE_24BIT - Decimators m_decimators; +#ifdef SDR_RX_SAMPLE_24BIT + Decimators m_decimators; #else - Decimators m_decimators; + Decimators m_decimators; #endif void run(); diff --git a/plugins/samplesource/hackrfinput/hackrfinputthread.h b/plugins/samplesource/hackrfinput/hackrfinputthread.h index 0f07c77df..32df49077 100644 --- a/plugins/samplesource/hackrfinput/hackrfinputthread.h +++ b/plugins/samplesource/hackrfinput/hackrfinputthread.h @@ -54,10 +54,10 @@ private: unsigned int m_log2Decim; int m_fcPos; -#ifdef SDR_SAMPLE_24BIT - Decimators m_decimators; +#ifdef SDR_RX_SAMPLE_24BIT + Decimators m_decimators; #else - Decimators m_decimators; + Decimators m_decimators; #endif void run(); diff --git a/plugins/samplesource/limesdrinput/limesdrinputthread.h b/plugins/samplesource/limesdrinput/limesdrinputthread.h index d83919c11..096083ac8 100644 --- a/plugins/samplesource/limesdrinput/limesdrinputthread.h +++ b/plugins/samplesource/limesdrinput/limesdrinputthread.h @@ -55,10 +55,10 @@ private: unsigned int m_log2Decim; // soft decimation -#ifdef SDR_SAMPLE_24BIT - Decimators m_decimators; +#ifdef SDR_RX_SAMPLE_24BIT + Decimators m_decimators; #else - Decimators m_decimators; + Decimators m_decimators; #endif void run(); diff --git a/plugins/samplesource/plutosdrinput/plutosdrinputthread.h b/plugins/samplesource/plutosdrinput/plutosdrinputthread.h index 2e1e94fbe..e79630334 100644 --- a/plugins/samplesource/plutosdrinput/plutosdrinputthread.h +++ b/plugins/samplesource/plutosdrinput/plutosdrinputthread.h @@ -59,10 +59,10 @@ private: int m_fcPos; float m_phasor; -#ifdef SDR_SAMPLE_24BIT - Decimators m_decimators; +#ifdef SDR_RX_SAMPLE_24BIT + Decimators m_decimators; #else - Decimators m_decimators; + Decimators m_decimators; #endif void run(); diff --git a/plugins/samplesource/rtlsdr/rtlsdrthread.h b/plugins/samplesource/rtlsdr/rtlsdrthread.h index a3ef61c02..97f3ed56d 100644 --- a/plugins/samplesource/rtlsdr/rtlsdrthread.h +++ b/plugins/samplesource/rtlsdr/rtlsdrthread.h @@ -52,10 +52,10 @@ private: unsigned int m_log2Decim; int m_fcPos; -#ifdef SDR_SAMPLE_24BIT - DecimatorsU m_decimators; +#ifdef SDR_RX_SAMPLE_24BIT + DecimatorsU m_decimators; #else - DecimatorsU m_decimators; + DecimatorsU m_decimators; #endif void run(); diff --git a/plugins/samplesource/sdrplay/sdrplaythread.h b/plugins/samplesource/sdrplay/sdrplaythread.h index d11a11145..807db699c 100644 --- a/plugins/samplesource/sdrplay/sdrplaythread.h +++ b/plugins/samplesource/sdrplay/sdrplaythread.h @@ -52,10 +52,10 @@ private: unsigned int m_log2Decim; int m_fcPos; -#ifdef SDR_SAMPLE_24BIT - Decimators m_decimators; +#ifdef SDR_RX_SAMPLE_24BIT + Decimators m_decimators; #else - Decimators m_decimators; + Decimators m_decimators; #endif void run(); diff --git a/plugins/samplesource/testsource/testsourcethread.h b/plugins/samplesource/testsource/testsourcethread.h index b1759c90e..d8a8f219c 100644 --- a/plugins/samplesource/testsource/testsourcethread.h +++ b/plugins/samplesource/testsource/testsourcethread.h @@ -85,14 +85,14 @@ private: bool m_throttleToggle; QMutex m_mutex; -#ifdef SDR_SAMPLE_24BIT - Decimators m_decimators_8; - Decimators m_decimators_12; - Decimators m_decimators_16; +#ifdef SDR_RX_SAMPLE_24BIT + Decimators m_decimators_8; + Decimators m_decimators_12; + Decimators m_decimators_16; #else - Decimators m_decimators_8; - Decimators m_decimators_12; - Decimators m_decimators_16; + Decimators m_decimators_8; + Decimators m_decimators_12; + Decimators m_decimators_16; #endif void run(); diff --git a/sdrbase/dsp/decimators.h b/sdrbase/dsp/decimators.h index 589d08b82..9abd7350c 100644 --- a/sdrbase/dsp/decimators.h +++ b/sdrbase/dsp/decimators.h @@ -18,7 +18,7 @@ #define INCLUDE_GPL_DSP_DECIMATORS_H_ #include "dsp/dsptypes.h" -#ifdef SDR_SAMPLE_24BIT +#ifdef SDR_RX_SAMPLE_24BIT #include "dsp/inthalfbandfilterdb.h" #else #ifdef USE_SSE4_1 @@ -240,7 +240,7 @@ public: void decimate64_cen(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len); private: -#ifdef SDR_SAMPLE_24BIT +#ifdef SDR_RX_SAMPLE_24BIT IntHalfbandFilterDB m_decimator2; // 1st stages IntHalfbandFilterDB m_decimator4; // 2nd stages IntHalfbandFilterDB m_decimator8; // 3rd stages diff --git a/sdrbase/dsp/decimatorsu.h b/sdrbase/dsp/decimatorsu.h index 2f028b2f5..059e7dcf3 100644 --- a/sdrbase/dsp/decimatorsu.h +++ b/sdrbase/dsp/decimatorsu.h @@ -24,7 +24,7 @@ #define INCLUDE_GPL_DSP_DECIMATORSU_H_ #include "dsp/dsptypes.h" -#ifdef SDR_SAMPLE_24BIT +#ifdef SDR_RX_SAMPLE_24BIT #include "dsp/inthalfbandfilterdb.h" #else #ifdef USE_SSE4_1 @@ -206,7 +206,7 @@ public: void decimate64_cen(SampleVector::iterator* it, const T* buf, qint32 len); private: -#ifdef SDR_SAMPLE_24BIT +#ifdef SDR_RX_SAMPLE_24BIT IntHalfbandFilterDB m_decimator2; // 1st stages IntHalfbandFilterDB m_decimator4; // 2nd stages IntHalfbandFilterDB m_decimator8; // 3rd stages diff --git a/sdrbase/dsp/downchannelizer.cpp b/sdrbase/dsp/downchannelizer.cpp index 8b73f34de..cfbec834d 100644 --- a/sdrbase/dsp/downchannelizer.cpp +++ b/sdrbase/dsp/downchannelizer.cpp @@ -192,7 +192,7 @@ void DownChannelizer::applyConfiguration() } } -#ifdef SDR_SAMPLE_24BIT +#ifdef SDR_RX_SAMPLE_24BIT DownChannelizer::FilterStage::FilterStage(Mode mode) : m_filter(new IntHalfbandFilterDB), m_workFunction(0), diff --git a/sdrbase/dsp/downchannelizer.h b/sdrbase/dsp/downchannelizer.h index da9ce6d80..96d031354 100644 --- a/sdrbase/dsp/downchannelizer.h +++ b/sdrbase/dsp/downchannelizer.h @@ -23,7 +23,7 @@ #include #include "util/export.h" #include "util/message.h" -#ifdef SDR_SAMPLE_24BIT +#ifdef SDR_RX_SAMPLE_24BIT #include "dsp/inthalfbandfilterdb.h" #else #ifdef USE_SSE4_1 @@ -82,7 +82,7 @@ protected: ModeUpperHalf }; -#ifdef SDR_SAMPLE_24BIT +#ifdef SDR_RX_SAMPLE_24BIT typedef bool (IntHalfbandFilterDB::*WorkFunction)(Sample* s); IntHalfbandFilterDB* m_filter; #else diff --git a/sdrbase/dsp/dsptypes.h b/sdrbase/dsp/dsptypes.h index 7300c9dae..e3913a785 100644 --- a/sdrbase/dsp/dsptypes.h +++ b/sdrbase/dsp/dsptypes.h @@ -22,18 +22,22 @@ #include #include -#ifdef SDR_SAMPLE_24BIT -#define SDR_SAMP_SZ 24 // internal fixed arithmetic sample size -#define SDR_SCALEF 8388608.0f -#define SDR_SCALED 8388608.0 +#ifdef SDR_RX_SAMPLE_24BIT +#define SDR_RX_SAMP_SZ 24 // internal fixed arithmetic sample size +#define SDR_RX_SCALEF 8388608.0f +#define SDR_RX_SCALED 8388608.0 typedef qint32 FixReal; #else -#define SDR_SAMP_SZ 16 // internal fixed arithmetic sample size -#define SDR_SCALEF 32768.0f -#define SDR_SCALED 32768.0 +#define SDR_RX_SAMP_SZ 16 // internal fixed arithmetic sample size +#define SDR_RX_SCALEF 32768.0f +#define SDR_RX_SCALED 32768.0 typedef qint16 FixReal; #endif +#define SDR_TX_SAMP_SZ 16 +#define SDR_TX_SCALEF 32768.0f +#define SDR_TX_SCALED 32768.0 + typedef float Real; typedef std::complex Complex; diff --git a/sdrgui/dsp/scopevis.cpp b/sdrgui/dsp/scopevis.cpp index 02fd0066c..1ee974efe 100644 --- a/sdrgui/dsp/scopevis.cpp +++ b/sdrgui/dsp/scopevis.cpp @@ -111,7 +111,7 @@ void ScopeVis::feed(const SampleVector::const_iterator& cbegin, const SampleVect for(int i = 0; i < count; ++i) { - *it++ = Complex(begin->real() / SDR_SCALEF, begin->imag() / SDR_SCALEF); + *it++ = Complex(begin->real() / SDR_RX_SCALEF, begin->imag() / SDR_RX_SCALEF); ++begin; } @@ -234,7 +234,7 @@ void ScopeVis::feed(const SampleVector::const_iterator& cbegin, const SampleVect for(int i = 0; i < count; ++i) { - *it++ = Complex(begin->real() / SDR_SCALEF, begin->imag() / SDR_SCALEF); + *it++ = Complex(begin->real() / SDR_RX_SCALEF, begin->imag() / SDR_RX_SCALEF); ++begin; } @@ -341,7 +341,7 @@ void ScopeVis::setSampleRate(int sampleRate) bool ScopeVis::triggerCondition(SampleVector::const_iterator& it) { - Complex c(it->real()/SDR_SCALEF, it->imag()/SDR_SCALEF); + Complex c(it->real()/SDR_RX_SCALEF, it->imag()/SDR_RX_SCALEF); m_traceback.push_back(c); // store into trace memory FIFO if (m_tracebackCount < m_traceback.size()) diff --git a/sdrgui/dsp/scopevismulti.h b/sdrgui/dsp/scopevismulti.h index c05656a8c..3ae2a5e7f 100644 --- a/sdrgui/dsp/scopevismulti.h +++ b/sdrgui/dsp/scopevismulti.h @@ -556,7 +556,7 @@ private: switch (m_projectionType) { case ProjectionImag: - v = s.m_imag / SDR_SCALEF; + v = s.m_imag / SDR_RX_SCALEF; break; case ProjectionMagLin: { @@ -590,7 +590,7 @@ private: break; case ProjectionReal: default: - v = s.m_real / SDR_SCALEF; + v = s.m_real / SDR_RX_SCALEF; break; } diff --git a/sdrgui/dsp/scopevisng.h b/sdrgui/dsp/scopevisng.h index 3687f7d20..d31b8ce9a 100644 --- a/sdrgui/dsp/scopevisng.h +++ b/sdrgui/dsp/scopevisng.h @@ -545,7 +545,7 @@ private: switch (m_projectionType) { case ProjectionImag: - v = s.m_imag / SDR_SCALEF; + v = s.m_imag / SDR_RX_SCALEF; break; case ProjectionMagLin: { @@ -579,7 +579,7 @@ private: break; case ProjectionReal: default: - v = s.m_real / SDR_SCALEF; + v = s.m_real / SDR_RX_SCALEF; break; } diff --git a/sdrgui/dsp/spectrumvis.cpp b/sdrgui/dsp/spectrumvis.cpp index 779436130..ff1f569a1 100644 --- a/sdrgui/dsp/spectrumvis.cpp +++ b/sdrgui/dsp/spectrumvis.cpp @@ -85,7 +85,7 @@ void SpectrumVis::feed(const SampleVector::const_iterator& cbegin, const SampleV for (std::size_t i = 0; i < samplesNeeded; ++i, ++begin) { - *it++ = Complex(begin->real() / SDR_SCALEF, begin->imag() / SDR_SCALEF); + *it++ = Complex(begin->real() / SDR_RX_SCALEF, begin->imag() / SDR_RX_SCALEF); } // apply fft window (and copy from m_fftBuffer to m_fftIn) @@ -144,7 +144,7 @@ void SpectrumVis::feed(const SampleVector::const_iterator& cbegin, const SampleV // not enough samples for FFT - just fill in new data and return for(std::vector::iterator it = m_fftBuffer.begin() + m_fftBufferFill; begin < end; ++begin) { - *it++ = Complex(begin->real() / SDR_SCALEF, begin->imag() / SDR_SCALEF); + *it++ = Complex(begin->real() / SDR_RX_SCALEF, begin->imag() / SDR_RX_SCALEF); } m_fftBufferFill += todo;