Merge a2038ef556 into a985b7db02
This commit is contained in:
commit
5f48d83f3d
|
|
@ -50,6 +50,7 @@ pi_fm_rds [-freq freq] [-audio file] [-ppm ppm_error] [-pi pi_code] [-ps ps_text
|
|||
All arguments are optional:
|
||||
|
||||
* `-freq` specifies the carrier frequency (in MHz). Example: `-freq 107.9`.
|
||||
* `-vol` specifies the volume in percent. Example: `-vol 200`. Default : 100
|
||||
* `-audio` specifies an audio file to play as audio. The sample rate does not matter: Pi-FM-RDS will resample and filter it. If a stereo file is provided, Pi-FM-RDS will produce an FM-Stereo signal. Example: `-audio sound.wav`. The supported formats depend on `libsndfile`. This includes WAV and Ogg/Vorbis (among others) but not MP3. Specify `-` as the file name to read audio data on standard input (useful for piping audio into Pi-FM-RDS, see below).
|
||||
* `-pi` specifies the PI-code of the RDS broadcast. 4 hexadecimal digits. Example: `-pi FFFF`.
|
||||
* `-ps` specifies the station name (Program Service name, PS) of the RDS broadcast. Limit: 8 characters. Example: `-ps RASP-PI`.
|
||||
|
|
|
|||
|
|
@ -269,7 +269,7 @@ map_peripheral(uint32_t base, uint32_t len)
|
|||
#define DATA_SIZE 5000
|
||||
|
||||
|
||||
int tx(uint32_t carrier_freq, char *audio_file, uint16_t pi, char *ps, char *rt, int16_t ppm, char *control_pipe) {
|
||||
int tx(uint32_t carrier_freq, float volume, char *audio_file, uint16_t pi, char *ps, char *rt, int16_t ppm, char *control_pipe) {
|
||||
int i, fd, pid;
|
||||
char pagemap_fn[64];
|
||||
|
||||
|
|
@ -490,7 +490,7 @@ int tx(uint32_t carrier_freq, char *audio_file, uint16_t pi, char *ps, char *rt,
|
|||
data_index = 0;
|
||||
}
|
||||
|
||||
float dval = data[data_index] * (DEVIATION / 10.);
|
||||
float dval = data[data_index] * (DEVIATION / 10.) * (volume/100);
|
||||
data_index++;
|
||||
data_len--;
|
||||
|
||||
|
|
@ -517,6 +517,7 @@ int main(int argc, char **argv) {
|
|||
char *audio_file = NULL;
|
||||
char *control_pipe = NULL;
|
||||
uint32_t carrier_freq = 107900000;
|
||||
float volume = 100;
|
||||
char *ps = NULL;
|
||||
char *rt = "PiFmRds: live FM-RDS transmission from the RaspberryPi";
|
||||
uint16_t pi = 0x1234;
|
||||
|
|
@ -538,6 +539,11 @@ int main(int argc, char **argv) {
|
|||
carrier_freq = 1e6 * atof(param);
|
||||
if(carrier_freq < 87500000 || carrier_freq > 108000000)
|
||||
fatal("Incorrect frequency specification. Must be in megahertz, of the form 107.9\n");
|
||||
} else if(strcmp("-vol", arg)==0 && param != NULL) {
|
||||
i++;
|
||||
volume = atof(param);
|
||||
if(volume < 0)
|
||||
fatal("Incorrect volume specification. Must be positive\n");
|
||||
} else if(strcmp("-pi", arg)==0 && param != NULL) {
|
||||
i++;
|
||||
pi = (uint16_t) strtol(param, NULL, 16);
|
||||
|
|
@ -555,10 +561,10 @@ int main(int argc, char **argv) {
|
|||
control_pipe = param;
|
||||
} else {
|
||||
fatal("Unrecognised argument: %s\n"
|
||||
"Syntax: pi_fm_rds [-freq freq] [-audio file] [-ppm ppm_error] [-pi pi_code]\n"
|
||||
"Syntax: pi_fm_rds [-freq freq] [-vol volume] [-audio file] [-ppm ppm_error] [-pi pi_code]\n"
|
||||
" [-ps ps_text] [-rt rt_text] [-ctl control_pipe]\n", arg);
|
||||
}
|
||||
}
|
||||
|
||||
tx(carrier_freq, audio_file, pi, ps, rt, ppm, control_pipe);
|
||||
}
|
||||
tx(carrier_freq, volume, audio_file, pi, ps, rt, ppm, control_pipe);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue