Add a spinner control for scaling of I/Q input level.

This commit is contained in:
Joe Taylor 2022-04-08 11:21:04 -04:00
parent 6e344fdec8
commit 70959a9796
7 changed files with 44 additions and 29 deletions

View File

@ -106,8 +106,8 @@ void DevSetup::initDlg()
ui.comboBoxSndOut->setCurrentIndex(m_nDevOut);
ui.sbPort->setValue(m_udpPort);
ui.cbIQswap->setChecked(m_IQswap);
ui.cb10db->setChecked(m_10db);
ui.cbInitIQplus->setChecked(m_initIQplus);
ui.sb_dB->setValue(m_dB);
ui.mult570SpinBox->setValue(m_mult570);
ui.mult570TxSpinBox->setValue(m_mult570Tx);
ui.cal570SpinBox->setValue(m_cal570);
@ -176,8 +176,8 @@ void DevSetup::accept()
m_paOutDevice=m_outDevList[m_nDevOut];
m_udpPort=ui.sbPort->value();
m_IQswap=ui.cbIQswap->isChecked();
m_10db=ui.cb10db->isChecked();
m_initIQplus=ui.cbInitIQplus->isChecked();
m_dB=ui.sb_dB->value();
m_mult570=ui.mult570SpinBox->value();
m_mult570Tx=ui.mult570TxSpinBox->value();
m_cal570=ui.cal570SpinBox->value();
@ -195,7 +195,7 @@ void DevSetup::on_soundCardRadioButton_toggled(bool checked)
ui.label_Port->setEnabled(!checked);
ui.sbPort->setEnabled(!checked);
ui.cbIQswap->setEnabled(checked);
ui.cb10db->setEnabled(checked);
ui.sb_dB->setEnabled(checked);
}
void DevSetup::on_cbXpol_stateChanged(int n)
@ -217,6 +217,11 @@ void DevSetup::on_mult570SpinBox_valueChanged(int mult)
m_mult570=mult;
}
void DevSetup::on_sb_dB_valueChanged(int n)
{
m_dB=n;
}
void DevSetup::updateColorLabels()
{
QString t;

View File

@ -27,6 +27,7 @@ public:
qint32 m_astroFont;
qint32 m_mult570;
qint32 m_mult570Tx;
qint32 m_dB;
double m_fAdd;
double m_cal570;
@ -39,7 +40,6 @@ public:
bool m_IQswap;
bool m_restartSoundIn;
bool m_restartSoundOut;
bool m_10db;
bool m_initIQplus;
bool m_bIQxt;
@ -81,6 +81,7 @@ private slots:
void on_mult570TxSpinBox_valueChanged(int arg1);
void on_rbIQXT_toggled(bool checked);
void on_sbTxOffset_valueChanged(double f);
void on_sb_dB_valueChanged(int n);
private:
int r,g,b,r0,g0,b0,r1,g1,b1,r2,g2,b2,r3,g3,b3;

View File

@ -698,12 +698,21 @@
</widget>
</item>
<item>
<widget class="QCheckBox" name="cb10db">
<property name="enabled">
<bool>false</bool>
<widget class="QSpinBox" name="sb_dB">
<property name="suffix">
<string> dB</string>
</property>
<property name="text">
<string>+10 dB</string>
<property name="prefix">
<string> </string>
</property>
<property name="minimum">
<number>-50</number>
</property>
<property name="maximum">
<number>10</number>
</property>
<property name="singleStep">
<number>5</number>
</property>
</widget>
</item>
@ -1772,8 +1781,8 @@
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
<x>257</x>
<y>380</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
@ -1788,8 +1797,8 @@
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
<x>325</x>
<y>380</y>
</hint>
<hint type="destinationlabel">
<x>286</x>

View File

@ -372,7 +372,7 @@ void MainWindow::writeSettings()
settings.setValue("SoundOutIndex",m_nDevOut);
settings.setValue("paOutDevice",m_paOutDevice);
settings.setValue("IQswap",m_IQswap);
settings.setValue("Plus10dB",m_10db);
settings.setValue("Scale_dB",m_dB);
settings.setValue("IQxt",m_bIQxt);
settings.setValue("InitIQplus",m_initIQplus);
settings.setValue("UDPport",m_udpPort);
@ -447,12 +447,12 @@ void MainWindow::readSettings()
m_nDevOut = settings.value("SoundOutIndex", 0).toInt();
m_paOutDevice = settings.value("paOutDevice",0).toInt();
m_IQswap = settings.value("IQswap",false).toBool();
m_10db = settings.value("Plus10dB",false).toBool();
m_dB = settings.value("Scale_dB",0).toInt();
m_initIQplus = settings.value("InitIQplus",false).toBool();
m_bIQxt = settings.value("IQxt",false).toBool();
m_udpPort = settings.value("UDPport",50004).toInt();
soundInThread.setSwapIQ(m_IQswap);
soundInThread.set10db(m_10db);
soundInThread.setScale(m_dB);
soundInThread.setPort(m_udpPort);
ui->actionCuteSDR->setChecked(settings.value(
"PaletteCuteSDR",true).toBool());
@ -682,7 +682,7 @@ void MainWindow::on_actionDeviceSetup_triggered() //Setup Dialog
dlg.m_nDevOut=m_nDevOut;
dlg.m_udpPort=m_udpPort;
dlg.m_IQswap=m_IQswap;
dlg.m_10db=m_10db;
dlg.m_dB=m_dB;
dlg.m_initIQplus=m_initIQplus;
dlg.m_bIQxt=m_bIQxt;
dlg.m_cal570=m_cal570;
@ -719,7 +719,7 @@ void MainWindow::on_actionDeviceSetup_triggered() //Setup Dialog
m_paOutDevice=dlg.m_paOutDevice;
m_udpPort=dlg.m_udpPort;
m_IQswap=dlg.m_IQswap;
m_10db=dlg.m_10db;
m_dB=dlg.m_dB;
m_initIQplus=dlg.m_initIQplus;
m_bIQxt=dlg.m_bIQxt;
m_colors=dlg.m_colors;
@ -732,7 +732,7 @@ void MainWindow::on_actionDeviceSetup_triggered() //Setup Dialog
m_wide_graph_window->m_mult570Tx=m_mult570Tx;
m_wide_graph_window->m_cal570=m_cal570;
soundInThread.setSwapIQ(m_IQswap);
soundInThread.set10db(m_10db);
soundInThread.setScale(m_dB);
if(dlg.m_restartSoundIn) {
soundInThread.quit();

View File

@ -192,6 +192,7 @@ private:
qint32 m_modeJT65;
qint32 m_modeQ65;
qint32 m_RxState;
qint32 m_dB;
double m_fAdd;
@ -220,7 +221,6 @@ private:
bool m_NB;
bool m_fs96000;
bool m_IQswap;
bool m_10db;
bool m_initIQplus;
bool m_bIQxt;

View File

@ -1,4 +1,5 @@
#include "soundin.h"
#include <math.h>
#ifdef Q_OS_WIN32
#include <windows.h>
@ -53,9 +54,9 @@ typedef struct
{
int kin; //Parameters sent to/from the portaudio callback function
int nrx;
int dB;
bool bzero;
bool iqswap;
bool b10db;
} paUserData;
//--------------------------------------------------------------- a2dCallback
@ -91,8 +92,7 @@ extern "C" int a2dCallback( const void *inputBuffer, void *outputBuffer,
nbytes=udata->nrx*8*framesToProcess; //Bytes per frame
memcpy(d4,inputBuffer,nbytes); //Copy all samples to d4
fac=32767.0;
if(udata->b10db) fac=103618.35;
fac=32767.0 * pow(10.0,0.05*udata->dB);
if(udata->nrx==2) {
for(i=0; i<4*int(framesToProcess); i++) { //Negate odd-numbered frames
@ -185,7 +185,7 @@ void SoundInThread::run() //SoundInThread::run()
udata.bzero=false; //Flag to request reset of kin
udata.nrx=m_nrx; //Number of polarizations
udata.iqswap=m_IQswap;
udata.b10db=m_10db;
udata.dB=m_dB;
auto device_info = Pa_GetDeviceInfo (m_nDevIn);
@ -251,7 +251,7 @@ void SoundInThread::run() //SoundInThread::run()
}
k=udata.kin;
udata.iqswap=m_IQswap;
udata.b10db=m_10db;
udata.dB=m_dB;
if(m_monitoring) {
if(m_bForceCenterFreq) {
datcom_.fcenter=m_dForceCenterFreq;
@ -281,9 +281,9 @@ void SoundInThread::setSwapIQ(bool b)
m_IQswap=b;
}
void SoundInThread::set10db(bool b)
void SoundInThread::setScale(qint32 n)
{
m_10db=b;
m_dB=n;
}
void SoundInThread::setPort(int n) //setPort()
{

View File

@ -30,7 +30,7 @@ public:
}
void setSwapIQ(bool b);
void set10db(bool b);
void setScale(qint32 n);
void setPort(qint32 n);
void setInputDevice(qint32 n);
void setRate(double rate);
@ -62,7 +62,6 @@ private:
bool m_monitoring;
bool m_bForceCenterFreq;
bool m_IQswap;
bool m_10db;
double m_dForceCenterFreq;
qint32 m_nrx;
qint32 m_hsym;
@ -70,6 +69,7 @@ private:
qint32 m_udpPort;
qint32 m_TRperiod;
qint32 m_TRperiod0;
qint32 m_dB;
QUdpSocket *udpSocket;
};