diff --git a/src/music_visualizer.c b/src/music_visualizer.c index bdc200e..3da4cb0 100644 --- a/src/music_visualizer.c +++ b/src/music_visualizer.c @@ -10,6 +10,7 @@ #include #include #include +#include #include "fft.h" // fast fourier transform #include "utils_curses.h" @@ -27,7 +28,6 @@ static int maxR = 0; static int maxC = 0; - #ifdef STATUS_CHECK void get_mpd_status(struct mpd_connection* session, STATUS* status) @@ -98,6 +98,7 @@ if(fftAvg[i] > maxR || fftAvg[i] < 0){ fftAvg[i] = 1; } + // print the column fftAvg[i] print_col(i-X_CORRECTION, fftAvg[i], maxR, maxC, pattern, (int)fftAvg[i]); } @@ -106,6 +107,9 @@ void main_event(int fifo) { +#ifdef THREADED + pthread_t tid; +#endif uint16_t buf[N_SAMPLES]; #ifdef STATUS_CHECK struct mpd_connection *session; @@ -183,11 +187,12 @@ } else { cnt++; } + cnt_over--; } else { cnt_over++; mvprintw(cnt_over-1, 0, "[ERR %d] No data available for reading from %s, is MPD playing?",cnt_over, MPD_FIFO); - if(cnt_over == 4) mvprintw(cnt_over+1, 0, "Exiting."); - if(cnt_over == 5) break; + if(cnt_over == 9) mvprintw(cnt_over+1, 0, "Exiting."); + if(cnt_over == 10) break; } // refresh status at SIGALRM #ifdef STATUS_CHECK @@ -211,7 +216,7 @@ // clear screen for printing (only if new data on fifo) if(cnt == NICENESS) { erase(); - print_visual(fftAvg, pattern); + print_visual(fftAvg, pattern); } } #ifdef STATUS_CHECK diff --git a/src/utils_curses.c b/src/utils_curses.c index 0a6d659..829d94b 100644 --- a/src/utils_curses.c +++ b/src/utils_curses.c @@ -101,7 +101,7 @@ int color = 5; /*for(row=maxR; row>=0; row--){*/ - srand(seed+col*col*col); + if (pattern == RANDOM) srand(seed); for (row=0; row