From c6533045aacb77440e9208e6f8567cc4fc32aad5 Mon Sep 17 00:00:00 2001 From: Quantum Date: Mon, 16 Dec 2019 20:23:14 -0500 Subject: [PATCH] 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. --- cava.c | 2 +- config.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/cava.c b/cava.c index 91e5bd1..e84aecd 100644 --- a/cava.c +++ b/cava.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) { //starting fifomusic listener thr_id = pthread_create(&p_thread, NULL, input_fifo, (void*)&audio); - audio.rate = 44100; + audio.rate = p.fifoSample; } #ifdef PULSE diff --git a/config.c b/config.c index 4d61cbf..b4dceac 100644 --- a/config.c +++ b/config.c @@ -13,7 +13,7 @@ double monstercat, integral, gravity, ignore, sens; unsigned int lowcf, highcf; double *smooth; 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) { p->im = 2; 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) { p->im = 3;