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

2007-03-12 Thread Stephen Sinclair
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 [EMAIL PROTECTED] wrote: Christian wrote: Robin Gareus schrieb: usleep( iTick-(

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

2007-03-11 Thread Robin Gareus
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

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

2007-03-10 Thread Christian
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi, I'm writing on a sequencer system based on osc and midi.( No audio ) I'll first describe how it is build up. As libs I'm using liblo and rtmidi. The whole app is splitted into different small apps dealing with specific data. So there is a timer

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

2007-03-10 Thread Robin Gareus
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;

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

2007-03-10 Thread Dmitry Baikov
In addition to select() there's also clock_nanosleep(CLOCK_MONOTONIC, 0, tv, NULL), which in theory should give best resolution possible. To set realtime privileges, use (taken from jack): struct sched_param rtparam; memset (rtparam, 0, sizeof (rtparam)); rtparam.sched_priority = priority;

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

2007-03-10 Thread Christian
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 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

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

2007-03-10 Thread Christian
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Dmitry Baikov schrieb: In addition to select() there's also clock_nanosleep(CLOCK_MONOTONIC, 0, tv, NULL), which in theory should give best resolution possible. To set realtime privileges, use (taken from jack): struct sched_param rtparam;

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

2007-03-10 Thread Dmitry Baikov
On 3/10/07, Christian [EMAIL PROTECTED] wrote: On the one hand this indicates the thread running stable in realtime but having a restriction to ~4ms/4000µs. Perhaps this is an in-system value 4ms means you have 250Hz kernel tick. Set it to 1024Hz or better try tickless setup. of sleep and the

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

2007-03-10 Thread Christian
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Dmitry Baikov schrieb: 4ms means you have 250Hz kernel tick. Set it to 1024Hz or better try tickless setup. /proc/asound/timers says: G0: system timer : 1000.000us (1000 ticks) G1: RTC timer : 976.562us (1 ticks) Seq24 for example is

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

2007-03-10 Thread Christian
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I'd suggest using clock_nanosleep() and clock_gettime() with clockid=CLOCK_MONOTONIC. This is the more right approach than select/gettimeofday(). Dmitry. Yeah clock_nanosleep did it! I got a stable absolute bpm exact midi clock. I'll test the