Hi,

At Thu, 11 Apr 2002 10:42:05 +0100,
Richard Bown wrote:
> 
> Hi.  Another simple one but another one I'm afraid I can't find an example for.
> 
> I'm writing and reading events from the same ALSA 0.9.0 port (on the same
> duplex handle) - I receive the events correctly through snd_seq_event_input
> but the timestamps are coming back as zero even when I've started a queue
> against that handle.  I presume I don't have to extract the timestamps from
> the queue itself?

you can let the sequencer-core update the timestamp of the event
automatically.
at the subscription, call snd_seq_port_subscribe_set_time_update().

a typical code would be like this:

        snd_seq_addr_t sender, dest;
        snd_seq_port_subscribe_t *subs;
        snd_seq_port_subscribe_alloca(&subs);

        // receive events from a specified port
        sender.client = source_client_id;
        sender.port = source_port_id;   
        dest.client = my_client_id;
        dest.port = my_port_id;

        // set up subscribe info
        snd_seq_port_subscribe_set_sender(subs, &sender_addr);
        snd_seq_port_subscribe_set_dest(subs, &dest_addr);
        // set the queue to be used for updating time-stamps
        snd_seq_port_subscribe_set_queue(subs, queue_used);
        // enable time-stamp-update mode
        snd_seq_port_subscribe_set_time_update(subs, 1);
        // if you want to get real-time (not tick), call the
        // following, too
        // snd_seq_port_subscribe_set_time_real(subs, 1);

        err = snd_seq_port_subscribe(handle, subs);
        ...

if you are using snd_seq_connect_to/from, then you need to replace
it like above.


Takashi

_______________________________________________
Alsa-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

Reply via email to