From 2460c4c5004e0e715ebebb8d5edf94d16d584c02 Mon Sep 17 00:00:00 2001 From: Vladslav P Date: Tue, 2 Jul 2024 17:48:21 +0300 Subject: [PATCH] RDS: fix flags decoding Change d0...d3 order to d3...d0 to match the standard. Change decoding of Mono/Stereo flag to match the standard. Change decoding of stPTY flag to match the standard. --- src/dsp/rds/parser_impl.cc | 12 ++++++------ src/dsp/rds/parser_impl.h | 2 +- src/qtgui/dockrds.cpp | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/dsp/rds/parser_impl.cc b/src/dsp/rds/parser_impl.cc index 53c44ee68..d6639a6f0 100644 --- a/src/dsp/rds/parser_impl.cc +++ b/src/dsp/rds/parser_impl.cc @@ -66,7 +66,7 @@ void parser_impl::reset() { mono_stereo = false; artificial_head = false; compressed = false; - static_pty = false; + dynamic_pty = false; } /* type 0 = PI @@ -103,16 +103,16 @@ void parser_impl::decode_type0(unsigned int *group, bool B) { /* see page 41, table 9 of the standard */ switch (segment_address) { case 0: - mono_stereo=decoder_control_bit; + dynamic_pty=decoder_control_bit; break; case 1: - artificial_head=decoder_control_bit; + compressed=decoder_control_bit; break; case 2: - compressed=decoder_control_bit; + artificial_head=decoder_control_bit; break; case 3: - static_pty=decoder_control_bit; + mono_stereo=decoder_control_bit; break; default: break; @@ -123,7 +123,7 @@ void parser_impl::decode_type0(unsigned int *group, bool B) { flagstring[3] = mono_stereo ? '1' : '0'; flagstring[4] = artificial_head ? '1' : '0'; flagstring[5] = compressed ? '1' : '0'; - flagstring[6] = static_pty ? '1' : '0'; + flagstring[6] = dynamic_pty ? '1' : '0'; static std::string af_string; if(!B) { // type 0A diff --git a/src/dsp/rds/parser_impl.h b/src/dsp/rds/parser_impl.h index 5e05fa359..3379c867a 100644 --- a/src/dsp/rds/parser_impl.h +++ b/src/dsp/rds/parser_impl.h @@ -68,7 +68,7 @@ class parser_impl : public parser bool mono_stereo; bool artificial_head; bool compressed; - bool static_pty; + bool dynamic_pty; bool log; bool debug; unsigned char pty_locale; diff --git a/src/qtgui/dockrds.cpp b/src/qtgui/dockrds.cpp index 1ef688a7a..b01ab5d83 100644 --- a/src/qtgui/dockrds.cpp +++ b/src/qtgui/dockrds.cpp @@ -70,11 +70,11 @@ void DockRDS::updateRDS(QString text, int type) if (str.at(1) == '1') out.append("TA "); if (str.at(2) == '0') out.append("Speech "); if (str.at(2) == '1') out.append("Music "); - if (str.at(3) == '0') out.append("Stereo "); - if (str.at(3) == '1') out.append("Mono "); + if (str.at(3) == '1') out.append("Stereo "); + if (str.at(3) == '0') out.append("Mono "); if (str.at(4) == '1') out.append("AH "); if (str.at(5) == '1') out.append("CMP "); - if (str.at(6) == '1') out.append("stPTY "); + if (str.at(6) == '0') out.append("stPTY "); ui->flags->setText(QString::fromStdString(out)); break; case 4: