From 09bfb1f54a0acf1fc8c858249f3941bcb36bc92f Mon Sep 17 00:00:00 2001 From: Vladisslav P Date: Fri, 18 Feb 2022 22:26:46 +0300 Subject: [PATCH] iq_tool: implement repeated playback option --- src/applications/gqrx/mainwindow.cpp | 9 +++++---- src/applications/gqrx/mainwindow.h | 2 +- src/qtgui/iq_tool.cpp | 3 ++- src/qtgui/iq_tool.h | 2 +- src/qtgui/iq_tool.ui | 10 ++++++++++ 5 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/applications/gqrx/mainwindow.cpp b/src/applications/gqrx/mainwindow.cpp index a9023d2b0f..1e028cd428 100644 --- a/src/applications/gqrx/mainwindow.cpp +++ b/src/applications/gqrx/mainwindow.cpp @@ -322,7 +322,7 @@ MainWindow::MainWindow(const QString& cfgfile, bool edit_conf, QWidget *parent) 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(startPlayback(QString,float,qint64,bool)), this, SLOT(startIqPlayback(QString,float,qint64,bool))); connect(iq_tool, SIGNAL(stopPlayback()), this, SLOT(stopIqPlayback())); connect(iq_tool, SIGNAL(seek(qint64)), this,SLOT(seekIqFile(qint64))); @@ -1715,7 +1715,8 @@ void MainWindow::stopIqRecording() ui->statusBar->showMessage(tr("I/Q data recoding stopped"), 5000); } -void MainWindow::startIqPlayback(const QString& filename, float samprate, qint64 center_freq) +void MainWindow::startIqPlayback(const QString& filename, float samprate, + qint64 center_freq, bool repeat) { if (ui->actionDSP->isChecked()) { @@ -1729,8 +1730,8 @@ void MainWindow::startIqPlayback(const QString& filename, float samprate, qint64 auto cf = center_freq; double current_offset = rx->get_filter_offset(); QString escapedFilename = receiver::escape_filename(filename.toStdString()).c_str(); - auto devstr = QString("file=%1,rate=%2,freq=%3,throttle=true,repeat=false") - .arg(escapedFilename).arg(sri).arg(cf); + auto devstr = QString("file=%1,rate=%2,freq=%3,throttle=true,repeat=%4") + .arg(escapedFilename).arg(sri).arg(cf).arg(repeat?"true":"false"); qDebug() << __func__ << ":" << devstr; diff --git a/src/applications/gqrx/mainwindow.h b/src/applications/gqrx/mainwindow.h index 5151bb2c15..f5afd67b40 100644 --- a/src/applications/gqrx/mainwindow.h +++ b/src/applications/gqrx/mainwindow.h @@ -197,7 +197,7 @@ private slots: /* I/Q playback and recording*/ void startIqRecording(const QString& recdir, const QString& format); void stopIqRecording(); - void startIqPlayback(const QString& filename, float samprate, qint64 center_freq); + void startIqPlayback(const QString& filename, float samprate, qint64 center_freq, bool repeat); void stopIqPlayback(); void seekIqFile(qint64 seek_pos); diff --git a/src/qtgui/iq_tool.cpp b/src/qtgui/iq_tool.cpp index 6a376d7fcc..7672c9668f 100644 --- a/src/qtgui/iq_tool.cpp +++ b/src/qtgui/iq_tool.cpp @@ -129,7 +129,8 @@ void CIqTool::on_playButton_clicked(bool checked) ui->listWidget->setEnabled(false); ui->recButton->setEnabled(false); emit startPlayback(recdir->absoluteFilePath(current_file), - (float)sample_rate, center_freq); + (float)sample_rate, center_freq, + ui->repeat->checkState() == Qt::Checked); } } else diff --git a/src/qtgui/iq_tool.h b/src/qtgui/iq_tool.h index dc56bd35a9..efce3b50e8 100644 --- a/src/qtgui/iq_tool.h +++ b/src/qtgui/iq_tool.h @@ -64,7 +64,7 @@ class CIqTool : public QDialog signals: void startRecording(const QString recdir, const QString format); void stopRecording(); - void startPlayback(const QString filename, float samprate, qint64 center_freq); + void startPlayback(const QString filename, float samprate, qint64 center_freq, bool repeat); void stopPlayback(); void seek(qint64 seek_pos); diff --git a/src/qtgui/iq_tool.ui b/src/qtgui/iq_tool.ui index 3485db5bc9..c489a569ba 100644 --- a/src/qtgui/iq_tool.ui +++ b/src/qtgui/iq_tool.ui @@ -176,6 +176,16 @@ + + + + + + + Repeat + + +