[linux-audio-dev] Re: [Alsa-devel] alsaseq reorders my events

From: Rui Nuno Capela <rncbc@email-addr-hidden>
Date: Thu Mar 01 2007 - 18:51:48 EET

On Thu, March 1, 2007 13:35, Dmitry Baikov wrote:
> Hi!
>
>
> I nearly finished alsaseq driver for jackmidi, but have a problem.
> Alsaseq reorders events in fast sequences, so note-on/note-off pairs got
> mixed.
>
> The algorithm of sending is simple:
>
>
> snd_seq_ev_schedule_real(&alsa_event, output_que, 1, &timestamp);
> frame_time = jack_frame_time(self->jack); frame_offset = event.time -
> frame_time;
>
> offset = ((long long)frame_offset) * 1000000000 / rate; timestamp.tv_sec =
> (long) (offset / 1000000000);
> timestamp.tv_nsec = (long) (offset % 1000000000);
> snd_seq_event_output(self->seq, &alsa_event);
>
>

Is the snd_seq_ev_schedule_real correct where it is? Or should you call
_after_ you set the intended timestamp, like this:

  frame_time = jack_frame_time(self->jack);
  frame_offset = event.time - frame_time;

  offset = ((long long)frame_offset) * 1000000000 / rate;
  timestamp.tv_sec = (long) (offset / 1000000000);
  timestamp.tv_nsec = (long) (offset % 1000000000);

  snd_seq_ev_schedule_real(&alsa_event, output_que, 1, &timestamp);

  snd_seq_event_output(self->seq, &alsa_event);

Cheers.

-- 
rncbc aka Rui Nuno Capela
rncbc@email-addr-hidden
Received on Thu Mar 1 20:15:06 2007

This archive was generated by hypermail 2.1.8 : Thu Mar 01 2007 - 20:15:06 EET