diff --git a/src/music_visualizer.c b/src/music_visualizer.c index fa649ce..b2f875c 100755 --- a/src/music_visualizer.c +++ b/src/music_visualizer.c @@ -16,6 +16,7 @@ #include "utils_curses.h" #include "alsa_fifo.h" #include "utils_mpd.h" +#include "settings.h" #define MPD_FIFO "/tmp/mpd.fifo" #define N_SAMPLES 1024 @@ -53,7 +54,8 @@ void print_visual(unsigned int* fftBuf, unsigned int* fftAvg) { - int correction = maxC/16; //center terminal + int correction = maxC/8; //center terminal + /*int correction = 0;*/ int i; // main loop to print column by column @@ -98,7 +100,7 @@ session = open_connection(); signal(SIGALRM, alarm_status); - alarm(1); + alarm(STATUS_REFRESH); while(!over) { if (wgetch(stdscr) == 'q') { @@ -119,7 +121,7 @@ status = get_current_status(session); getstatus = false; // set alarm for status refresh - alarm(1); + alarm(STATUS_REFRESH); } if (ret > 0) { // clear screen for printing (only if new data on fifo) diff --git a/src/settings.h b/src/settings.h index b6f5484..a853f2d 100644 --- a/src/settings.h +++ b/src/settings.h @@ -1,4 +1,5 @@ -static char defHost[] = "192.168.1.131"; // the ip of mpd +static char defHost[] = "localhost"; // the ip of mpd static unsigned int defPort = 6600;// the port as defined in mpd configs -static char defDBlocation[] = "/home/fra/.mpd/mpd.db"; // the location of the database to be used with the custom search +static char defDBlocation[] = "/home/francesco/.mpd/mpd.db"; // the location of the database to be used with the custom search #define TIMEOUT 1000 // timeout for connection, define at your own risk. Good values range between 1000 and 5000 +#define STATUS_REFRESH 5 // #seconds between each mpd status refresh