[alsa-devel] incoming sequencer event timestamping (via a running queue): how?

Clemens Ladisch clemens at ladisch.de
Tue Apr 12 07:49:26 CEST 2011

r10kindsofpeople wrote:
> On Mon, Apr 11, 2011 at 2:01 PM, R. Dresens <chromisx at nedlinux.nl> wrote:
> > At this moment, I just sample the tick value manually when I get an
> > event. That kinda works, but chances are high that the kernel
> > sequencer system can do that for me with more accuracy?
> In your function that does the connection to the reception port...
> snd_seq_port_subscribe_set_queue(subs, queue_id);  //<< queue_id being the one you allocated
> snd_seq_port_subscribe_set_time_update(subs, 1);
> snd_seq_subscribe_port(pSeq, subs);

This is the correct way to get timestamps on events that go through
a subscription.

Alternatively, you can get timestamps on events that arrive at a port:
  snd_seq_port_info_set_timestamping(pinfo, 1);
  snd_seq_port_info_set_timestamp_queue(pinfo, queue);
  snd_seq_create_port(pSeq, pinfo);


More information about the Alsa-devel mailing list