Skip to content

Commit

Permalink
Merge pull request #1142 from stefanino-ch/iqrecording
Browse files Browse the repository at this point in the history
Iq recording can now be controlled via remote control interface.
  • Loading branch information
argilo authored Feb 7, 2025
2 parents adb26ce + 034bdf8 commit 06fc582
Show file tree
Hide file tree
Showing 7 changed files with 83 additions and 4 deletions.
5 changes: 5 additions & 0 deletions resources/news.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@

2.17.7: In progress...

NEW: Start/stop I/Q recording via remote control.


2.17.6: Released November 29, 2024

NEW: Fetch RDS Program Service & RadioText via remote control.
Expand Down
4 changes: 4 additions & 0 deletions resources/remote-control.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ Supported commands:
Get status of audio recorder
U RECORD <status>
Set status of audio recorder to <status>
u IQRECORD
Get status of IQ recorder
U IQRECORD <status>
Set status of IQ recorder to <status>
u DSP
Get DSP (SDR receiver) status
U DSP <status>
Expand Down
4 changes: 4 additions & 0 deletions src/applications/gqrx/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,9 @@ MainWindow::MainWindow(const QString& cfgfile, bool edit_conf, QWidget *parent)

// I/Q playback
connect(iq_tool, SIGNAL(startRecording(QString, QString)), this, SLOT(startIqRecording(QString, QString)));
connect(iq_tool, SIGNAL(startRecording(QString, QString)), remote, SLOT(startIqRecorder(QString, QString)));
connect(iq_tool, SIGNAL(stopRecording()), this, SLOT(stopIqRecording()));
connect(iq_tool, SIGNAL(stopRecording()), remote, SLOT(stopIqRecorder()));
connect(iq_tool, SIGNAL(startPlayback(QString,float,qint64)), this, SLOT(startIqPlayback(QString,float,qint64)));
connect(iq_tool, SIGNAL(stopPlayback()), this, SLOT(stopIqPlayback()));
connect(iq_tool, SIGNAL(seek(qint64)), this,SLOT(seekIqFile(qint64)));
Expand All @@ -339,6 +341,8 @@ MainWindow::MainWindow(const QString& cfgfile, bool edit_conf, QWidget *parent)
connect(uiDockRxOpt, SIGNAL(sqlLevelChanged(double)), remote, SLOT(setSquelchLevel(double)));
connect(remote, SIGNAL(startAudioRecorderEvent()), uiDockAudio, SLOT(startAudioRecorder()));
connect(remote, SIGNAL(stopAudioRecorderEvent()), uiDockAudio, SLOT(stopAudioRecorder()));
connect(remote, SIGNAL(startIqRecorderEvent()), iq_tool, SLOT(startIqRecorder()));
connect(remote, SIGNAL(stopIqRecorderEvent()), iq_tool, SLOT(stopIqRecorder()));
connect(ui->plotter, SIGNAL(newFilterFreq(int, int)), remote, SLOT(setPassband(int, int)));
connect(remote, SIGNAL(newPassband(int)), this, SLOT(setPassband(int)));
connect(remote, SIGNAL(gainChanged(QString, double)), uiDockInputCtl, SLOT(setGain(QString,double)));
Expand Down
36 changes: 34 additions & 2 deletions src/applications/gqrx/remote_control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ RemoteControl::RemoteControl(QObject *parent) :
squelch_level = -150.0;
audio_gain = -6.0;
audio_recorder_status = false;
iq_recorder_status = false;
receiver_running = false;
hamlib_compatible = false;
is_audio_muted = false;
Expand Down Expand Up @@ -376,6 +377,7 @@ void RemoteControl::setAudioMuted(bool muted)
/*! \brief Start audio recorder (from mainwindow). */
void RemoteControl::startAudioRecorder(QString unused)
{
/* Check first if a demodulation mode is set. */
if (rc_mode > 0)
audio_recorder_status = true;
}
Expand All @@ -386,6 +388,18 @@ void RemoteControl::stopAudioRecorder()
audio_recorder_status = false;
}

/*! \brief Start IQ recorder (from another window). */
void RemoteControl::startIqRecorder(QString unused1, QString unused2)
{
iq_recorder_status = true;
}

/*! \brief Stop IQ recorder (from another window). */
void RemoteControl::stopIqRecorder()
{
iq_recorder_status = false;
}

/*! \brief Set receiver status (from mainwindow). */
void RemoteControl::setReceiverStatus(bool enabled)
{
Expand Down Expand Up @@ -761,9 +775,11 @@ QString RemoteControl::cmd_get_func(QStringList cmdlist)
QString func = cmdlist.value(1, "");

if (func == "?")
answer = QString("RECORD DSP RDS MUTE\n");
answer = QString("RECORD IQRECORD DSP RDS MUTE\n");
else if (func.compare("RECORD", Qt::CaseInsensitive) == 0)
answer = QString("%1\n").arg(audio_recorder_status);
else if (func.compare("IQRECORD", Qt::CaseInsensitive) == 0)
answer = QString("%1\n").arg(iq_recorder_status);
else if (func.compare("DSP", Qt::CaseInsensitive) == 0)
answer = QString("%1\n").arg(receiver_running);
else if (func.compare("RDS", Qt::CaseInsensitive) == 0)
Expand All @@ -786,7 +802,7 @@ QString RemoteControl::cmd_set_func(QStringList cmdlist)

if (func == "?")
{
answer = QString("RECORD DSP RDS MUTE\n");
answer = QString("RECORD IQRECORD DSP RDS MUTE\n");
}
else if ((func.compare("RECORD", Qt::CaseInsensitive) == 0) && ok)
{
Expand All @@ -804,6 +820,22 @@ QString RemoteControl::cmd_set_func(QStringList cmdlist)
emit stopAudioRecorderEvent();
}
}
else if ((func.compare("IQRECORD", Qt::CaseInsensitive) == 0) && ok)
{
if (!receiver_running)
{
answer = QString("RPRT 1\n");
}
else
{
answer = QString("RPRT 0\n");
iq_recorder_status = status;
if (status)
emit startIqRecorderEvent();
else
emit stopIqRecorderEvent();
}
}
else if ((func.compare("DSP", Qt::CaseInsensitive) == 0) && ok)
{
if (status)
Expand Down
7 changes: 6 additions & 1 deletion src/applications/gqrx/remote_control.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ public slots:
void setAudioMuted(bool muted);
void startAudioRecorder(QString unused);
void stopAudioRecorder();
void startIqRecorder(QString unused1, QString unused2);
void stopIqRecorder();
bool setGain(QString name, double gain);
void setRDSstatus(bool enabled);
void rdsPI(QString program_id);
Expand All @@ -112,6 +114,8 @@ public slots:
void newAudioGain(float gain);
void startAudioRecorderEvent();
void stopAudioRecorderEvent();
void startIqRecorderEvent();
void stopIqRecorderEvent();
void gainChanged(QString name, double value);
void dspChanged(bool value);
void newRDSmode(bool value);
Expand Down Expand Up @@ -143,7 +147,8 @@ private slots:
QString rc_program_id; /*!< RDS Program identification */
QString rds_station; /*!< RDS program service (station) name */
QString rds_radiotext; /*!< RDS Radiotext */
bool audio_recorder_status; /*!< Recording enabled */
bool audio_recorder_status; /*!< Audio recording enabled */
bool iq_recorder_status; /*!< IQ recording enabled */
bool receiver_running; /*!< Whether the receiver is running or not */
bool hamlib_compatible;
gain_list_t gains; /*!< Possible and current gain settings */
Expand Down
29 changes: 28 additions & 1 deletion src/qtgui/iq_tool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ void CIqTool::on_slider_valueChanged(int value)
emit seek(seek_pos);
}


/*! \brief Start/stop recording */
void CIqTool::on_recButton_clicked(bool checked)
{
Expand All @@ -186,6 +185,34 @@ void CIqTool::on_recButton_clicked(bool checked)
}
}

/*! Public slot to start IQ recording by external events (e.g. remote control).
*
* If a recording is already in progress we ignore the event.
*/
void CIqTool::startIqRecorder(void)
{
if (ui->recButton->isChecked())
{
qDebug() << __func__ << "An IQ recording is already in progress";
return;
}

// emulate a button click
ui->recButton->click();
}

/*! Public slot to stop IQ recording by external events (e.g. remote control).
*
* The event is ignored if no recording is in progress.
*/
void CIqTool::stopIqRecorder(void)
{
if (ui->recButton->isChecked())
ui->recButton->click(); // emulate a button click
else
qDebug() << __func__ << "No IQ recording in progress";
}

/*! \brief Cancel a recording.
*
* This slot can be activated to cancel an ongoing recording. Cancelling an
Expand Down
2 changes: 2 additions & 0 deletions src/qtgui/iq_tool.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ class CIqTool : public QDialog
public slots:
void cancelRecording();
void cancelPlayback();
void startIqRecorder(void); /*!< Used if IQ Recorder is started e.g. from remote control */
void stopIqRecorder(void); /*!< Used if IQ Recorder is stopped e.g. from remote control */

private slots:
void on_recDirEdit_textChanged(const QString &text);
Expand Down

0 comments on commit 06fc582

Please sign in to comment.