ATV Modulator: added option to force rational decimator even with a ratio of 1.0 this is to be able to use its FIR filter anyway

This commit is contained in:
f4exb 2017-03-22 13:10:42 +01:00
parent 2a08949245
commit 48ab965f36
5 changed files with 46 additions and 11 deletions

View File

@ -114,7 +114,8 @@ void ATVMod::configure(MessageQueue* messageQueue,
bool channelMute,
bool invertedVideo,
float rfScaling,
float fmExcursion)
float fmExcursion,
bool forceDecimator)
{
Message* cmd = MsgConfigureATVMod::create(
rfBandwidth,
@ -131,7 +132,8 @@ void ATVMod::configure(MessageQueue* messageQueue,
channelMute,
invertedVideo,
rfScaling,
fmExcursion);
fmExcursion,
forceDecimator);
messageQueue->push(cmd);
}
@ -152,7 +154,7 @@ void ATVMod::pull(Sample& sample)
m_settingsMutex.lock();
if (m_tvSampleRate == m_running.m_outputSampleRate) // no interpolation nor decimation
if ((m_tvSampleRate == m_running.m_outputSampleRate) && (!m_running.m_forceDecimator)) // no interpolation nor decimation
{
modulateSample();
pullFinalize(m_modSample, sample);
@ -541,6 +543,7 @@ bool ATVMod::handleMessage(const Message& cmd)
m_config.m_invertedVideo = cfg.getInvertedVideo();
m_config.m_rfScalingFactor = cfg.getRFScaling();
m_config.m_fmExcursion = cfg.getFMExcursion();
m_config.m_forceDecimator = cfg.getForceDecimator();
apply();
@ -559,7 +562,8 @@ bool ATVMod::handleMessage(const Message& cmd)
<< " m_channelMute: " << m_config.m_channelMute
<< " m_invertedVideo: " << m_config.m_invertedVideo
<< " m_rfScalingFactor: " << m_config.m_rfScalingFactor
<< " m_fmExcursion: " << m_config.m_fmExcursion;
<< " m_fmExcursion: " << m_config.m_fmExcursion
<< " m_forceDecimator: " << m_config.m_forceDecimator;
return true;
}
@ -736,6 +740,7 @@ void ATVMod::apply(bool force)
m_running.m_invertedVideo = m_config.m_invertedVideo;
m_running.m_rfScalingFactor = m_config.m_rfScalingFactor;
m_running.m_fmExcursion = m_config.m_fmExcursion;
m_running.m_forceDecimator = m_config.m_forceDecimator;
}
void ATVMod::getBaseValues(int linesPerSecond, int& sampleRateUnits, int& nbPointsPerRateUnit)

View File

@ -349,7 +349,8 @@ public:
bool channelMute,
bool invertedVideo,
float rfScaling,
float fmExcursion);
float fmExcursion,
bool forceDecimator);
virtual void pull(Sample& sample);
virtual void pullAudio(int nbSamples); // this is used for video signal actually
@ -394,6 +395,7 @@ private:
bool getInvertedVideo() const { return m_invertedVideo; }
float getRFScaling() const { return m_rfScaling; }
float getFMExcursion() const { return m_fmExcursion; }
bool getForceDecimator() const { return m_forceDecimator; }
static MsgConfigureATVMod* create(
Real rfBandwidth,
@ -410,7 +412,8 @@ private:
bool channelMute,
bool invertedVideo,
float rfScaling,
float fmExcursion)
float fmExcursion,
bool forceDecimator)
{
return new MsgConfigureATVMod(
rfBandwidth,
@ -427,7 +430,8 @@ private:
channelMute,
invertedVideo,
rfScaling,
fmExcursion);
fmExcursion,
forceDecimator);
}
private:
@ -446,6 +450,7 @@ private:
bool m_invertedVideo;
float m_rfScaling;
float m_fmExcursion;
bool m_forceDecimator;
MsgConfigureATVMod(
Real rfBandwidth,
@ -462,7 +467,8 @@ private:
bool channelMute,
bool invertedVideo,
float rfScaling,
float fmExcursion) :
float fmExcursion,
bool forceDecimator) :
Message(),
m_rfBandwidth(rfBandwidth),
m_rfOppBandwidth(rfOppBandwidth),
@ -478,7 +484,8 @@ private:
m_channelMute(channelMute),
m_invertedVideo(invertedVideo),
m_rfScaling(rfScaling),
m_fmExcursion(fmExcursion)
m_fmExcursion(fmExcursion),
m_forceDecimator(forceDecimator)
{ }
};
@ -529,6 +536,7 @@ private:
bool m_invertedVideo; //!< True if video signal is inverted before modulation
float m_rfScalingFactor; //!< Scaling factor from +/-1 to +/-2^15
float m_fmExcursion; //!< FM excursion factor relative to full bandwidth
bool m_forceDecimator; //!< Forces decimator even when channel and source sample rates are equal
Config() :
m_outputSampleRate(-1),
@ -547,7 +555,8 @@ private:
m_channelMute(false),
m_invertedVideo(false),
m_rfScalingFactor(29204.0f), // -1dB
m_fmExcursion(0.5f) // half bandwidth
m_fmExcursion(0.5f), // half bandwidth
m_forceDecimator(false)
{ }
};

View File

@ -435,6 +435,11 @@ void ATVModGUI::on_channelMute_toggled(bool checked)
applySettings();
}
void ATVModGUI::on_forceDecimator_toggled(bool checked)
{
applySettings();
}
void ATVModGUI::on_imageFileDialog_clicked(bool checked)
{
QString fileName = QFileDialog::getOpenFileName(this,
@ -638,7 +643,8 @@ void ATVModGUI::applySettings()
ui->channelMute->isChecked(),
ui->invertVideo->isChecked(),
ui->rfScaling->value() * 327.68f,
ui->fmExcursion->value() / 100.0f);
ui->fmExcursion->value() / 100.0f,
ui->forceDecimator->isChecked());
}
}

View File

@ -63,6 +63,7 @@ private slots:
void on_deltaFrequency_changed(quint64 value);
void on_deltaMinus_toggled(bool minus);
void on_channelMute_toggled(bool checked);
void on_forceDecimator_toggled(bool checked);
void on_modulation_currentIndexChanged(int index);
void on_rfScaling_valueChanged(int value);
void on_fmExcursion_valueChanged(int value);

View File

@ -130,6 +130,20 @@
</property>
</widget>
</item>
<item>
<widget class="ButtonSwitch" name="forceDecimator">
<property name="toolTip">
<string>Force decimaor usage</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../../sdrbase/resources/res.qrc">
<normaloff>:/arrow_down.png</normaloff>:/arrow_down.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="channelSampleRateText">
<property name="minimumSize">