Skip to content

Commit

Permalink
RDS: fix flags decoding
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
vladisslav2011 committed Aug 10, 2024
1 parent 4c825c1 commit 2460c4c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions src/dsp/rds/parser_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/dsp/rds/parser_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions src/qtgui/dockrds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 2460c4c

Please sign in to comment.