1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-26 17:58:43 -05:00

ATV Demod: renaming of some attributes

This commit is contained in:
f4exb 2017-10-01 09:06:55 +02:00
parent dcfdffaf49
commit 35c5d623fd
4 changed files with 203 additions and 203 deletions

View File

@ -70,7 +70,7 @@ ATVDemod::ATVDemod(BasebandSampleSink* objScopeSink) :
m_objMagSqAverage.resize(32, 1.0); m_objMagSqAverage.resize(32, 1.0);
m_DSBFilter = new fftfilt((2.0f * m_objRFConfig.m_fltRFBandwidth) / 1000000, 2 * m_ssbFftLen); // arbitrary 1 MS/s sample rate m_DSBFilter = new fftfilt((2.0f * m_rfConfig.m_fltRFBandwidth) / 1000000, 2 * m_ssbFftLen); // arbitrary 1 MS/s sample rate
m_DSBFilterBuffer = new Complex[m_ssbFftLen]; m_DSBFilterBuffer = new Complex[m_ssbFftLen];
memset(m_DSBFilterBuffer, 0, sizeof(Complex)*(m_ssbFftLen)); memset(m_DSBFilterBuffer, 0, sizeof(Complex)*(m_ssbFftLen));
@ -188,12 +188,12 @@ void ATVDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
#endif #endif
Complex c(fltI, fltQ); Complex c(fltI, fltQ);
if (m_objRFRunning.m_intFrequencyOffset != 0) if (m_rfRunning.m_intFrequencyOffset != 0)
{ {
c *= m_nco.nextIQ(); c *= m_nco.nextIQ();
} }
if (m_objRFRunning.m_blndecimatorEnable) if (m_rfRunning.m_blndecimatorEnable)
{ {
if (m_interpolator.decimate(&m_interpolatorDistanceRemain, c, &ci)) if (m_interpolator.decimate(&m_interpolatorDistanceRemain, c, &ci))
{ {
@ -207,7 +207,7 @@ void ATVDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
} }
} }
if ((m_objRunning.m_intVideoTabIndex == 1) && (m_objScopeSink != 0)) // do only if scope tab is selected and scope is available if ((m_running.m_intVideoTabIndex == 1) && (m_objScopeSink != 0)) // do only if scope tab is selected and scope is available
{ {
m_objScopeSink->feed(m_objScopeSampleBuffer.begin(), m_objScopeSampleBuffer.end(), false); // m_ssb = positive only m_objScopeSink->feed(m_objScopeSampleBuffer.begin(), m_objScopeSampleBuffer.end(), false); // m_ssb = positive only
m_objScopeSampleBuffer.clear(); m_objScopeSampleBuffer.clear();
@ -223,7 +223,7 @@ void ATVDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
void ATVDemod::demod(Complex& c) void ATVDemod::demod(Complex& c)
{ {
float fltDivSynchroBlack = 1.0f - m_objRunning.m_fltVoltLevelSynchroBlack; float fltDivSynchroBlack = 1.0f - m_running.m_fltVoltLevelSynchroBlack;
float fltNormI; float fltNormI;
float fltNormQ; float fltNormQ;
float fltNorm; float fltNorm;
@ -232,12 +232,12 @@ void ATVDemod::demod(Complex& c)
//********** FFT filtering ********** //********** FFT filtering **********
if (m_objRFRunning.m_blnFFTFiltering) if (m_rfRunning.m_blnFFTFiltering)
{ {
int n_out; int n_out;
fftfilt::cmplx *filtered; fftfilt::cmplx *filtered;
n_out = m_DSBFilter->runAsym(c, &filtered, m_objRFRunning.m_enmModulation != ATV_LSB); // all usb except explicitely lsb n_out = m_DSBFilter->runAsym(c, &filtered, m_rfRunning.m_enmModulation != ATV_LSB); // all usb except explicitely lsb
if (n_out > 0) if (n_out > 0)
{ {
@ -250,11 +250,11 @@ void ATVDemod::demod(Complex& c)
//********** demodulation ********** //********** demodulation **********
const float& fltI = m_objRFRunning.m_blnFFTFiltering ? m_DSBFilterBuffer[m_DSBFilterBufferIndex-1].real() : c.real(); const float& fltI = m_rfRunning.m_blnFFTFiltering ? m_DSBFilterBuffer[m_DSBFilterBufferIndex-1].real() : c.real();
const float& fltQ = m_objRFRunning.m_blnFFTFiltering ? m_DSBFilterBuffer[m_DSBFilterBufferIndex-1].imag() : c.imag(); const float& fltQ = m_rfRunning.m_blnFFTFiltering ? m_DSBFilterBuffer[m_DSBFilterBufferIndex-1].imag() : c.imag();
double magSq; double magSq;
if ((m_objRFRunning.m_enmModulation == ATV_FM1) || (m_objRFRunning.m_enmModulation == ATV_FM2)) if ((m_rfRunning.m_enmModulation == ATV_FM1) || (m_rfRunning.m_enmModulation == ATV_FM2))
{ {
//Amplitude FM //Amplitude FM
magSq = fltI*fltI + fltQ*fltQ; magSq = fltI*fltI + fltQ*fltQ;
@ -266,7 +266,7 @@ void ATVDemod::demod(Complex& c)
//-2 > 2 : 0 -> 1 volt //-2 > 2 : 0 -> 1 volt
//0->0.3 synchro 0.3->1 image //0->0.3 synchro 0.3->1 image
if (m_objRFRunning.m_enmModulation == ATV_FM1) if (m_rfRunning.m_enmModulation == ATV_FM1)
{ {
//YDiff Cd //YDiff Cd
fltVal = m_fltBufferI[0]*(fltNormQ - m_fltBufferQ[1]); fltVal = m_fltBufferI[0]*(fltNormQ - m_fltBufferQ[1]);
@ -304,12 +304,12 @@ void ATVDemod::demod(Complex& c)
m_fltBufferI[0]=fltNormI; m_fltBufferI[0]=fltNormI;
m_fltBufferQ[0]=fltNormQ; m_fltBufferQ[0]=fltNormQ;
if (m_objRFRunning.m_fmDeviation != 1.0f) if (m_rfRunning.m_fmDeviation != 1.0f)
{ {
fltVal = ((fltVal - 0.5f) / m_objRFRunning.m_fmDeviation) + 0.5f; fltVal = ((fltVal - 0.5f) / m_rfRunning.m_fmDeviation) + 0.5f;
} }
} }
else if (m_objRFRunning.m_enmModulation == ATV_AM) else if (m_rfRunning.m_enmModulation == ATV_AM)
{ {
//Amplitude AM //Amplitude AM
magSq = fltI*fltI + fltQ*fltQ; magSq = fltI*fltI + fltQ*fltQ;
@ -334,7 +334,7 @@ void ATVDemod::demod(Complex& c)
fltVal -= m_fltAmpMin; fltVal -= m_fltAmpMin;
fltVal /=m_fltAmpDelta; fltVal /=m_fltAmpDelta;
} }
else if ((m_objRFRunning.m_enmModulation == ATV_USB) || (m_objRFRunning.m_enmModulation == ATV_LSB)) else if ((m_rfRunning.m_enmModulation == ATV_USB) || (m_rfRunning.m_enmModulation == ATV_LSB))
{ {
magSq = fltI*fltI + fltQ*fltQ; magSq = fltI*fltI + fltQ*fltQ;
m_objMagSqAverage.feed(magSq); m_objMagSqAverage.feed(magSq);
@ -349,7 +349,7 @@ void ATVDemod::demod(Complex& c)
float mixI = fltI * bfoValues[0] - fltQ * bfoValues[1]; float mixI = fltI * bfoValues[0] - fltQ * bfoValues[1];
float mixQ = fltI * bfoValues[1] + fltQ * bfoValues[0]; float mixQ = fltI * bfoValues[1] + fltQ * bfoValues[0];
if (m_objRFRunning.m_enmModulation == ATV_USB) { if (m_rfRunning.m_enmModulation == ATV_USB) {
fltVal = (mixI + mixQ); fltVal = (mixI + mixQ);
} else { } else {
fltVal = (mixI - mixQ); fltVal = (mixI - mixQ);
@ -371,7 +371,7 @@ void ATVDemod::demod(Complex& c)
fltVal -= m_fltAmpMin; fltVal -= m_fltAmpMin;
fltVal /=m_fltAmpDelta; fltVal /=m_fltAmpDelta;
} }
else if (m_objRFRunning.m_enmModulation == ATV_FM3) else if (m_rfRunning.m_enmModulation == ATV_FM3)
{ {
float rawDeviation; float rawDeviation;
fltVal = m_objPhaseDiscri.phaseDiscriminatorDelta(c, magSq, rawDeviation) + 0.5f; fltVal = m_objPhaseDiscri.phaseDiscriminatorDelta(c, magSq, rawDeviation) + 0.5f;
@ -387,10 +387,10 @@ void ATVDemod::demod(Complex& c)
fltVal = 0.0f; fltVal = 0.0f;
} }
fltVal = m_objRunning.m_blnInvertVideo ? 1.0f - fltVal : fltVal; fltVal = m_running.m_blnInvertVideo ? 1.0f - fltVal : fltVal;
fltVal = (fltVal < -1.0f) ? -1.0f : (fltVal > 1.0f) ? 1.0f : fltVal; fltVal = (fltVal < -1.0f) ? -1.0f : (fltVal > 1.0f) ? 1.0f : fltVal;
if ((m_objRunning.m_intVideoTabIndex == 1) && (m_objScopeSink != 0)) { // feed scope buffer only if scope is present and visible if ((m_running.m_intVideoTabIndex == 1) && (m_objScopeSink != 0)) { // feed scope buffer only if scope is present and visible
m_objScopeSampleBuffer.push_back(Sample(fltVal*32767.0f, 0.0f)); m_objScopeSampleBuffer.push_back(Sample(fltVal*32767.0f, 0.0f));
} }
@ -398,7 +398,7 @@ void ATVDemod::demod(Complex& c)
//********** gray level ********** //********** gray level **********
//-0.3 -> 0.7 //-0.3 -> 0.7
intVal = (int) 255.0*(fltVal - m_objRunning.m_fltVoltLevelSynchroBlack) / fltDivSynchroBlack; intVal = (int) 255.0*(fltVal - m_running.m_fltVoltLevelSynchroBlack) / fltDivSynchroBlack;
//0 -> 255 //0 -> 255
if(intVal<0) if(intVal<0)
@ -412,7 +412,7 @@ void ATVDemod::demod(Complex& c)
//********** process video sample ********** //********** process video sample **********
if (m_objRunning.m_enmATVStandard == ATVStdHSkip) if (m_running.m_enmATVStandard == ATVStdHSkip)
{ {
processHSkip(fltVal, intVal); processHSkip(fltVal, intVal);
} }
@ -438,12 +438,12 @@ bool ATVDemod::handleMessage(const Message& cmd)
if (DownChannelizer::MsgChannelizerNotification::match(cmd)) if (DownChannelizer::MsgChannelizerNotification::match(cmd))
{ {
DownChannelizer::MsgChannelizerNotification& objNotif = (DownChannelizer::MsgChannelizerNotification&) cmd; DownChannelizer::MsgChannelizerNotification& objNotif = (DownChannelizer::MsgChannelizerNotification&) cmd;
m_objConfig.m_intSampleRate = objNotif.getSampleRate(); m_config.m_intSampleRate = objNotif.getSampleRate();
m_objRFConfig.m_intFrequencyOffset = objNotif.getFrequencyOffset(); m_rfConfig.m_intFrequencyOffset = objNotif.getFrequencyOffset();
qDebug() << "ATVDemod::handleMessage: MsgChannelizerNotification:" qDebug() << "ATVDemod::handleMessage: MsgChannelizerNotification:"
<< " m_intSampleRate: " << m_objConfig.m_intSampleRate << " m_intSampleRate: " << m_config.m_intSampleRate
<< " m_intFrequencyOffset: " << m_objRFConfig.m_intFrequencyOffset; << " m_intFrequencyOffset: " << m_rfConfig.m_intFrequencyOffset;
applySettings(); applySettings();
@ -453,17 +453,17 @@ bool ATVDemod::handleMessage(const Message& cmd)
{ {
MsgConfigureATVDemod& objCfg = (MsgConfigureATVDemod&) cmd; MsgConfigureATVDemod& objCfg = (MsgConfigureATVDemod&) cmd;
m_objConfig = objCfg.m_objMsgConfig; m_config = objCfg.m_objMsgConfig;
qDebug() << "ATVDemod::handleMessage: MsgConfigureATVDemod:" qDebug() << "ATVDemod::handleMessage: MsgConfigureATVDemod:"
<< " m_fltVoltLevelSynchroBlack:" << m_objConfig.m_fltVoltLevelSynchroBlack << " m_fltVoltLevelSynchroBlack:" << m_config.m_fltVoltLevelSynchroBlack
<< " m_fltVoltLevelSynchroTop:" << m_objConfig.m_fltVoltLevelSynchroTop << " m_fltVoltLevelSynchroTop:" << m_config.m_fltVoltLevelSynchroTop
<< " m_fltFramePerS:" << m_objConfig.m_fltFramePerS << " m_fltFramePerS:" << m_config.m_fltFramePerS
<< " m_fltLineDurationUs:" << m_objConfig.m_fltLineDuration << " m_fltLineDurationUs:" << m_config.m_fltLineDuration
<< " m_fltRatioOfRowsToDisplay:" << m_objConfig.m_fltRatioOfRowsToDisplay << " m_fltRatioOfRowsToDisplay:" << m_config.m_fltRatioOfRowsToDisplay
<< " m_fltTopDurationUs:" << m_objConfig.m_fltTopDuration << " m_fltTopDurationUs:" << m_config.m_fltTopDuration
<< " m_blnHSync:" << m_objConfig.m_blnHSync << " m_blnHSync:" << m_config.m_blnHSync
<< " m_blnVSync:" << m_objConfig.m_blnVSync; << " m_blnVSync:" << m_config.m_blnVSync;
applySettings(); applySettings();
@ -473,16 +473,16 @@ bool ATVDemod::handleMessage(const Message& cmd)
{ {
MsgConfigureRFATVDemod& objCfg = (MsgConfigureRFATVDemod&) cmd; MsgConfigureRFATVDemod& objCfg = (MsgConfigureRFATVDemod&) cmd;
m_objRFConfig = objCfg.m_objMsgConfig; m_rfConfig = objCfg.m_objMsgConfig;
qDebug() << "ATVDemod::handleMessage: MsgConfigureRFATVDemod:" qDebug() << "ATVDemod::handleMessage: MsgConfigureRFATVDemod:"
<< " m_enmModulation:" << m_objRFConfig.m_enmModulation << " m_enmModulation:" << m_rfConfig.m_enmModulation
<< " m_fltRFBandwidth:" << m_objRFConfig.m_fltRFBandwidth << " m_fltRFBandwidth:" << m_rfConfig.m_fltRFBandwidth
<< " m_fltRFOppBandwidth:" << m_objRFConfig.m_fltRFOppBandwidth << " m_fltRFOppBandwidth:" << m_rfConfig.m_fltRFOppBandwidth
<< " m_blnFFTFiltering:" << m_objRFConfig.m_blnFFTFiltering << " m_blnFFTFiltering:" << m_rfConfig.m_blnFFTFiltering
<< " m_blnDecimatorEnable:" << m_objRFConfig.m_blndecimatorEnable << " m_blnDecimatorEnable:" << m_rfConfig.m_blndecimatorEnable
<< " m_fltBFOFrequency:" << m_objRFConfig.m_fltBFOFrequency << " m_fltBFOFrequency:" << m_rfConfig.m_fltBFOFrequency
<< " m_fmDeviation:" << m_objRFConfig.m_fmDeviation; << " m_fmDeviation:" << m_rfConfig.m_fmDeviation;
applySettings(); applySettings();
@ -504,30 +504,30 @@ bool ATVDemod::handleMessage(const Message& cmd)
void ATVDemod::applySettings() void ATVDemod::applySettings()
{ {
if (m_objConfig.m_intSampleRate == 0) if (m_config.m_intSampleRate == 0)
{ {
return; return;
} }
bool forwardSampleRateChange = false; bool forwardSampleRateChange = false;
if((m_objRFConfig.m_intFrequencyOffset != m_objRFRunning.m_intFrequencyOffset) if((m_rfConfig.m_intFrequencyOffset != m_rfRunning.m_intFrequencyOffset)
|| (m_objRFConfig.m_enmModulation != m_objRFRunning.m_enmModulation) || (m_rfConfig.m_enmModulation != m_rfRunning.m_enmModulation)
|| (m_objConfig.m_intSampleRate != m_objRunning.m_intSampleRate)) || (m_config.m_intSampleRate != m_running.m_intSampleRate))
{ {
m_nco.setFreq(-m_objRFConfig.m_intFrequencyOffset, m_objConfig.m_intSampleRate); m_nco.setFreq(-m_rfConfig.m_intFrequencyOffset, m_config.m_intSampleRate);
} }
if ((m_objConfig.m_intSampleRate != m_objRunning.m_intSampleRate) if ((m_config.m_intSampleRate != m_running.m_intSampleRate)
|| (m_objRFConfig.m_fltRFBandwidth != m_objRFRunning.m_fltRFBandwidth) || (m_rfConfig.m_fltRFBandwidth != m_rfRunning.m_fltRFBandwidth)
|| (m_objConfig.m_fltFramePerS != m_objRunning.m_fltFramePerS) || (m_config.m_fltFramePerS != m_running.m_fltFramePerS)
|| (m_objConfig.m_intNumberOfLines != m_objRunning.m_intNumberOfLines)) || (m_config.m_intNumberOfLines != m_running.m_intNumberOfLines))
{ {
m_objSettingsMutex.lock(); m_objSettingsMutex.lock();
int linesPerSecond = m_objConfig.m_intNumberOfLines * m_objConfig.m_fltFramePerS; int linesPerSecond = m_config.m_intNumberOfLines * m_config.m_fltFramePerS;
int maxPoints = m_objConfig.m_intSampleRate / linesPerSecond; int maxPoints = m_config.m_intSampleRate / linesPerSecond;
int i = maxPoints; int i = maxPoints;
for (; i > 0; i--) for (; i > 0; i--)
@ -537,53 +537,53 @@ void ATVDemod::applySettings()
} }
int nbPointsPerRateUnit = i == 0 ? maxPoints : i; int nbPointsPerRateUnit = i == 0 ? maxPoints : i;
m_objConfigPrivate.m_intTVSampleRate = nbPointsPerRateUnit * linesPerSecond; m_configPrivate.m_intTVSampleRate = nbPointsPerRateUnit * linesPerSecond;
if (m_objConfigPrivate.m_intTVSampleRate > 0) if (m_configPrivate.m_intTVSampleRate > 0)
{ {
m_interpolatorDistance = (Real) m_objConfigPrivate.m_intTVSampleRate / (Real) m_objConfig.m_intSampleRate; m_interpolatorDistance = (Real) m_configPrivate.m_intTVSampleRate / (Real) m_config.m_intSampleRate;
} }
else else
{ {
m_objConfigPrivate.m_intTVSampleRate = m_objConfig.m_intSampleRate; m_configPrivate.m_intTVSampleRate = m_config.m_intSampleRate;
m_interpolatorDistance = 1.0f; m_interpolatorDistance = 1.0f;
} }
m_interpolatorDistanceRemain = 0; m_interpolatorDistanceRemain = 0;
m_interpolator.create(24, m_interpolator.create(24,
m_objConfigPrivate.m_intTVSampleRate, m_configPrivate.m_intTVSampleRate,
m_objRFConfig.m_fltRFBandwidth / getRFBandwidthDivisor(m_objRFConfig.m_enmModulation), m_rfConfig.m_fltRFBandwidth / getRFBandwidthDivisor(m_rfConfig.m_enmModulation),
3.0); 3.0);
m_objSettingsMutex.unlock(); m_objSettingsMutex.unlock();
} }
if((m_objConfig.m_fltFramePerS != m_objRunning.m_fltFramePerS) if((m_config.m_fltFramePerS != m_running.m_fltFramePerS)
|| (m_objConfig.m_fltLineDuration != m_objRunning.m_fltLineDuration) || (m_config.m_fltLineDuration != m_running.m_fltLineDuration)
|| (m_objConfig.m_intSampleRate != m_objRunning.m_intSampleRate) || (m_config.m_intSampleRate != m_running.m_intSampleRate)
|| (m_objConfig.m_fltTopDuration != m_objRunning.m_fltTopDuration) || (m_config.m_fltTopDuration != m_running.m_fltTopDuration)
|| (m_objConfig.m_fltRatioOfRowsToDisplay != m_objRunning.m_fltRatioOfRowsToDisplay) || (m_config.m_fltRatioOfRowsToDisplay != m_running.m_fltRatioOfRowsToDisplay)
|| (m_objConfig.m_enmATVStandard != m_objRunning.m_enmATVStandard) || (m_config.m_enmATVStandard != m_running.m_enmATVStandard)
|| (m_objConfig.m_intNumberOfLines != m_objRunning.m_intNumberOfLines)) || (m_config.m_intNumberOfLines != m_running.m_intNumberOfLines))
{ {
m_objSettingsMutex.lock(); m_objSettingsMutex.lock();
m_intNumberOfLines = m_objConfig.m_intNumberOfLines; m_intNumberOfLines = m_config.m_intNumberOfLines;
applyStandard(); applyStandard();
m_objConfigPrivate.m_intNumberSamplePerLine = (int) (m_objConfig.m_fltLineDuration * m_objConfig.m_intSampleRate); m_configPrivate.m_intNumberSamplePerLine = (int) (m_config.m_fltLineDuration * m_config.m_intSampleRate);
m_intNumberSamplePerTop = (int) (m_objConfig.m_fltTopDuration * m_objConfig.m_intSampleRate); m_intNumberSamplePerTop = (int) (m_config.m_fltTopDuration * m_config.m_intSampleRate);
m_objRegisteredATVScreen->setRenderImmediate(!(m_objConfig.m_fltFramePerS > 25.0f)); m_objRegisteredATVScreen->setRenderImmediate(!(m_config.m_fltFramePerS > 25.0f));
m_objRegisteredATVScreen->resizeATVScreen( m_objRegisteredATVScreen->resizeATVScreen(
m_objConfigPrivate.m_intNumberSamplePerLine - m_intNumberSamplePerLineSignals, m_configPrivate.m_intNumberSamplePerLine - m_intNumberSamplePerLineSignals,
m_intNumberOfLines - m_intNumberOfBlackLines); m_intNumberOfLines - m_intNumberOfBlackLines);
qDebug() << "ATVDemod::applySettings:" qDebug() << "ATVDemod::applySettings:"
<< " m_fltLineDuration: " << m_objConfig.m_fltLineDuration << " m_fltLineDuration: " << m_config.m_fltLineDuration
<< " m_fltFramePerS: " << m_objConfig.m_fltFramePerS << " m_fltFramePerS: " << m_config.m_fltFramePerS
<< " m_intNumberOfLines: " << m_intNumberOfLines << " m_intNumberOfLines: " << m_intNumberOfLines
<< " m_intNumberSamplePerLine: " << m_objConfigPrivate.m_intNumberSamplePerLine << " m_intNumberSamplePerLine: " << m_configPrivate.m_intNumberSamplePerLine
<< " m_intNumberOfBlackLines: " << m_intNumberOfBlackLines; << " m_intNumberOfBlackLines: " << m_intNumberOfBlackLines;
m_intImageIndex = 0; m_intImageIndex = 0;
@ -593,56 +593,56 @@ void ATVDemod::applySettings()
m_objSettingsMutex.unlock(); m_objSettingsMutex.unlock();
} }
if ((m_objConfigPrivate.m_intTVSampleRate != m_objRunningPrivate.m_intTVSampleRate) if ((m_configPrivate.m_intTVSampleRate != m_runningPrivate.m_intTVSampleRate)
|| (m_objConfigPrivate.m_intNumberSamplePerLine != m_objRunningPrivate.m_intNumberSamplePerLine) || (m_configPrivate.m_intNumberSamplePerLine != m_runningPrivate.m_intNumberSamplePerLine)
|| (m_objConfig.m_intSampleRate != m_objRunning.m_intSampleRate) || (m_config.m_intSampleRate != m_running.m_intSampleRate)
|| (m_objRFConfig.m_blndecimatorEnable != m_objRFRunning.m_blndecimatorEnable)) || (m_rfConfig.m_blndecimatorEnable != m_rfRunning.m_blndecimatorEnable))
{ {
forwardSampleRateChange = true; forwardSampleRateChange = true;
} }
if ((m_objConfigPrivate.m_intTVSampleRate != m_objRunningPrivate.m_intTVSampleRate) if ((m_configPrivate.m_intTVSampleRate != m_runningPrivate.m_intTVSampleRate)
|| (m_objRFConfig.m_fltRFBandwidth != m_objRFRunning.m_fltRFBandwidth) || (m_rfConfig.m_fltRFBandwidth != m_rfRunning.m_fltRFBandwidth)
|| (m_objRFConfig.m_fltRFOppBandwidth != m_objRFRunning.m_fltRFOppBandwidth)) || (m_rfConfig.m_fltRFOppBandwidth != m_rfRunning.m_fltRFOppBandwidth))
{ {
m_objSettingsMutex.lock(); m_objSettingsMutex.lock();
m_DSBFilter->create_asym_filter(m_objRFConfig.m_fltRFOppBandwidth / m_objConfigPrivate.m_intTVSampleRate, m_DSBFilter->create_asym_filter(m_rfConfig.m_fltRFOppBandwidth / m_configPrivate.m_intTVSampleRate,
m_objRFConfig.m_fltRFBandwidth / m_objConfigPrivate.m_intTVSampleRate); m_rfConfig.m_fltRFBandwidth / m_configPrivate.m_intTVSampleRate);
memset(m_DSBFilterBuffer, 0, sizeof(Complex)*(m_ssbFftLen)); memset(m_DSBFilterBuffer, 0, sizeof(Complex)*(m_ssbFftLen));
m_DSBFilterBufferIndex = 0; m_DSBFilterBufferIndex = 0;
m_objSettingsMutex.unlock(); m_objSettingsMutex.unlock();
} }
if ((m_objConfigPrivate.m_intTVSampleRate != m_objRunningPrivate.m_intTVSampleRate) if ((m_configPrivate.m_intTVSampleRate != m_runningPrivate.m_intTVSampleRate)
|| (m_objRFConfig.m_fltBFOFrequency != m_objRFRunning.m_fltBFOFrequency)) || (m_rfConfig.m_fltBFOFrequency != m_rfRunning.m_fltBFOFrequency))
{ {
m_bfoPLL.configure(m_objRFConfig.m_fltBFOFrequency / m_objConfigPrivate.m_intTVSampleRate, m_bfoPLL.configure(m_rfConfig.m_fltBFOFrequency / m_configPrivate.m_intTVSampleRate,
100.0 / m_objConfigPrivate.m_intTVSampleRate, 100.0 / m_configPrivate.m_intTVSampleRate,
0.01); 0.01);
m_bfoFilter.setFrequencies(m_objRFConfig.m_fltBFOFrequency, m_objConfigPrivate.m_intTVSampleRate); m_bfoFilter.setFrequencies(m_rfConfig.m_fltBFOFrequency, m_configPrivate.m_intTVSampleRate);
} }
if (m_objRFConfig.m_fmDeviation != m_objRFRunning.m_fmDeviation) if (m_rfConfig.m_fmDeviation != m_rfRunning.m_fmDeviation)
{ {
m_objPhaseDiscri.setFMScaling(1.0f / m_objRFConfig.m_fmDeviation); m_objPhaseDiscri.setFMScaling(1.0f / m_rfConfig.m_fmDeviation);
} }
m_objRunning = m_objConfig; m_running = m_config;
m_objRFRunning = m_objRFConfig; m_rfRunning = m_rfConfig;
m_objRunningPrivate = m_objConfigPrivate; m_runningPrivate = m_configPrivate;
if (forwardSampleRateChange) if (forwardSampleRateChange)
{ {
int sampleRate = m_objRFRunning.m_blndecimatorEnable ? m_objRunningPrivate.m_intTVSampleRate : m_objRunning.m_intSampleRate; int sampleRate = m_rfRunning.m_blndecimatorEnable ? m_runningPrivate.m_intTVSampleRate : m_running.m_intSampleRate;
MsgReportEffectiveSampleRate *report; MsgReportEffectiveSampleRate *report;
report = MsgReportEffectiveSampleRate::create(sampleRate, m_objRunningPrivate.m_intNumberSamplePerLine); report = MsgReportEffectiveSampleRate::create(sampleRate, m_runningPrivate.m_intNumberSamplePerLine);
getMessageQueueToGUI()->push(report); getMessageQueueToGUI()->push(report);
} }
} }
void ATVDemod::applyStandard() void ATVDemod::applyStandard()
{ {
switch(m_objConfig.m_enmATVStandard) switch(m_config.m_enmATVStandard)
{ {
case ATVStdHSkip: case ATVStdHSkip:
// what is left in a line for the image // what is left in a line for the image
@ -689,23 +689,23 @@ void ATVDemod::applyStandard()
} }
// for now all standards apply this // for now all standards apply this
m_intNumberSamplePerLineSignals = (int) ((12.0f/64.0f)*m_objConfig.m_fltLineDuration * m_objConfig.m_intSampleRate); // 12.0 = 7.3 + 4.7 m_intNumberSamplePerLineSignals = (int) ((12.0f/64.0f)*m_config.m_fltLineDuration * m_config.m_intSampleRate); // 12.0 = 7.3 + 4.7
m_intNumberSaplesPerHSync = (int) ((9.6f/64.0f)*m_objConfig.m_fltLineDuration * m_objConfig.m_intSampleRate); // 9.4 = 4.7 + 4.7 m_intNumberSaplesPerHSync = (int) ((9.6f/64.0f)*m_config.m_fltLineDuration * m_config.m_intSampleRate); // 9.4 = 4.7 + 4.7
} }
int ATVDemod::getSampleRate() int ATVDemod::getSampleRate()
{ {
return m_objRunning.m_intSampleRate; return m_running.m_intSampleRate;
} }
int ATVDemod::getEffectiveSampleRate() int ATVDemod::getEffectiveSampleRate()
{ {
return m_objRFRunning.m_blndecimatorEnable ? m_objRunningPrivate.m_intTVSampleRate : m_objRunning.m_intSampleRate; return m_rfRunning.m_blndecimatorEnable ? m_runningPrivate.m_intTVSampleRate : m_running.m_intSampleRate;
} }
bool ATVDemod::getBFOLocked() bool ATVDemod::getBFOLocked()
{ {
if ((m_objRFRunning.m_enmModulation == ATV_USB) || (m_objRFRunning.m_enmModulation == ATV_LSB)) if ((m_rfRunning.m_enmModulation == ATV_USB) || (m_rfRunning.m_enmModulation == ATV_LSB))
{ {
return m_bfoPLL.locked(); return m_bfoPLL.locked();
} }

View File

@ -411,14 +411,14 @@ private:
//QElapsedTimer m_objTimer; //QElapsedTimer m_objTimer;
ATVConfig m_objRunning; ATVConfig m_running;
ATVConfig m_objConfig; ATVConfig m_config;
ATVRFConfig m_objRFRunning; ATVRFConfig m_rfRunning;
ATVRFConfig m_objRFConfig; ATVRFConfig m_rfConfig;
ATVConfigPrivate m_objRunningPrivate; ATVConfigPrivate m_runningPrivate;
ATVConfigPrivate m_objConfigPrivate; ATVConfigPrivate m_configPrivate;
QMutex m_objSettingsMutex; QMutex m_objSettingsMutex;
@ -434,12 +434,12 @@ private:
// Horizontal Synchro detection // Horizontal Synchro detection
// Floor Detection 0 // Floor Detection 0
if (fltVal < m_objRunning.m_fltVoltLevelSynchroTop) if (fltVal < m_running.m_fltVoltLevelSynchroTop)
{ {
m_intSynchroPoints++; m_intSynchroPoints++;
} }
// Black detection 0.3 // Black detection 0.3
else if (fltVal > m_objRunning.m_fltVoltLevelSynchroBlack) else if (fltVal > m_running.m_fltVoltLevelSynchroBlack)
{ {
m_intSynchroPoints = 0; m_intSynchroPoints = 0;
} }
@ -450,7 +450,7 @@ private:
if (m_blnSynchroDetected) if (m_blnSynchroDetected)
{ {
if (m_intSampleIndex >= (3 * m_objRunningPrivate.m_intNumberSamplePerLine)/2) // first after skip if (m_intSampleIndex >= (3 * m_runningPrivate.m_intNumberSamplePerLine)/2) // first after skip
{ {
//qDebug("VSync: %d %d %d", m_intColIndex, m_intSampleIndex, m_intLineIndex); //qDebug("VSync: %d %d %d", m_intColIndex, m_intSampleIndex, m_intLineIndex);
m_intAvgColIndex = m_intColIndex; m_intAvgColIndex = m_intColIndex;
@ -468,25 +468,25 @@ private:
m_intSampleIndex++; m_intSampleIndex++;
} }
if (m_intColIndex < m_objRunningPrivate.m_intNumberSamplePerLine + m_intNumberSamplePerTop - 1) if (m_intColIndex < m_runningPrivate.m_intNumberSamplePerLine + m_intNumberSamplePerTop - 1)
{ {
m_intColIndex++; m_intColIndex++;
} }
else else
{ {
if (m_objRunning.m_blnHSync && (m_intLineIndex == 0)) if (m_running.m_blnHSync && (m_intLineIndex == 0))
{ {
//qDebug("HCorr: %d", m_intAvgColIndex); //qDebug("HCorr: %d", m_intAvgColIndex);
m_intColIndex = m_intNumberSamplePerTop + (m_objRunningPrivate.m_intNumberSamplePerLine - m_intAvgColIndex)/2; // amortizing factor 1/2 m_intColIndex = m_intNumberSamplePerTop + (m_runningPrivate.m_intNumberSamplePerLine - m_intAvgColIndex)/2; // amortizing factor 1/2
} }
else else
{ {
m_intColIndex = m_intNumberSamplePerTop; m_intColIndex = m_intNumberSamplePerTop;
} }
if ((m_objRFRunning.m_enmModulation == ATV_AM) if ((m_rfRunning.m_enmModulation == ATV_AM)
|| (m_objRFRunning.m_enmModulation == ATV_USB) || (m_rfRunning.m_enmModulation == ATV_USB)
|| (m_objRFRunning.m_enmModulation == ATV_LSB)) || (m_rfRunning.m_enmModulation == ATV_LSB))
{ {
m_fltAmpMin = m_fltEffMin; m_fltAmpMin = m_fltEffMin;
m_fltAmpMax = m_fltEffMax; m_fltAmpMax = m_fltEffMax;
@ -510,18 +510,18 @@ private:
inline void processClassic(float& fltVal, int& intVal) inline void processClassic(float& fltVal, int& intVal)
{ {
int intSynchroTimeSamples= (3 * m_objRunningPrivate.m_intNumberSamplePerLine)/4; int intSynchroTimeSamples= (3 * m_runningPrivate.m_intNumberSamplePerLine)/4;
float fltSynchroTrameLevel = 0.5f*((float)intSynchroTimeSamples) * m_objRunning.m_fltVoltLevelSynchroBlack; float fltSynchroTrameLevel = 0.5f*((float)intSynchroTimeSamples) * m_running.m_fltVoltLevelSynchroBlack;
// Horizontal Synchro detection // Horizontal Synchro detection
// Floor Detection 0 // Floor Detection 0
if (fltVal < m_objRunning.m_fltVoltLevelSynchroTop) if (fltVal < m_running.m_fltVoltLevelSynchroTop)
{ {
m_intSynchroPoints++; m_intSynchroPoints++;
} }
// Black detection 0.3 // Black detection 0.3
else if (fltVal > m_objRunning.m_fltVoltLevelSynchroBlack) else if (fltVal > m_running.m_fltVoltLevelSynchroBlack)
{ {
m_intSynchroPoints = 0; m_intSynchroPoints = 0;
} }
@ -534,7 +534,7 @@ private:
if (m_blnSynchroDetected) if (m_blnSynchroDetected)
{ {
m_intAvgColIndex = m_intSampleIndex - m_intColIndex - (m_intColIndex < m_objRunningPrivate.m_intNumberSamplePerLine/2 ? 150 : 0); m_intAvgColIndex = m_intSampleIndex - m_intColIndex - (m_intColIndex < m_runningPrivate.m_intNumberSamplePerLine/2 ? 150 : 0);
//qDebug("HSync: %d %d %d", m_intSampleIndex, m_intColIndex, m_intAvgColIndex); //qDebug("HSync: %d %d %d", m_intSampleIndex, m_intColIndex, m_intAvgColIndex);
m_intSampleIndex = 0; m_intSampleIndex = 0;
} }
@ -543,14 +543,14 @@ private:
m_intSampleIndex++; m_intSampleIndex++;
} }
if (!m_objRunning.m_blnHSync && (m_intColIndex >= m_objRunningPrivate.m_intNumberSamplePerLine)) // H Sync not active if (!m_running.m_blnHSync && (m_intColIndex >= m_runningPrivate.m_intNumberSamplePerLine)) // H Sync not active
{ {
m_intColIndex = 0; m_intColIndex = 0;
blnNewLine = true; blnNewLine = true;
} }
else if (m_intColIndex >= m_objRunningPrivate.m_intNumberSamplePerLine + m_intNumberSamplePerTop) // No valid H sync else if (m_intColIndex >= m_runningPrivate.m_intNumberSamplePerLine + m_intNumberSamplePerTop) // No valid H sync
{ {
if (m_objRunning.m_blnHSync && (m_intLineIndex == 0)) if (m_running.m_blnHSync && (m_intLineIndex == 0))
{ {
//qDebug("HSync: %d %d", m_intColIndex, m_intAvgColIndex); //qDebug("HSync: %d %d", m_intColIndex, m_intAvgColIndex);
m_intColIndex = m_intNumberSamplePerTop + m_intAvgColIndex/4; // amortizing 1/4 m_intColIndex = m_intNumberSamplePerTop + m_intAvgColIndex/4; // amortizing 1/4
@ -565,9 +565,9 @@ private:
if (blnNewLine) if (blnNewLine)
{ {
if ((m_objRFRunning.m_enmModulation == ATV_AM) if ((m_rfRunning.m_enmModulation == ATV_AM)
|| (m_objRFRunning.m_enmModulation == ATV_USB) || (m_rfRunning.m_enmModulation == ATV_USB)
|| (m_objRFRunning.m_enmModulation == ATV_LSB)) || (m_rfRunning.m_enmModulation == ATV_LSB))
{ {
m_fltAmpMin = m_fltEffMin; m_fltAmpMin = m_fltEffMin;
m_fltAmpMax = m_fltEffMax; m_fltAmpMax = m_fltEffMax;
@ -604,7 +604,7 @@ private:
// Vertical sync and image rendering // Vertical sync and image rendering
if ((m_objRunning.m_blnVSync) && (m_intLineIndex < m_intNumberOfLines)) // VSync activated and lines in range if ((m_running.m_blnVSync) && (m_intLineIndex < m_intNumberOfLines)) // VSync activated and lines in range
{ {
if (m_intColIndex >= intSynchroTimeSamples) if (m_intColIndex >= intSynchroTimeSamples)
{ {
@ -645,7 +645,7 @@ private:
{ {
m_objRegisteredATVScreen->renderImage(0); m_objRegisteredATVScreen->renderImage(0);
if (m_objRFRunning.m_enmModulation == ATV_AM) if (m_rfRunning.m_enmModulation == ATV_AM)
{ {
m_fltAmpMin = m_fltEffMin; m_fltAmpMin = m_fltEffMin;
m_fltAmpMax = m_fltEffMax; m_fltAmpMax = m_fltEffMax;

View File

@ -61,12 +61,12 @@ QString ATVDemodGUI::getName() const
qint64 ATVDemodGUI::getCenterFrequency() const qint64 ATVDemodGUI::getCenterFrequency() const
{ {
return m_objChannelMarker.getCenterFrequency(); return m_channelMarker.getCenterFrequency();
} }
void ATVDemodGUI::setCenterFrequency(qint64 intCenterFrequency) void ATVDemodGUI::setCenterFrequency(qint64 intCenterFrequency)
{ {
m_objChannelMarker.setCenterFrequency(intCenterFrequency); m_channelMarker.setCenterFrequency(intCenterFrequency);
applySettings(); applySettings();
} }
@ -105,8 +105,8 @@ QByteArray ATVDemodGUI::serialize() const
{ {
SimpleSerializer s(1); SimpleSerializer s(1);
s.writeS32(1, m_objChannelMarker.getCenterFrequency()); s.writeS32(1, m_channelMarker.getCenterFrequency());
s.writeU32(2, m_objChannelMarker.getColor().rgb()); s.writeU32(2, m_channelMarker.getColor().rgb());
s.writeS32(3, ui->synchLevel->value()); s.writeS32(3, ui->synchLevel->value());
s.writeS32(4, ui->blackLevel->value()); s.writeS32(4, ui->blackLevel->value());
s.writeS32(5, ui->lineTime->value()); s.writeS32(5, ui->lineTime->value());
@ -144,10 +144,10 @@ bool ATVDemodGUI::deserialize(const QByteArray& arrData)
bool booltmp; bool booltmp;
blockApplySettings(true); blockApplySettings(true);
m_objChannelMarker.blockSignals(true); m_channelMarker.blockSignals(true);
d.readS32(1, &tmp, 0); d.readS32(1, &tmp, 0);
m_objChannelMarker.setCenterFrequency(tmp); m_channelMarker.setCenterFrequency(tmp);
// if (d.readU32(2, &u32tmp)) { // if (d.readU32(2, &u32tmp)) {
// m_objChannelMarker.setColor(u32tmp); // m_objChannelMarker.setColor(u32tmp);
@ -189,7 +189,7 @@ bool ATVDemodGUI::deserialize(const QByteArray& arrData)
ui->standard->setCurrentIndex(tmp); ui->standard->setCurrentIndex(tmp);
blockApplySettings(false); blockApplySettings(false);
m_objChannelMarker.blockSignals(false); m_channelMarker.blockSignals(false);
lineTimeUpdate(); lineTimeUpdate();
topTimeUpdate(); topTimeUpdate();
@ -211,7 +211,7 @@ bool ATVDemodGUI::handleMessage(const Message& objMessage)
int nbPointsPerLine = ((ATVDemod::MsgReportEffectiveSampleRate&)objMessage).getNbPointsPerLine(); int nbPointsPerLine = ((ATVDemod::MsgReportEffectiveSampleRate&)objMessage).getNbPointsPerLine();
ui->channelSampleRateText->setText(tr("%1k").arg(sampleRate/1000.0f, 0, 'f', 2)); ui->channelSampleRateText->setText(tr("%1k").arg(sampleRate/1000.0f, 0, 'f', 2));
ui->nbPointsPerLineText->setText(tr("%1p").arg(nbPointsPerLine)); ui->nbPointsPerLineText->setText(tr("%1p").arg(nbPointsPerLine));
m_objScopeVis->setSampleRate(sampleRate); m_scopeVis->setSampleRate(sampleRate);
setRFFiltersSlidersRange(sampleRate); setRFFiltersSlidersRange(sampleRate);
lineTimeUpdate(); lineTimeUpdate();
topTimeUpdate(); topTimeUpdate();
@ -261,7 +261,7 @@ void ATVDemodGUI::onMenuDoubleClicked()
{ {
m_blnBasicSettingsShown = true; m_blnBasicSettingsShown = true;
BasicChannelSettingsWidget* bcsw = new BasicChannelSettingsWidget( BasicChannelSettingsWidget* bcsw = new BasicChannelSettingsWidget(
&m_objChannelMarker, this); &m_channelMarker, this);
bcsw->show(); bcsw->show();
} }
} }
@ -270,9 +270,9 @@ ATVDemodGUI::ATVDemodGUI(PluginAPI* objPluginAPI, DeviceSourceAPI *objDeviceAPI,
QWidget* objParent) : QWidget* objParent) :
RollupWidget(objParent), RollupWidget(objParent),
ui(new Ui::ATVDemodGUI), ui(new Ui::ATVDemodGUI),
m_objPluginAPI(objPluginAPI), m_pluginAPI(objPluginAPI),
m_objDeviceAPI(objDeviceAPI), m_deviceAPI(objDeviceAPI),
m_objChannelMarker(this), m_channelMarker(this),
m_blnBasicSettingsShown(false), m_blnBasicSettingsShown(false),
m_blnDoApplySettings(true), m_blnDoApplySettings(true),
m_objMagSqAverage(40, 0), m_objMagSqAverage(40, 0),
@ -283,43 +283,43 @@ ATVDemodGUI::ATVDemodGUI(PluginAPI* objPluginAPI, DeviceSourceAPI *objDeviceAPI,
connect(this, SIGNAL(widgetRolled(QWidget*,bool)), this, SLOT(onWidgetRolled(QWidget*,bool))); connect(this, SIGNAL(widgetRolled(QWidget*,bool)), this, SLOT(onWidgetRolled(QWidget*,bool)));
connect(this, SIGNAL(menuDoubleClickEvent()), this, SLOT(onMenuDoubleClicked())); connect(this, SIGNAL(menuDoubleClickEvent()), this, SLOT(onMenuDoubleClicked()));
m_objScopeVis = new ScopeVisNG(ui->glScope); m_scopeVis = new ScopeVisNG(ui->glScope);
m_objATVDemod = new ATVDemod(m_objScopeVis); m_atvDemod = new ATVDemod(m_scopeVis);
m_objATVDemod->setMessageQueueToGUI(getInputMessageQueue()); m_atvDemod->setMessageQueueToGUI(getInputMessageQueue());
m_objATVDemod->setATVScreen(ui->screenTV); m_atvDemod->setATVScreen(ui->screenTV);
m_objChannelizer = new DownChannelizer(m_objATVDemod); m_channelizer = new DownChannelizer(m_atvDemod);
m_objThreadedChannelizer = new ThreadedBasebandSampleSink(m_objChannelizer, this); m_threadedChannelizer = new ThreadedBasebandSampleSink(m_channelizer, this);
m_objDeviceAPI->addThreadedSink(m_objThreadedChannelizer); m_deviceAPI->addThreadedSink(m_threadedChannelizer);
ui->glScope->connectTimer(m_objPluginAPI->getMainWindow()->getMasterTimer()); ui->glScope->connectTimer(m_pluginAPI->getMainWindow()->getMasterTimer());
connect(&m_objPluginAPI->getMainWindow()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick())); // 50 ms connect(&m_pluginAPI->getMainWindow()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick())); // 50 ms
ui->deltaFrequencyLabel->setText(QString("%1f").arg(QChar(0x94, 0x03))); ui->deltaFrequencyLabel->setText(QString("%1f").arg(QChar(0x94, 0x03)));
ui->deltaFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold)); ui->deltaFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold));
ui->deltaFrequency->setValueRange(false, 7, -9999999, 9999999); ui->deltaFrequency->setValueRange(false, 7, -9999999, 9999999);
connect(m_objChannelizer, SIGNAL(inputSampleRateChanged()), this, SLOT(channelSampleRateChanged())); connect(m_channelizer, SIGNAL(inputSampleRateChanged()), this, SLOT(channelSampleRateChanged()));
//m_objPluginAPI->addThreadedSink(m_objThreadedChannelizer); //m_objPluginAPI->addThreadedSink(m_objThreadedChannelizer);
m_objChannelMarker.setColor(Qt::white); m_channelMarker.setColor(Qt::white);
m_objChannelMarker.setMovable(false); m_channelMarker.setMovable(false);
m_objChannelMarker.setBandwidth(6000000); m_channelMarker.setBandwidth(6000000);
m_objChannelMarker.setCenterFrequency(0); m_channelMarker.setCenterFrequency(0);
m_objChannelMarker.setVisible(true); m_channelMarker.setVisible(true);
setTitleColor(m_objChannelMarker.getColor()); setTitleColor(m_channelMarker.getColor());
connect(&m_objChannelMarker, SIGNAL(changed()), this, SLOT(viewChanged())); connect(&m_channelMarker, SIGNAL(changed()), this, SLOT(viewChanged()));
m_objDeviceAPI->registerChannelInstance(m_strChannelID, this); m_deviceAPI->registerChannelInstance(m_strChannelID, this);
m_objDeviceAPI->addChannelMarker(&m_objChannelMarker); m_deviceAPI->addChannelMarker(&m_channelMarker);
m_objDeviceAPI->addRollupWidget(this); m_deviceAPI->addRollupWidget(this);
//ui->screenTV->connectTimer(m_objPluginAPI->getMainWindow()->getMasterTimer()); //ui->screenTV->connectTimer(m_objPluginAPI->getMainWindow()->getMasterTimer());
m_objMagSqAverage.resize(4, 1.0); m_objMagSqAverage.resize(4, 1.0);
ui->scopeGUI->setBuddies(m_objScopeVis->getInputMessageQueue(), m_objScopeVis, ui->glScope); ui->scopeGUI->setBuddies(m_scopeVis->getInputMessageQueue(), m_scopeVis, ui->glScope);
resetToDefaults(); // does applySettings() resetToDefaults(); // does applySettings()
@ -346,12 +346,12 @@ ATVDemodGUI::ATVDemodGUI(PluginAPI* objPluginAPI, DeviceSourceAPI *objDeviceAPI,
ATVDemodGUI::~ATVDemodGUI() ATVDemodGUI::~ATVDemodGUI()
{ {
m_objDeviceAPI->removeChannelInstance(this); m_deviceAPI->removeChannelInstance(this);
m_objDeviceAPI->removeThreadedSink(m_objThreadedChannelizer); m_deviceAPI->removeThreadedSink(m_threadedChannelizer);
delete m_objThreadedChannelizer; delete m_threadedChannelizer;
delete m_objChannelizer; delete m_channelizer;
delete m_objATVDemod; delete m_atvDemod;
delete m_objScopeVis; delete m_scopeVis;
delete ui; delete ui;
} }
@ -364,13 +364,13 @@ void ATVDemodGUI::applySettings()
{ {
if (m_blnDoApplySettings) if (m_blnDoApplySettings)
{ {
ui->deltaFrequency->setValue(m_objChannelMarker.getCenterFrequency()); ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency());
m_objChannelizer->configure(m_objChannelizer->getInputMessageQueue(), m_channelizer->configure(m_channelizer->getInputMessageQueue(),
m_objChannelizer->getInputSampleRate(), // always use maximum available bandwidth m_channelizer->getInputSampleRate(), // always use maximum available bandwidth
m_objChannelMarker.getCenterFrequency()); m_channelMarker.getCenterFrequency());
m_objATVDemod->configure(m_objATVDemod->getInputMessageQueue(), m_atvDemod->configure(m_atvDemod->getInputMessageQueue(),
getNominalLineTime(ui->nbLines->currentIndex(), ui->fps->currentIndex()) + ui->lineTime->value() * m_fltLineTimeMultiplier, getNominalLineTime(ui->nbLines->currentIndex(), ui->fps->currentIndex()) + ui->lineTime->value() * m_fltLineTimeMultiplier,
getNominalLineTime(ui->nbLines->currentIndex(), ui->fps->currentIndex()) * (4.7f / 64.0f) + ui->topTime->value() * m_fltTopTimeMultiplier, getNominalLineTime(ui->nbLines->currentIndex(), ui->fps->currentIndex()) * (4.7f / 64.0f) + ui->topTime->value() * m_fltTopTimeMultiplier,
getFps(ui->fps->currentIndex()), getFps(ui->fps->currentIndex()),
@ -385,8 +385,8 @@ void ATVDemodGUI::applySettings()
ui->screenTabWidget->currentIndex()); ui->screenTabWidget->currentIndex());
qDebug() << "ATVDemodGUI::applySettings:" qDebug() << "ATVDemodGUI::applySettings:"
<< " m_objChannelizer.inputSampleRate: " << m_objChannelizer->getInputSampleRate() << " m_objChannelizer.inputSampleRate: " << m_channelizer->getInputSampleRate()
<< " m_objATVDemod.sampleRate: " << m_objATVDemod->getSampleRate(); << " m_objATVDemod.sampleRate: " << m_atvDemod->getSampleRate();
} }
} }
@ -394,7 +394,7 @@ void ATVDemodGUI::applyRFSettings()
{ {
if (m_blnDoApplySettings) if (m_blnDoApplySettings)
{ {
m_objATVDemod->configureRF(m_objATVDemod->getInputMessageQueue(), m_atvDemod->configureRF(m_atvDemod->getInputMessageQueue(),
(ATVDemod::ATVModulation) ui->modulation->currentIndex(), (ATVDemod::ATVModulation) ui->modulation->currentIndex(),
ui->rfBW->value() * m_rfSliderDivisor * 1.0f, ui->rfBW->value() * m_rfSliderDivisor * 1.0f,
ui->rfOppBW->value() * m_rfSliderDivisor * 1.0f, ui->rfOppBW->value() * m_rfSliderDivisor * 1.0f,
@ -411,26 +411,26 @@ void ATVDemodGUI::setChannelMarkerBandwidth()
if (ui->rfFiltering->isChecked()) // FFT filter if (ui->rfFiltering->isChecked()) // FFT filter
{ {
m_objChannelMarker.setBandwidth(ui->rfBW->value()*m_rfSliderDivisor); m_channelMarker.setBandwidth(ui->rfBW->value()*m_rfSliderDivisor);
m_objChannelMarker.setOppositeBandwidth(ui->rfOppBW->value()*m_rfSliderDivisor); m_channelMarker.setOppositeBandwidth(ui->rfOppBW->value()*m_rfSliderDivisor);
if (ui->modulation->currentIndex() == (int) ATVDemod::ATV_LSB) { if (ui->modulation->currentIndex() == (int) ATVDemod::ATV_LSB) {
m_objChannelMarker.setSidebands(ChannelMarker::vlsb); m_channelMarker.setSidebands(ChannelMarker::vlsb);
} else if (ui->modulation->currentIndex() == (int) ATVDemod::ATV_USB) { } else if (ui->modulation->currentIndex() == (int) ATVDemod::ATV_USB) {
m_objChannelMarker.setSidebands(ChannelMarker::vusb); m_channelMarker.setSidebands(ChannelMarker::vusb);
} else { } else {
m_objChannelMarker.setSidebands(ChannelMarker::vusb); m_channelMarker.setSidebands(ChannelMarker::vusb);
} }
} }
else else
{ {
if (ui->decimatorEnable->isChecked()) { if (ui->decimatorEnable->isChecked()) {
m_objChannelMarker.setBandwidth(ui->rfBW->value()*m_rfSliderDivisor); m_channelMarker.setBandwidth(ui->rfBW->value()*m_rfSliderDivisor);
} else { } else {
m_objChannelMarker.setBandwidth(m_objChannelizer->getInputSampleRate()); m_channelMarker.setBandwidth(m_channelizer->getInputSampleRate());
} }
m_objChannelMarker.setSidebands(ChannelMarker::dsb); m_channelMarker.setSidebands(ChannelMarker::dsb);
} }
m_blnDoApplySettings = true; m_blnDoApplySettings = true;
@ -464,14 +464,14 @@ void ATVDemodGUI::setRFFiltersSlidersRange(int sampleRate)
void ATVDemodGUI::leaveEvent(QEvent*) void ATVDemodGUI::leaveEvent(QEvent*)
{ {
blockApplySettings(true); blockApplySettings(true);
m_objChannelMarker.setHighlighted(false); m_channelMarker.setHighlighted(false);
blockApplySettings(false); blockApplySettings(false);
} }
void ATVDemodGUI::enterEvent(QEvent*) void ATVDemodGUI::enterEvent(QEvent*)
{ {
blockApplySettings(true); blockApplySettings(true);
m_objChannelMarker.setHighlighted(true); m_channelMarker.setHighlighted(true);
blockApplySettings(false); blockApplySettings(false);
} }
@ -483,13 +483,13 @@ void ATVDemodGUI::tick()
} }
else else
{ {
if (m_objATVDemod) if (m_atvDemod)
{ {
m_objMagSqAverage.feed(m_objATVDemod->getMagSq()); m_objMagSqAverage.feed(m_atvDemod->getMagSq());
double magSqDB = CalcDb::dbPower(m_objMagSqAverage.average() / (1<<30)); double magSqDB = CalcDb::dbPower(m_objMagSqAverage.average() / (1<<30));
ui->channePowerText->setText(tr("%1 dB").arg(magSqDB, 0, 'f', 1)); ui->channePowerText->setText(tr("%1 dB").arg(magSqDB, 0, 'f', 1));
if (m_objATVDemod->getBFOLocked()) { if (m_atvDemod->getBFOLocked()) {
ui->bfoLockedLabel->setStyleSheet("QLabel { background-color : green; }"); ui->bfoLockedLabel->setStyleSheet("QLabel { background-color : green; }");
} else { } else {
ui->bfoLockedLabel->setStyleSheet("QLabel { background:rgb(79,79,79); }"); ui->bfoLockedLabel->setStyleSheet("QLabel { background:rgb(79,79,79); }");
@ -574,7 +574,7 @@ void ATVDemodGUI::on_reset_clicked(bool checked __attribute__((unused)))
void ATVDemodGUI::on_modulation_currentIndexChanged(int index __attribute__((unused))) void ATVDemodGUI::on_modulation_currentIndexChanged(int index __attribute__((unused)))
{ {
setRFFiltersSlidersRange(m_objATVDemod->getEffectiveSampleRate()); setRFFiltersSlidersRange(m_atvDemod->getEffectiveSampleRate());
setChannelMarkerBandwidth(); setChannelMarkerBandwidth();
applyRFSettings(); applyRFSettings();
} }
@ -595,7 +595,7 @@ void ATVDemodGUI::on_rfOppBW_valueChanged(int value)
void ATVDemodGUI::on_rfFiltering_toggled(bool checked __attribute__((unused))) void ATVDemodGUI::on_rfFiltering_toggled(bool checked __attribute__((unused)))
{ {
setRFFiltersSlidersRange(m_objATVDemod->getEffectiveSampleRate()); setRFFiltersSlidersRange(m_atvDemod->getEffectiveSampleRate());
setChannelMarkerBandwidth(); setChannelMarkerBandwidth();
applyRFSettings(); applyRFSettings();
} }
@ -608,7 +608,7 @@ void ATVDemodGUI::on_decimatorEnable_toggled(bool checked __attribute__((unused)
void ATVDemodGUI::on_deltaFrequency_changed(qint64 value) void ATVDemodGUI::on_deltaFrequency_changed(qint64 value)
{ {
m_objChannelMarker.setCenterFrequency(value); m_channelMarker.setCenterFrequency(value);
} }
void ATVDemodGUI::on_bfo_valueChanged(int value) void ATVDemodGUI::on_bfo_valueChanged(int value)
@ -633,10 +633,10 @@ void ATVDemodGUI::lineTimeUpdate()
float nominalLineTime = getNominalLineTime(ui->nbLines->currentIndex(), ui->fps->currentIndex()); float nominalLineTime = getNominalLineTime(ui->nbLines->currentIndex(), ui->fps->currentIndex());
int lineTimeScaleFactor = (int) std::log10(nominalLineTime); int lineTimeScaleFactor = (int) std::log10(nominalLineTime);
if (m_objATVDemod->getEffectiveSampleRate() == 0) { if (m_atvDemod->getEffectiveSampleRate() == 0) {
m_fltLineTimeMultiplier = std::pow(10.0, lineTimeScaleFactor-3); m_fltLineTimeMultiplier = std::pow(10.0, lineTimeScaleFactor-3);
} else { } else {
m_fltLineTimeMultiplier = 1.0f / m_objATVDemod->getEffectiveSampleRate(); m_fltLineTimeMultiplier = 1.0f / m_atvDemod->getEffectiveSampleRate();
} }
float lineTime = nominalLineTime + m_fltLineTimeMultiplier * ui->lineTime->value(); float lineTime = nominalLineTime + m_fltLineTimeMultiplier * ui->lineTime->value();
@ -658,10 +658,10 @@ void ATVDemodGUI::topTimeUpdate()
float nominalTopTime = getNominalLineTime(ui->nbLines->currentIndex(), ui->fps->currentIndex()) * (4.7f / 64.0f); float nominalTopTime = getNominalLineTime(ui->nbLines->currentIndex(), ui->fps->currentIndex()) * (4.7f / 64.0f);
int topTimeScaleFactor = (int) std::log10(nominalTopTime); int topTimeScaleFactor = (int) std::log10(nominalTopTime);
if (m_objATVDemod->getEffectiveSampleRate() == 0) { if (m_atvDemod->getEffectiveSampleRate() == 0) {
m_fltTopTimeMultiplier = std::pow(10.0, topTimeScaleFactor-3); m_fltTopTimeMultiplier = std::pow(10.0, topTimeScaleFactor-3);
} else { } else {
m_fltTopTimeMultiplier = 1.0f / m_objATVDemod->getEffectiveSampleRate(); m_fltTopTimeMultiplier = 1.0f / m_atvDemod->getEffectiveSampleRate();
} }
float topTime = nominalTopTime + m_fltTopTimeMultiplier * ui->topTime->value(); float topTime = nominalTopTime + m_fltTopTimeMultiplier * ui->topTime->value();

View File

@ -89,12 +89,12 @@ private slots:
private: private:
Ui::ATVDemodGUI* ui; Ui::ATVDemodGUI* ui;
PluginAPI* m_objPluginAPI; PluginAPI* m_pluginAPI;
DeviceSourceAPI* m_objDeviceAPI; DeviceSourceAPI* m_deviceAPI;
ChannelMarker m_objChannelMarker; ChannelMarker m_channelMarker;
ThreadedBasebandSampleSink* m_objThreadedChannelizer; ThreadedBasebandSampleSink* m_threadedChannelizer;
DownChannelizer* m_objChannelizer; DownChannelizer* m_channelizer;
ATVDemod* m_objATVDemod; ATVDemod* m_atvDemod;
bool m_blnBasicSettingsShown; bool m_blnBasicSettingsShown;
bool m_blnDoApplySettings; bool m_blnDoApplySettings;
@ -102,7 +102,7 @@ private:
MovingAverage<double> m_objMagSqAverage; MovingAverage<double> m_objMagSqAverage;
int m_intTickCount; int m_intTickCount;
ScopeVisNG* m_objScopeVis; ScopeVisNG* m_scopeVis;
float m_fltLineTimeMultiplier; float m_fltLineTimeMultiplier;
float m_fltTopTimeMultiplier; float m_fltTopTimeMultiplier;