[linux-audio-dev] Realtime problems with midi/osc sequencer

Robin Gareus robin at gareus.org
Sun Mar 11 20:51:13 UTC 2007



Christian wrote:
> Robin Gareus schrieb:
>>> 		usleep( iTick-( passedTime-startTime ) );
>> AFAIR usleep is not exact! - did you
>>  echo 1024 > /proc/sys/dev/rtc/max-user-freq ?
> 
>> try sth like:
> 
>> void select_sleep (int usec) {
>>         fd_set fd;
>>         int max_fd=0;
>>         struct timeval tv = { 0, 0 };
>>         tv.tv_sec = 0; tv.tv_usec = usec;
> 
>>         FD_ZERO(&fd);
>>         if (remote_en) {
>>                 max_fd=remote_fd_set(&fd);
>>         }
> 
>>         select(max_fd, &fd, NULL, NULL, &tv);
> 
>> }
> 
> 
> 
> Interesting timing approach.
> But I can't find remote_en and remote_fd_set in the man pages.
> What does these arguments stand for?

sorry, cut the 3 "if(remote_en)" lines - I was too quick with pasting &
sending the mail - remote_en is some global var. that allows to
interrupt the sleep, if some other-event occurs... - actually you'd only
needed "select (0,&fd,0,0,&tv);"

anyway clock_nanosleep seems better; at least it takes less code
to set it up. I did not know about it, and it's even POSIX, how cool!

#robin



More information about the Linux-audio-dev mailing list