diff options
| author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2022-01-09 20:02:59 +0100 | 
|---|---|---|
| committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2022-01-09 20:02:59 +0100 | 
| commit | 36276e45cc3dbca2e954515bd7b6b3b4498ddbb2 (patch) | |
| tree | 4ec57160a6b6ec14974e44b5beabf8103907aa1e /src/fl2k_fm.c | |
| parent | 2cf0eaffddab2457fc81d672599c0f58eb6950f9 (diff) | |
| parent | a0e7a58447006cdb1e10f781323c88bd08e66eea (diff) | |
| download | osmo-fl2k-36276e45cc3dbca2e954515bd7b6b3b4498ddbb2.tar.gz osmo-fl2k-36276e45cc3dbca2e954515bd7b6b3b4498ddbb2.tar.bz2 osmo-fl2k-36276e45cc3dbca2e954515bd7b6b3b4498ddbb2.zip | |
Merge branch 'iq' into interleaved_rg
Diffstat (limited to 'src/fl2k_fm.c')
| -rw-r--r-- | src/fl2k_fm.c | 21 | 
1 files changed, 11 insertions, 10 deletions
| diff --git a/src/fl2k_fm.c b/src/fl2k_fm.c index 4aae95b..b22efcd 100644 --- a/src/fl2k_fm.c +++ b/src/fl2k_fm.c @@ -73,7 +73,7 @@ uint32_t samp_rate = 100000000;  #define PILOT_FREQ	19000	/* In Hz */  #define STEREO_CARRIER	38000	/* In Hz */ -int delta_freq = 75000; +int deviation = 75000;  int carrier_freq = 97000000;  int carrier_per_signal;  int input_freq = 44100; @@ -153,17 +153,17 @@ typedef struct {  	unsigned long int phase_slope;  } dds_t; -inline void dds_setphase(dds_t *dds, double phase) +static inline void dds_setphase(dds_t *dds, double phase)  {  	dds->phase = phase * ANG_INCR;  } -inline double dds_getphase(dds_t *dds) +static inline double dds_getphase(dds_t *dds)  {  	return dds->phase / ANG_INCR;  } -inline void dds_set_freq(dds_t *dds, double freq, double fslope) +static inline void dds_set_freq(dds_t *dds, double freq, double fslope)  {  	dds->fslope = fslope;  	dds->phase_step = (freq / dds->sample_freq) * 2 * M_PI * ANG_INCR; @@ -196,7 +196,7 @@ dds_t dds_init(double sample_freq, double freq, double phase)  	return dds;  } -inline int8_t dds_real(dds_t *dds) +static inline int8_t dds_real(dds_t *dds)  {  	int tmp; @@ -209,7 +209,7 @@ inline int8_t dds_real(dds_t *dds)  	return sine_table[tmp];  } -inline void dds_real_buf(dds_t *dds, int8_t *buf, int count) +static inline void dds_real_buf(dds_t *dds, int8_t *buf, int count)  {  	int i;  	for (i = 0; i < count; i++) @@ -267,7 +267,7 @@ static void *fm_worker(void *arg)  	pthread_exit(NULL);  } -inline int writelen(int maxlen) +static inline int writelen(int maxlen)  {  	int rp = readpos;  	int len; @@ -283,13 +283,13 @@ inline int writelen(int maxlen)  	return r;  } -inline double modulate_sample(int lastwritepos, double lastfreq, double sample) +static inline double modulate_sample(int lastwritepos, double lastfreq, double sample)  {  	double freq, slope;  	/* Calculate modulator frequency at this point to lessen  	 * the calculations needed in the signal generator */ -	freq = sample * delta_freq; +	freq = sample * deviation;  	freq += carrier_freq;  	/* What we do here is calculate a linear "slope" from @@ -419,6 +419,7 @@ void fm_modulator_stereo(int use_rds)  void fl2k_callback(fl2k_data_info_t *data_info)  {  	if (data_info->device_error) { +		fprintf(stderr, "Device error, exiting.\n");  		do_exit = 1;  		pthread_cond_signal(&fm_cond);  	} @@ -467,7 +468,7 @@ int main(int argc, char **argv)  			carrier_freq = (uint32_t)atof(optarg);  			break;  		case 'f': -			delta_freq = (uint32_t)atof(optarg); +			deviation = (uint32_t)atof(optarg);  			break;  		case 'i':  			input_freq = (uint32_t)atof(optarg); | 
