1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-13 11:51:47 -05:00

ATV: round to nearest 10 Hz when computing rationally decimated/interpolated sample rate

This commit is contained in:
f4exb 2017-04-09 06:48:29 +02:00
parent 8d019af9d6
commit d43f59e93b
6 changed files with 23 additions and 9 deletions

View File

@ -534,11 +534,25 @@ void ATVDemod::applySettings()
}
if ((m_objConfig.m_intSampleRate != m_objRunning.m_intSampleRate)
|| (m_objRFConfig.m_fltRFBandwidth != m_objRFRunning.m_fltRFBandwidth))
|| (m_objRFConfig.m_fltRFBandwidth != m_objRFRunning.m_fltRFBandwidth)
|| (m_objConfig.m_fltFramePerS != m_objRunning.m_fltFramePerS)
|| (m_objConfig.m_intNumberOfLines != m_objRunning.m_intNumberOfLines))
{
m_objSettingsMutex.lock();
m_objConfigPrivate.m_intTVSampleRate = m_objConfig.m_intSampleRate;
int linesPerSecond = m_objConfig.m_intNumberOfLines * m_objConfig.m_fltFramePerS;
int maxPoints = m_objConfig.m_intSampleRate / linesPerSecond;
int i = maxPoints;
for (; i > 0; i--)
{
if ((i * linesPerSecond) % 10 == 0)
break;
}
int nbPointsPerRateUnit = i == 0 ? maxPoints : i;
m_objConfigPrivate.m_intTVSampleRate = nbPointsPerRateUnit * linesPerSecond;
if (m_objConfigPrivate.m_intTVSampleRate > 0)
{

View File

@ -210,7 +210,7 @@ bool ATVDemodGUI::handleMessage(const Message& objMessage)
{
int sampleRate = ((ATVDemod::MsgReportEffectiveSampleRate&)objMessage).getSampleRate();
int nbPointsPerLine = ((ATVDemod::MsgReportEffectiveSampleRate&)objMessage).getNbPointsPerLine();
ui->channelSampleRateText->setText(tr("%1k").arg(sampleRate/1000.0f, 0, 'f', 0));
ui->channelSampleRateText->setText(tr("%1k").arg(sampleRate/1000.0f, 0, 'f', 2));
ui->nbPointsPerLineText->setText(tr("%1p").arg(nbPointsPerLine));
m_objScopeVis->setSampleRate(sampleRate);
setRFFiltersSlidersRange(sampleRate);

View File

@ -135,7 +135,7 @@
<widget class="QLabel" name="channelSampleRateText">
<property name="minimumSize">
<size>
<width>52</width>
<width>66</width>
<height>0</height>
</size>
</property>
@ -143,7 +143,7 @@
<string>Effective channel sample rate (kS/s)</string>
</property>
<property name="text">
<string> 00000k</string>
<string> 00000.00k</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>

View File

@ -776,7 +776,7 @@ void ATVMod::getBaseValues(int outputSampleRate, int linesPerSecond, int& sample
for (; i > 0; i--)
{
if ((i * linesPerSecond) % 1000 == 0)
if ((i * linesPerSecond) % 10 == 0)
break;
}

View File

@ -218,7 +218,7 @@ bool ATVModGUI::handleMessage(const Message& message)
{
int sampleRate = ((ATVMod::MsgReportEffectiveSampleRate&)message).getSampleRate();
uint32_t nbPointsPerLine = ((ATVMod::MsgReportEffectiveSampleRate&)message).gatNbPointsPerLine();
ui->channelSampleRateText->setText(tr("%1k").arg(sampleRate/1000.0f, 0, 'f', 0));
ui->channelSampleRateText->setText(tr("%1k").arg(sampleRate/1000.0f, 0, 'f', 2));
ui->nbPointsPerLineText->setText(tr("%1p").arg(nbPointsPerLine));
setRFFiltersSlidersRange(sampleRate);
return true;

View File

@ -148,12 +148,12 @@
<widget class="QLabel" name="channelSampleRateText">
<property name="minimumSize">
<size>
<width>52</width>
<width>66</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>00000k</string>
<string>00000.00k</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>