Allow FIFO input sample rate to be configurable

Refs #275.

While it was mentioned that the ability to acquire this information from MPD
would be useful, allowing it to be configured explicitly could be allow FIFO
to be used for non-MPD sources as well.
master
Quantum 6 years ago
parent 7ce7f96bee
commit c6533045aa
  1. 2
      cava.c
  2. 3
      config.c

@ -461,7 +461,7 @@ as of 0.4.0 all options are specified in config file, see in '/home/username/.co
if (p.im == 2) { if (p.im == 2) {
//starting fifomusic listener //starting fifomusic listener
thr_id = pthread_create(&p_thread, NULL, input_fifo, (void*)&audio); thr_id = pthread_create(&p_thread, NULL, input_fifo, (void*)&audio);
audio.rate = 44100; audio.rate = p.fifoSample;
} }
#ifdef PULSE #ifdef PULSE

@ -13,7 +13,7 @@ double monstercat, integral, gravity, ignore, sens;
unsigned int lowcf, highcf; unsigned int lowcf, highcf;
double *smooth; double *smooth;
int smcount, customEQ, im, om, col, bgcol, autobars, stereo, is_bin, ascii_range, int smcount, customEQ, im, om, col, bgcol, autobars, stereo, is_bin, ascii_range,
bit_format, gradient, gradient_count, fixedbars, framerate, bw, bs, autosens, overshoot, waves, FFTbufferSize; bit_format, gradient, gradient_count, fixedbars, framerate, bw, bs, autosens, overshoot, waves, FFTbufferSize, fifoSample;
}; };
@ -510,6 +510,7 @@ if (strcmp(inputMethod, "alsa") == 0) {
if (strcmp(inputMethod, "fifo") == 0) { if (strcmp(inputMethod, "fifo") == 0) {
p->im = 2; p->im = 2;
p->audio_source = (char *)iniparser_getstring(ini, "input:source", "/tmp/mpd.fifo"); p->audio_source = (char *)iniparser_getstring(ini, "input:source", "/tmp/mpd.fifo");
p->fifoSample = iniparser_getint(ini, "input:sample_rate", 44100);
} }
if (strcmp(inputMethod, "pulse") == 0) { if (strcmp(inputMethod, "pulse") == 0) {
p->im = 3; p->im = 3;

Loading…
Cancel
Save