ATV Modulator: implemented FM excursion adjustment

pull/27/head
f4exb 2017-03-21 23:29:42 +01:00
rodzic 7e70b7f6c6
commit 0ea39c217c
5 zmienionych plików z 97 dodań i 11 usunięć

Wyświetl plik

@ -113,7 +113,8 @@ void ATVMod::configure(MessageQueue* messageQueue,
bool cameraPlay,
bool channelMute,
bool invertedVideo,
float rfScaling)
float rfScaling,
float fmExcursion)
{
Message* cmd = MsgConfigureATVMod::create(
rfBandwidth,
@ -129,7 +130,8 @@ void ATVMod::configure(MessageQueue* messageQueue,
cameraPlay,
channelMute,
invertedVideo,
rfScaling);
rfScaling,
fmExcursion);
messageQueue->push(cmd);
}
@ -205,7 +207,7 @@ void ATVMod::modulateSample()
switch (m_running.m_atvModulation)
{
case ATVModulationFM: // FM half bandwidth deviation
m_modPhasor += (t - 0.5f) * M_PI;
m_modPhasor += (t - 0.5f) * m_running.m_fmExcursion * 2.0f * M_PI;
if (m_modPhasor > 2.0f * M_PI) m_modPhasor -= 2.0f * M_PI; // limit growth
if (m_modPhasor < 2.0f * M_PI) m_modPhasor += 2.0f * M_PI; // limit growth
m_modSample.real(cos(m_modPhasor) * m_running.m_rfScalingFactor); // -1 dB
@ -538,6 +540,7 @@ bool ATVMod::handleMessage(const Message& cmd)
m_config.m_channelMute = cfg.getChannelMute();
m_config.m_invertedVideo = cfg.getInvertedVideo();
m_config.m_rfScalingFactor = cfg.getRFScaling();
m_config.m_fmExcursion = cfg.getFMExcursion();
apply();
@ -555,7 +558,8 @@ bool ATVMod::handleMessage(const Message& cmd)
<< " m_cameraPlay: " << m_config.m_cameraPlay
<< " m_channelMute: " << m_config.m_channelMute
<< " m_invertedVideo: " << m_config.m_invertedVideo
<< " m_rfScalingFactor: " << m_config.m_rfScalingFactor;
<< " m_rfScalingFactor: " << m_config.m_rfScalingFactor
<< " m_fmExcursion: " << m_config.m_fmExcursion;
return true;
}
@ -730,6 +734,7 @@ void ATVMod::apply(bool force)
m_running.m_channelMute = m_config.m_channelMute;
m_running.m_invertedVideo = m_config.m_invertedVideo;
m_running.m_rfScalingFactor = m_config.m_rfScalingFactor;
m_running.m_fmExcursion = m_config.m_fmExcursion;
}
void ATVMod::getBaseValues(int linesPerSecond, int& sampleRateUnits, int& nbPointsPerRateUnit)

Wyświetl plik

@ -343,7 +343,8 @@ public:
bool cameraPLay,
bool channelMute,
bool invertedVideo,
float rfScaling);
float rfScaling,
float fmExcursion);
virtual void pull(Sample& sample);
virtual void pullAudio(int nbSamples); // this is used for video signal actually
@ -387,6 +388,7 @@ private:
bool getChannelMute() const { return m_channelMute; }
bool getInvertedVideo() const { return m_invertedVideo; }
float getRFScaling() const { return m_rfScaling; }
float getFMExcursion() const { return m_fmExcursion; }
static MsgConfigureATVMod* create(
Real rfBandwidth,
@ -402,7 +404,8 @@ private:
bool cameraPlay,
bool channelMute,
bool invertedVideo,
float rfScaling)
float rfScaling,
float fmExcursion)
{
return new MsgConfigureATVMod(
rfBandwidth,
@ -418,7 +421,8 @@ private:
cameraPlay,
channelMute,
invertedVideo,
rfScaling);
rfScaling,
fmExcursion);
}
private:
@ -436,6 +440,7 @@ private:
bool m_channelMute;
bool m_invertedVideo;
float m_rfScaling;
float m_fmExcursion;
MsgConfigureATVMod(
Real rfBandwidth,
@ -451,7 +456,8 @@ private:
bool cameraPlay,
bool channelMute,
bool invertedVideo,
float rfScaling) :
float rfScaling,
float fmExcursion) :
Message(),
m_rfBandwidth(rfBandwidth),
m_rfOppBandwidth(rfOppBandwidth),
@ -466,7 +472,8 @@ private:
m_cameraPlay(cameraPlay),
m_channelMute(channelMute),
m_invertedVideo(invertedVideo),
m_rfScaling(rfScaling)
m_rfScaling(rfScaling),
m_fmExcursion(fmExcursion)
{ }
};
@ -516,6 +523,7 @@ private:
bool m_channelMute; //!< Mute channel baseband output
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
Config() :
m_outputSampleRate(-1),
@ -533,7 +541,8 @@ private:
m_cameraPlay(false),
m_channelMute(false),
m_invertedVideo(false),
m_rfScalingFactor(29204.0f) // -1dB
m_rfScalingFactor(29204.0f), // -1dB
m_fmExcursion(0.5f) // half bandwidth
{ }
};

Wyświetl plik

@ -101,6 +101,7 @@ QByteArray ATVModGUI::serialize() const
s.writeS32(10, ui->nbLines->currentIndex());
s.writeS32(11, ui->fps->currentIndex());
s.writeS32(12, ui->rfScaling->value());
s.writeS32(13, ui->fmExcursion->value());
return s.final();
}
@ -153,6 +154,8 @@ bool ATVModGUI::deserialize(const QByteArray& data)
ui->fps->setCurrentIndex(tmp);
d.readS32(12, &tmp, 80);
ui->rfScaling->setValue(tmp);
d.readS32(13, &tmp, 50);
ui->fmExcursion->setValue(tmp);
blockApplySettings(false);
m_channelMarker.blockSignals(false);
@ -342,6 +345,12 @@ void ATVModGUI::on_rfScaling_valueChanged(int value)
applySettings();
}
void ATVModGUI::on_fmExcursion_valueChanged(int value)
{
ui->fmExcursionText->setText(tr("%1").arg(value));
applySettings();
}
void ATVModGUI::on_rfBW_valueChanged(int value)
{
ui->rfBWText->setText(QString("%1k").arg((value*m_rfSliderDivisor) / 1000.0, 0, 'f', 0));
@ -578,6 +587,9 @@ ATVModGUI::ATVModGUI(PluginAPI* pluginAPI, DeviceSinkAPI *deviceAPI, QWidget* pa
for (std::vector<int>::iterator it = cameraNumbers.begin(); it != cameraNumbers.end(); ++it) {
ui->camSelect->addItem(tr("%1").arg(*it));
}
QChar delta = QChar(0x94, 0x03);
ui->fmExcursionLabel->setText(delta);
}
ATVModGUI::~ATVModGUI()
@ -623,7 +635,8 @@ void ATVModGUI::applySettings()
ui->playCamera->isChecked(),
ui->channelMute->isChecked(),
ui->invertVideo->isChecked(),
ui->rfScaling->value() * 327.68f);
ui->rfScaling->value() * 327.68f,
ui->fmExcursion->value() / 100.0f);
}
}

Wyświetl plik

@ -65,6 +65,7 @@ private slots:
void on_channelMute_toggled(bool checked);
void on_modulation_currentIndexChanged(int index);
void on_rfScaling_valueChanged(int value);
void on_fmExcursion_valueChanged(int value);
void on_rfBW_valueChanged(int value);
void on_rfOppBW_valueChanged(int value);
void on_nbLines_currentIndexChanged(int index);

Wyświetl plik

@ -250,6 +250,64 @@
</item>
</widget>
</item>
<item>
<widget class="QLabel" name="fmExcursionLabel">
<property name="text">
<string>D</string>
</property>
</widget>
</item>
<item>
<widget class="QDial" name="fmExcursion">
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="toolTip">
<string>FM excursion in % of total bandwidth</string>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="pageStep">
<number>1</number>
</property>
<property name="value">
<number>50</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="fmExcursionText">
<property name="minimumSize">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>FM deviation percentage of total bandwidth</string>
</property>
<property name="text">
<string>50</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="Line" name="line_10">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="rfBWLabel">
<property name="text">