Skip to content

Commit

Permalink
Add WFM mono RAW mode
Browse files Browse the repository at this point in the history
  • Loading branch information
vladisslav2011 committed Sep 24, 2024
1 parent ec42832 commit 4e88937
Show file tree
Hide file tree
Showing 8 changed files with 81 additions and 2 deletions.
21 changes: 20 additions & 1 deletion src/applications/gqrx/dcontrols.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3289,7 +3289,7 @@ c_def()
.idx(C_WFM_DEEMPH)
.name("Deemphasis")
.title("Deemphasis")
.title_placement(c_def::grid_placement(PLACE_NEXT,0))
.title_placement(c_def::grid_placement(PLACE_SAME,0))
.placement(c_def::grid_placement(PLACE_SAME,PLACE_NEXT))
.hint("WFM Deemphasis")
.g_type(G_COMBO)
Expand Down Expand Up @@ -3317,6 +3317,25 @@ c_def()
{"7","1 ms",1000.0},
})
,
c_def()
.idx(C_WFM_RAW)
.name("RAW output")
.title("RAW output")
.title_placement(c_def::grid_placement(PLACE_NEXT,0))
.placement(c_def::grid_placement(PLACE_SAME,PLACE_NEXT))
.hint("Bypass lowpass filter")
.g_type(G_CHECKBOX)
.dock(D_RXOPT)
.window(W_DEMOD_OPT)
.scope(S_VFO)
.v_type(V_BOOLEAN)
.demod_specific(true)
.demodgroup(Modulations::GRP_WFM_MONO)
.def(0)
.min(0)
.max(1)
.step(1)
,
c_def()
.idx(C_WFM_STEREO_DEEMPH)
.name("Deemphasis")
Expand Down
1 change: 1 addition & 0 deletions src/applications/gqrx/dcontrols.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ enum c_id
C_RAWIQ_RATE,
C_SSB_DUMMY,
C_WFM_DEEMPH,
C_WFM_RAW,
C_WFM_STEREO_DEEMPH,
C_WFM_OIRT_DEEMPH,
C_RDS_ON,
Expand Down
34 changes: 33 additions & 1 deletion src/dsp/stereo_demod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ stereo_demod::stereo_demod(float input_rate, float audio_rate, bool stereo, bool
d_input_rate(input_rate),
d_audio_rate(audio_rate),
d_stereo(stereo),
d_oirt(oirt)
d_oirt(oirt),
d_raw(false)
{
double cutof_freq = d_oirt ? 15e3 : 17e3;
lpf0 = make_lpf_ff((double)d_input_rate, cutof_freq, 2e3); // FIXME
Expand Down Expand Up @@ -170,3 +171,34 @@ void stereo_demod::set_audio_rate(float audio_rate)
deemph1->set_rate((double)d_audio_rate);
}
}

void stereo_demod::set_raw(bool on)
{
if(d_raw == on)
return;
if(d_raw)
{
disconnect(self(), 0, audio_rr0, 0);
disconnect(audio_rr0, 0, self(), 0);
disconnect(audio_rr0, 0, self(), 1);
}else{
disconnect(self(), 0, lpf0, 0);
disconnect(lpf0, 0, audio_rr0, 0);
disconnect(audio_rr0, 0, deemph0, 0);
disconnect(deemph0, 0, self(), 0);
disconnect(deemph0, 0, self(), 1);
}
d_raw=on;
if(d_raw)
{
connect(self(), 0, audio_rr0, 0);
connect(audio_rr0, 0, self(), 0);
connect(audio_rr0, 0, self(), 1);
}else{
connect(self(), 0, lpf0, 0);
connect(lpf0, 0, audio_rr0, 0);
connect(audio_rr0, 0, deemph0, 0);
connect(deemph0, 0, self(), 0);
connect(deemph0, 0, self(), 1);
}
}
2 changes: 2 additions & 0 deletions src/dsp/stereo_demod.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ class stereo_demod : public gr::hier_block2
~stereo_demod();
void set_tau(double tau);
void set_audio_rate(float audio_rate);
void set_raw(bool);

private:
/* GR blocks */
Expand All @@ -118,6 +119,7 @@ class stereo_demod : public gr::hier_block2
float d_audio_rate; /*! Audio rate. */
bool d_stereo; /*! On/off stereo mode. */
bool d_oirt;
bool d_raw;
std::vector<gr_complex> d_tone_taps; /*! Tone BPF taps. */
std::vector<float> d_pll_taps; /*! Subtone BPF taps. */
};
Expand Down
9 changes: 9 additions & 0 deletions src/receivers/vfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,12 @@ bool vfo_s::set_wfm_deemph(const c_def::v_union & v)
return true;
}

bool vfo_s::set_wfm_raw(const c_def::v_union & v)
{
d_wfm_raw = v;
return true;
}

bool vfo_s::set_nb1_on(const c_def::v_union & v)
{
d_nb_on[0] = v;
Expand Down Expand Up @@ -507,6 +513,7 @@ void vfo_s::restore_settings(vfo_s& from, bool force)
from.get_am_dcr(v);set_am_dcr(v);
from.get_cw_offset(v);set_cw_offset(v);
from.get_wfm_deemph(v);set_wfm_deemph(v);
from.get_wfm_raw(v);set_wfm_raw(v);
from.get_rds_on(v);set_rds_on(v);

from.get_fft_center(v);set_fft_center(v);
Expand Down Expand Up @@ -671,6 +678,8 @@ int vfo_s::conf_initializer()
getters[C_WFM_STEREO_DEEMPH]=&vfo_s::get_wfm_deemph;
setters[C_WFM_OIRT_DEEMPH]=&vfo_s::set_wfm_deemph;
getters[C_WFM_OIRT_DEEMPH]=&vfo_s::get_wfm_deemph;
setters[C_WFM_RAW]=&vfo_s::set_wfm_raw;
getters[C_WFM_RAW]=&vfo_s::get_wfm_raw;

getters[C_RDS_ON]=&vfo_s::get_rds_on;
setters[C_RDS_ON]=&vfo_s::set_rds_on;
Expand Down
4 changes: 4 additions & 0 deletions src/receivers/vfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ typedef class vfo_s: public conf_dispatchers<vfo_s>
d_amsync_dcr(true),
d_pll_bw(0.01),
d_wfm_deemph(50.0),
d_wfm_raw(false),
d_rec_dir(""),
d_rec_sql_triggered(false),
d_rec_min_time(0),
Expand Down Expand Up @@ -166,6 +167,7 @@ typedef class vfo_s: public conf_dispatchers<vfo_s>
bool get_fmpll_damping_factor(c_def::v_union & v) const { v=d_fmpll_damping_factor; return true; }
/* WFM parameters */
bool get_wfm_deemph(c_def::v_union & v) const { v=d_wfm_deemph; return true; }
bool get_wfm_raw(c_def::v_union & v) const { v=d_wfm_raw; return true; }
/* Noise blanker */
bool get_nb1_on(c_def::v_union & v) const { v=d_nb_on[0]; return true; }
bool get_nb2_on(c_def::v_union & v) const { v=d_nb_on[1]; return true; }
Expand Down Expand Up @@ -238,6 +240,7 @@ typedef class vfo_s: public conf_dispatchers<vfo_s>
virtual bool set_amsync_pll_bw(const c_def::v_union &);
/* WFM parameters */
virtual bool set_wfm_deemph(const c_def::v_union &);
virtual bool set_wfm_raw(const c_def::v_union &);
/* Noise blanker */
virtual bool set_nb1_on(const c_def::v_union &);
virtual bool set_nb2_on(const c_def::v_union &);
Expand Down Expand Up @@ -331,6 +334,7 @@ typedef class vfo_s: public conf_dispatchers<vfo_s>
bool d_amsync_dcr;
float d_pll_bw;
float d_wfm_deemph;
bool d_wfm_raw;

bool d_nb_on[RECEIVER_NB_COUNT];
float d_nb_threshold[RECEIVER_NB_COUNT];
Expand Down
11 changes: 11 additions & 0 deletions src/receivers/wfmrx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,17 @@ void wfmrx::stop_rds_decoder()
unlock();
}

bool wfmrx::set_wfm_raw(const c_def::v_union & v)
{
receiver_base_cf::set_wfm_raw(v);
if(d_demod == Modulations::MODE_WFM_MONO)
lock();
mono->set_raw(d_wfm_raw);
if(d_demod == Modulations::MODE_WFM_MONO)
unlock();
return true;
}

bool wfmrx::set_rds_on(const c_def::v_union & v)
{
if(d_rds_on == bool(v))
Expand Down
1 change: 1 addition & 0 deletions src/receivers/wfmrx.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ class wfmrx : public receiver_base_cf
void set_index(int index) override;

bool set_wfm_deemph(const c_def::v_union & v) override;
bool set_wfm_raw(const c_def::v_union &) override;

bool set_rds_on(const c_def::v_union &) override;
bool get_rds_pi(c_def::v_union &) const override;
Expand Down

0 comments on commit 4e88937

Please sign in to comment.