rx_tools icon indicating copy to clipboard operation
rx_tools copied to clipboard

Fix gain mode (rtlsdr)

Open oandrew opened this issue 1 year ago • 0 comments

Fix rx_fm not working with rtlsdr (fixes #90 )

  1. SoapySDRDevice_setGainMode was called after SoapySDRDevice_setGain, that seems to reset gain to 0. Likely due to https://github.com/steve-m/librtlsdr/blob/619ac3186ea0ffc092615e1f59f7397e5e6f668c/src/librtlsdr.c#L258C1-L261C2 :
int r820t_set_gain_mode(void *dev, int manual) {
	rtlsdr_dev_t* devt = (rtlsdr_dev_t*)dev;
	return r82xx_set_gain(&devt->r82xx_p, manual, 0);
}

i.e. gain value is reset to 0 when rtlsdr_set_tuner_gain_mode is called 2. Remove rtlagc option as it's not needed anymore.

With these changes I get identical output from rtl_fm and rx_fm with both auto and manual gains e.g.

rtl_fm -vvvv   -f 88.5M -M wbfm -r 48k  | play -r 48k -t raw -e s -b 16 -c 1 -V1 -
rx_fm -vvvv   -f 88.5M -M wbfm -r 48k  | play -r 48k -t raw -e s -b 16 -c 1 -V1 -

or
 
rtl_fm  -vvvv   -f 88.5M -M wbfm -r 48k -g 30  | play -r 48k -t raw -e s -b 16 -c 1 -V1 -
rx_fm -vvvv   -f 88.5M -M wbfm -r 48k -g 30  | play -r 48k -t raw -e s -b 16 -c 1 -V1 -

oandrew avatar Aug 06 '24 20:08 oandrew