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

Stephen Sinclair radarsat1 at gmail.com
Mon Mar 12 14:26:04 UTC 2007


You could also try sigaction and setitimer.
I've had good timing results with this approach in the past.
(I haven't tried it for audio tasks though.)

Steve


On 3/11/07, Robin Gareus <robin at gareus.org> wrote:
>
>
> 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