* Change type of `rate` to `unsigned` to match, now use 0 for the waiting.
* `sig_no` and `thr_id` are tagged with GCC unused attribute to suppress the warnings.
* Switch to `nanosleep`.
"\nUsage : ./cava [options]\n\nOptions:\n\t-b 1..(console columns/2-1) or 200\t number of bars in the spectrum (default 25 + fills up the console), program wil auto adjust to maxsize if input is to high)\n\n\t-i 'input method'\t\t\t method used for listnening to audio, supports 'alsa' and 'fifo'\n\n\t-d 'alsa device'\t\t\t name of alsa capture device (default 'hw:1,1')\n\n\t-p 'fifo path'\t\t\t\t path to fifo (default '/tmp/mpd.fifo')\n\n\t-c color\t\t\t\t suported colors: red, green, yellow, magenta, cyan, white, blue, black (default: cyan)\n\n\t-C backround color\t\t\t supported colors: same as above (default: no change) \n\n\t-s sensitivity %\t\t\t sensitivity in percent, 0 means no respons 100 is normal 50 half 200 double and so forth\n\n\t-f framerate \t\t\t\t max frames per second to be drawn, if you are experiencing high CPU usage, try redcing this (default: 60)\n\n";
//**END INIT
@ -333,8 +342,10 @@ int main(int argc, char **argv)
//**watintg for audio to be ready**//
thr_id=pthread_create(&p_thread,NULL,music,
(void*)device);//starting alsamusic listner
while(format==-1||rate==-1){
usleep(1000);
while(format==-1||rate==0){
req.tv_sec=0;
req.tv_nsec=1000000;
nanosleep(&req,NULL);
n++;
if(n>2000){
if(debug==1)
@ -544,7 +555,10 @@ int main(int argc, char **argv)
if(debug==1)printf("no sound detected for 3 sec, going to sleep mode\n");
//for (i=0;i<200;i++)flast[i]=0; //zeroing memory no more nesceseary after faloff on pauses
//pthread_cancel(thr_id);// this didnt work to well, killing sound thread
usleep(1*1000000);//wait 1 sec, then check sound again.
//wait 1 sec, then check sound again.
req.tv_sec=1;
req.tv_nsec=0;
nanosleep(&req,NULL);
continue;
}
@ -641,7 +655,9 @@ int main(int argc, char **argv)
printf("\033[%dA",height);//backup
usleep((1/(float)framerate)*1000000);//sleeping for set us
req.tv_sec=0;
req.tv_nsec=(1/(float)framerate)*1000000000;//sleeping for set us