Skip to content

Commit 9ab7c93

Browse files
HA5KFU Rádióamatőr Klubargilo
authored andcommitted
Move mute to function API
1 parent d483db3 commit 9ab7c93

File tree

1 file changed

+16
-22
lines changed

1 file changed

+16
-22
lines changed

src/applications/gqrx/remote_control.cpp

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ RemoteControl::RemoteControl(QObject *parent) :
5252
audio_recorder_status = false;
5353
receiver_running = false;
5454
hamlib_compatible = false;
55+
is_audio_muted = false;
5556

5657
rc_port = DEFAULT_RC_PORT;
5758
rc_allowed_hosts.append(DEFAULT_RC_ALLOWED_HOSTS);
@@ -656,7 +657,7 @@ QString RemoteControl::cmd_get_level(QStringList cmdlist)
656657
QStringList names;
657658
for(auto &g : gains)
658659
names.push_back(QString("%1_GAIN").arg(QString::fromStdString(g.name)));
659-
answer = QString("SQL STRENGTH AF MUTE %1\n").arg(names.join(" "));
660+
answer = QString("SQL STRENGTH AF %1\n").arg(names.join(" "));
660661
}
661662
else if (lvl.compare("STRENGTH", Qt::CaseInsensitive) == 0 || lvl.isEmpty())
662663
{
@@ -670,10 +671,6 @@ QString RemoteControl::cmd_get_level(QStringList cmdlist)
670671
{
671672
answer = QString("%1\n").arg((double)audio_gain, 0, 'f', 1);
672673
}
673-
else if (lvl.compare("MUTE", Qt::CaseInsensitive) == 0)
674-
{
675-
answer = QString("%1\n").arg(is_audio_muted ? '1' : '0');
676-
}
677674
else if (lvl.endsWith("_GAIN"))
678675
{
679676
lvl.chop(5);
@@ -706,7 +703,7 @@ QString RemoteControl::cmd_set_level(QStringList cmdlist)
706703
QStringList names;
707704
for(auto &g : gains)
708705
names.push_back(QString("%1_GAIN").arg(QString::fromStdString(g.name)));
709-
answer = QString("SQL MUTE AF %1\n").arg(names.join(" "));
706+
answer = QString("SQL AF %1\n").arg(names.join(" "));
710707
}
711708
else if (lvl.compare("SQL", Qt::CaseInsensitive) == 0)
712709
{
@@ -737,20 +734,6 @@ QString RemoteControl::cmd_set_level(QStringList cmdlist)
737734
{
738735
answer = QString("RPRT 1\n");
739736
}
740-
}
741-
else if (lvl.compare("MUTE", Qt::CaseInsensitive) == 0)
742-
{
743-
bool ok;
744-
short muted = cmdlist.value(2, "ERR").toShort(&ok);
745-
if (ok)
746-
{
747-
answer = QString("RPRT 0\n");
748-
emit newAudioMuted(muted != 0);
749-
}
750-
else
751-
{
752-
answer = QString("RPRT 1\n");
753-
}
754737
}
755738
else if (lvl.endsWith("_GAIN"))
756739
{
@@ -778,13 +761,15 @@ QString RemoteControl::cmd_get_func(QStringList cmdlist)
778761
QString func = cmdlist.value(1, "");
779762

780763
if (func == "?")
781-
answer = QString("RECORD DSP RDS\n");
764+
answer = QString("RECORD DSP RDS MUTE\n");
782765
else if (func.compare("RECORD", Qt::CaseInsensitive) == 0)
783766
answer = QString("%1\n").arg(audio_recorder_status);
784767
else if (func.compare("DSP", Qt::CaseInsensitive) == 0)
785768
answer = QString("%1\n").arg(receiver_running);
786769
else if (func.compare("RDS", Qt::CaseInsensitive) == 0)
787770
answer = QString("%1\n").arg(rds_status);
771+
else if (func.compare("MUTE", Qt::CaseInsensitive) == 0)
772+
answer = QString("%1\n").arg(is_audio_muted ? '1' : '0');
788773
else
789774
answer = QString("RPRT 1\n");
790775

@@ -801,7 +786,7 @@ QString RemoteControl::cmd_set_func(QStringList cmdlist)
801786

802787
if (func == "?")
803788
{
804-
answer = QString("RECORD DSP RDS\n");
789+
answer = QString("RECORD DSP RDS MUTE\n");
805790
}
806791
else if ((func.compare("RECORD", Qt::CaseInsensitive) == 0) && ok)
807792
{
@@ -827,6 +812,15 @@ QString RemoteControl::cmd_set_func(QStringList cmdlist)
827812
emit dspChanged(false);
828813

829814
answer = QString("RPRT 0\n");
815+
}
816+
else if (func.compare("MUTE", Qt::CaseInsensitive) == 0)
817+
{
818+
if (status)
819+
emit newAudioMuted(true);
820+
else
821+
emit newAudioMuted(false);
822+
823+
answer = QString("RPRT 0\n");
830824
}
831825
else if ((func.compare("RDS", Qt::CaseInsensitive) == 0) && ok)
832826
{

0 commit comments

Comments
 (0)