mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-16 13:21:50 -05:00
Preparation for variable span SSB
This commit is contained in:
parent
3d2b82b934
commit
bec01078d9
@ -41,6 +41,7 @@ void SSBDemodGUI::resetToDefaults()
|
|||||||
ui->BW->setValue(30);
|
ui->BW->setValue(30);
|
||||||
ui->volume->setValue(40);
|
ui->volume->setValue(40);
|
||||||
ui->deltaFrequency->setValue(0);
|
ui->deltaFrequency->setValue(0);
|
||||||
|
ui->spanLog2->setValue(3);
|
||||||
applySettings();
|
applySettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,6 +54,7 @@ QByteArray SSBDemodGUI::serialize() const
|
|||||||
s.writeS32(3, ui->volume->value());
|
s.writeS32(3, ui->volume->value());
|
||||||
s.writeBlob(4, ui->spectrumGUI->serialize());
|
s.writeBlob(4, ui->spectrumGUI->serialize());
|
||||||
s.writeU32(5, m_channelMarker->getColor().rgb());
|
s.writeU32(5, m_channelMarker->getColor().rgb());
|
||||||
|
s.writeS32(6, ui->spanLog2->value());
|
||||||
return s.final();
|
return s.final();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,6 +83,9 @@ bool SSBDemodGUI::deserialize(const QByteArray& data)
|
|||||||
ui->spectrumGUI->deserialize(bytetmp);
|
ui->spectrumGUI->deserialize(bytetmp);
|
||||||
if(d.readU32(5, &u32tmp))
|
if(d.readU32(5, &u32tmp))
|
||||||
m_channelMarker->setColor(u32tmp);
|
m_channelMarker->setColor(u32tmp);
|
||||||
|
d.readS32(6, &tmp, 20);
|
||||||
|
ui->spanLog2->setValue(tmp);
|
||||||
|
setNewRate(tmp);
|
||||||
applySettings();
|
applySettings();
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
@ -122,7 +127,7 @@ void SSBDemodGUI::on_deltaFrequency_changed(quint64 value)
|
|||||||
void SSBDemodGUI::on_BW_valueChanged(int value)
|
void SSBDemodGUI::on_BW_valueChanged(int value)
|
||||||
{
|
{
|
||||||
QString s = QString::number(value/10.0, 'f', 1);
|
QString s = QString::number(value/10.0, 'f', 1);
|
||||||
ui->BWText->setText(s);
|
ui->BWText->setText(tr("%1k").arg(s));
|
||||||
m_channelMarker->setBandwidth(value * 100 * 2);
|
m_channelMarker->setBandwidth(value * 100 * 2);
|
||||||
|
|
||||||
if (value < 0) {
|
if (value < 0) {
|
||||||
@ -164,7 +169,7 @@ void SSBDemodGUI::on_lowCut_valueChanged(int value)
|
|||||||
int lowCutoff = getEffectiveLowCutoff(value * 100);
|
int lowCutoff = getEffectiveLowCutoff(value * 100);
|
||||||
m_channelMarker->setLowCutoff(lowCutoff);
|
m_channelMarker->setLowCutoff(lowCutoff);
|
||||||
QString s = QString::number(lowCutoff/1000.0, 'f', 1);
|
QString s = QString::number(lowCutoff/1000.0, 'f', 1);
|
||||||
ui->lowCutText->setText(s);
|
ui->lowCutText->setText(tr("%1k").arg(s));
|
||||||
ui->lowCut->setValue(lowCutoff/100);
|
ui->lowCut->setValue(lowCutoff/100);
|
||||||
applySettings();
|
applySettings();
|
||||||
}
|
}
|
||||||
@ -175,6 +180,14 @@ void SSBDemodGUI::on_volume_valueChanged(int value)
|
|||||||
applySettings();
|
applySettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SSBDemodGUI::on_spanLog2_valueChanged(int value)
|
||||||
|
{
|
||||||
|
if (setNewRate(value)) {
|
||||||
|
applySettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void SSBDemodGUI::onWidgetRolled(QWidget* widget, bool rollDown)
|
void SSBDemodGUI::onWidgetRolled(QWidget* widget, bool rollDown)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@ -196,7 +209,8 @@ SSBDemodGUI::SSBDemodGUI(PluginAPI* pluginAPI, QWidget* parent) :
|
|||||||
RollupWidget(parent),
|
RollupWidget(parent),
|
||||||
ui(new Ui::SSBDemodGUI),
|
ui(new Ui::SSBDemodGUI),
|
||||||
m_pluginAPI(pluginAPI),
|
m_pluginAPI(pluginAPI),
|
||||||
m_basicSettingsShown(false)
|
m_basicSettingsShown(false),
|
||||||
|
m_rate(6000)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
setAttribute(Qt::WA_DeleteOnClose, true);
|
setAttribute(Qt::WA_DeleteOnClose, true);
|
||||||
@ -211,14 +225,14 @@ SSBDemodGUI::SSBDemodGUI(PluginAPI* pluginAPI, QWidget* parent) :
|
|||||||
m_pluginAPI->addAudioSource(m_audioFifo);
|
m_pluginAPI->addAudioSource(m_audioFifo);
|
||||||
m_pluginAPI->addSampleSink(m_threadedSampleSink);
|
m_pluginAPI->addSampleSink(m_threadedSampleSink);
|
||||||
|
|
||||||
ui->glSpectrum->setCenterFrequency(3000);
|
ui->glSpectrum->setCenterFrequency(m_rate/2);
|
||||||
ui->glSpectrum->setSampleRate(6000);
|
ui->glSpectrum->setSampleRate(m_rate);
|
||||||
ui->glSpectrum->setDisplayWaterfall(true);
|
ui->glSpectrum->setDisplayWaterfall(true);
|
||||||
ui->glSpectrum->setDisplayMaxHold(true);
|
ui->glSpectrum->setDisplayMaxHold(true);
|
||||||
|
|
||||||
m_channelMarker = new ChannelMarker(this);
|
m_channelMarker = new ChannelMarker(this);
|
||||||
m_channelMarker->setColor(Qt::green);
|
m_channelMarker->setColor(Qt::green);
|
||||||
m_channelMarker->setBandwidth(6000);
|
m_channelMarker->setBandwidth(m_rate);
|
||||||
m_channelMarker->setSidebands(ChannelMarker::usb);
|
m_channelMarker->setSidebands(ChannelMarker::usb);
|
||||||
m_channelMarker->setCenterFrequency(0);
|
m_channelMarker->setCenterFrequency(0);
|
||||||
m_channelMarker->setVisible(true);
|
m_channelMarker->setVisible(true);
|
||||||
@ -244,6 +258,37 @@ SSBDemodGUI::~SSBDemodGUI()
|
|||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SSBDemodGUI::setNewRate(int spanLog2)
|
||||||
|
{
|
||||||
|
if ((spanLog2 < 0) || (spanLog2 > 5)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_rate = 48000 / (1<<spanLog2);
|
||||||
|
|
||||||
|
if (ui->BW->value() < -m_rate/100) {
|
||||||
|
ui->BW->setValue(-m_rate/100);
|
||||||
|
} else if (ui->BW->value() > m_rate/100) {
|
||||||
|
ui->BW->setValue(m_rate/100);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ui->lowCut->value() < -m_rate/100) {
|
||||||
|
ui->lowCut->setValue(-m_rate/100);
|
||||||
|
} else if (ui->lowCut->value() > m_rate/100) {
|
||||||
|
ui->lowCut->setValue(m_rate/100);
|
||||||
|
}
|
||||||
|
|
||||||
|
ui->BW->setMinimum(-m_rate/100);
|
||||||
|
ui->lowCut->setMinimum(-m_rate/100);
|
||||||
|
ui->BW->setMaximum(m_rate/100);
|
||||||
|
ui->lowCut->setMaximum(m_rate/100);
|
||||||
|
|
||||||
|
QString s = QString::number(m_rate/1000.0, 'f', 1);
|
||||||
|
ui->spanText->setText(tr("%1k").arg(s));
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void SSBDemodGUI::applySettings()
|
void SSBDemodGUI::applySettings()
|
||||||
{
|
{
|
||||||
setTitleColor(m_channelMarker->getColor());
|
setTitleColor(m_channelMarker->getColor());
|
||||||
|
@ -40,6 +40,7 @@ private slots:
|
|||||||
void on_BW_valueChanged(int value);
|
void on_BW_valueChanged(int value);
|
||||||
void on_lowCut_valueChanged(int value);
|
void on_lowCut_valueChanged(int value);
|
||||||
void on_volume_valueChanged(int value);
|
void on_volume_valueChanged(int value);
|
||||||
|
void on_spanLog2_valueChanged(int value);
|
||||||
void onWidgetRolled(QWidget* widget, bool rollDown);
|
void onWidgetRolled(QWidget* widget, bool rollDown);
|
||||||
void onMenuDoubleClicked();
|
void onMenuDoubleClicked();
|
||||||
|
|
||||||
@ -48,6 +49,7 @@ private:
|
|||||||
PluginAPI* m_pluginAPI;
|
PluginAPI* m_pluginAPI;
|
||||||
ChannelMarker* m_channelMarker;
|
ChannelMarker* m_channelMarker;
|
||||||
bool m_basicSettingsShown;
|
bool m_basicSettingsShown;
|
||||||
|
int m_rate;
|
||||||
|
|
||||||
AudioFifo* m_audioFifo;
|
AudioFifo* m_audioFifo;
|
||||||
ThreadedSampleSink* m_threadedSampleSink;
|
ThreadedSampleSink* m_threadedSampleSink;
|
||||||
@ -59,6 +61,7 @@ private:
|
|||||||
~SSBDemodGUI();
|
~SSBDemodGUI();
|
||||||
|
|
||||||
int getEffectiveLowCutoff(int lowCutoff);
|
int getEffectiveLowCutoff(int lowCutoff);
|
||||||
|
bool setNewRate(int spanLog2);
|
||||||
void applySettings();
|
void applySettings();
|
||||||
|
|
||||||
void leaveEvent(QEvent*);
|
void leaveEvent(QEvent*);
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>302</width>
|
<width>302</width>
|
||||||
<height>410</height>
|
<height>510</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@ -41,7 +41,7 @@
|
|||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>3</number>
|
<number>3</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="1" column="1">
|
<item row="2" column="1">
|
||||||
<widget class="QSlider" name="BW">
|
<widget class="QSlider" name="BW">
|
||||||
<property name="minimum">
|
<property name="minimum">
|
||||||
<number>-60</number>
|
<number>-60</number>
|
||||||
@ -60,7 +60,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="2">
|
<item row="4" column="2">
|
||||||
<widget class="QLabel" name="volumeText">
|
<widget class="QLabel" name="volumeText">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
@ -76,7 +76,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="2">
|
<item row="2" column="2">
|
||||||
<widget class="QLabel" name="BWText">
|
<widget class="QLabel" name="BWText">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
@ -85,14 +85,14 @@
|
|||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>3.0</string>
|
<string>3.0k</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
<property name="alignment">
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="1">
|
<item row="4" column="1">
|
||||||
<widget class="QSlider" name="volume">
|
<widget class="QSlider" name="volume">
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
<number>100</number>
|
<number>100</number>
|
||||||
@ -136,24 +136,38 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="0" column="2">
|
||||||
<widget class="QLabel" name="BWLabel">
|
<widget class="QLabel" name="deltaUnits">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Bandwidth</string>
|
<string>Hz</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0">
|
<item row="4" column="0">
|
||||||
<widget class="QLabel" name="volumeLabel">
|
<widget class="QLabel" name="volumeLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Volume</string>
|
<string>Volume</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="2">
|
<item row="2" column="0">
|
||||||
<widget class="QLabel" name="deltaUnits">
|
<widget class="QLabel" name="BWLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Hz</string>
|
<string>Bandwidth</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="spanLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Span</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QLabel" name="lowCutLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Low cutoff</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -167,14 +181,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="3" column="1">
|
||||||
<widget class="QLabel" name="lowCutLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>Low cutoff</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1">
|
|
||||||
<widget class="QSlider" name="lowCut">
|
<widget class="QSlider" name="lowCut">
|
||||||
<property name="minimum">
|
<property name="minimum">
|
||||||
<number>-60</number>
|
<number>-60</number>
|
||||||
@ -193,7 +200,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="2">
|
<item row="3" column="2">
|
||||||
<widget class="QLabel" name="lowCutText">
|
<widget class="QLabel" name="lowCutText">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
@ -202,13 +209,51 @@
|
|||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>0.3</string>
|
<string>0.3k</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
<property name="alignment">
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="1" column="2">
|
||||||
|
<widget class="QLabel" name="spanText">
|
||||||
|
<property name="text">
|
||||||
|
<string>6.0k</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QSlider" name="spanLog2">
|
||||||
|
<property name="minimum">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
<property name="pageStep">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>3</number>
|
||||||
|
</property>
|
||||||
|
<property name="sliderPosition">
|
||||||
|
<number>3</number>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="invertedAppearance">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="invertedControls">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="spectrumContainer" native="true">
|
<widget class="QWidget" name="spectrumContainer" native="true">
|
||||||
@ -217,7 +262,7 @@
|
|||||||
<x>40</x>
|
<x>40</x>
|
||||||
<y>140</y>
|
<y>140</y>
|
||||||
<width>218</width>
|
<width>218</width>
|
||||||
<height>184</height>
|
<height>284</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@ -244,7 +289,7 @@
|
|||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>200</width>
|
<width>200</width>
|
||||||
<height>150</height>
|
<height>250</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
|
Loading…
Reference in New Issue
Block a user