All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Juan Linietsky <coding@reduz.com.ar>
Cc: alsa-devel@alsa-project.org, Frank van de Pol <fvdpol@home.nl>
Subject: Re: Forcing an absolute timestamp for every midi event.
Date: Mon, 19 Aug 2002 17:47:09 +0200	[thread overview]
Message-ID: <s5h4rdqu9z6.wl@alsa2.suse.de> (raw)
In-Reply-To: <20020818191701.2d3f66ec.coding@reduz.com.ar>

At Sun, 18 Aug 2002 19:17:01 -0300,
Juan Linietsky wrote:
> 
> On Sun, 18 Aug 2002 14:48:49 +0200
> Frank van de Pol <fvdpol@home.nl> wrote:
> 
> > 
> > 
> > 
> > On Sun, Aug 18, 2002 at 05:57:40AM -0300, Juan Linietsky wrote:
> > > Hi! I wanted to ask, how about forcing
> > > an absolute timestamp for _every_ midi event?
> > 
> > It's not 100% clear to me wat you mean. When using the sequencer api
> > you already have a timestamp (either tick/clock) for every event
> > scheduled. Midi data captured from eg. the midi input port is
> > timestamped upon receive IRQ.
> 
> Well, thats what i thought too by watching the code, but I check any
> received
> event, from any source and all variables are all zero. Instead, alsa
> promises to deliver events at the right time, which is fine.. but not
> enough!
> 
> include/alsa/seq_event.h:row 421
> This is the struct of any event I receive when polling the device,
> on my sequencer client:
> 
> typedef struct snd_seq_event {
> [..] which includes...
>         snd_seq_timestamp_t time;
> [..]
> } snd_seq_event_t;
> 
> this struct has...
> 
> typedef union snd_seq_timestamp {
>         snd_seq_tick_time_t tick;       /**< tick-time */
>         struct snd_seq_real_time time;  /**< real-time */
> } snd_seq_timestamp_t;
> 
> To which i wonder.. first, why is this an union? why cant both be
> there?
 
because a tick time cannot be always mapped to the wallclock time.
the tempo can be changed at any time.

for incoming events, yes, both of them can be, though.
in such a case, you can connect twice the same route with different
flags (see below).


> well, anyway.. snd_seq_tick_time_t is an int,
> and snd_seq_real_time is:
> 
> typedef struct snd_seq_real_time {
>         unsigned int tv_sec;            /**< seconds */
>         unsigned int tv_nsec;           /**< nanoseconds */
> } snd_seq_real_time_t;
> 
> This should technically give me info about the absolute time in which
> the event has to be played,

yes.
but please note that the time is not system time but is a time of the
specified queue.

> basically what i need in order to do a certain amount of offline
> processing.
> This way, my softsynth wont need extremely low audio latency to play
> accurate timing.
> 
> But! All this struct is zeroed, _allways_ zeroed, no info is ever
> proovided to my sequencer client.
> I think this is either a design problem, or a serious bug in the api. 

the time-stamping on incoming events is enabled only "update_time"
flag is set at the subscription (connection), corresponding

void snd_seq_port_subscribe_set_time_update(snd_seq_port_subscribe_t *info, int val);
void snd_seq_port_subscribe_set_time_real(snd_seq_port_subscribe_t *info, int val);
void snd_seq_port_subscribe_set_queue(snd_seq_port_subscribe_t *info, int q);

the first two set "yes i'll update the timestamps of incoming events"
and "yes, i'll use the real (wallclock) time as timestamp values".
and the last one specifies the queue to be referred to.
if the queue is not running, the time is always same (if not started
at all, then is zero).


ciao,

Takashi


-------------------------------------------------------
This sf.net email is sponsored by: OSDN - Tired of that same old
cell phone?  Get a new here for FREE!
https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390

  reply	other threads:[~2002-08-19 15:47 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-18  8:57 Forcing an absolute timestamp for every midi event Juan Linietsky
2002-08-18 10:08 ` Patrick Shirkey
2002-08-18 12:48 ` Frank van de Pol
2002-08-18 22:17   ` Juan Linietsky
2002-08-19 15:47     ` Takashi Iwai [this message]
2002-08-18 20:12 ` Martijn Sipkema
2002-08-18 21:18   ` [linux-audio-dev] " Frank van de Pol
2002-08-19  6:43     ` Martijn Sipkema
2002-08-19  7:52       ` Jaroslav Kysela
2002-08-18 22:58   ` Juan Linietsky
2002-08-19  6:41     ` Martijn Sipkema
2002-08-19  8:07       ` Juan Linietsky
2002-08-19 12:39         ` Martijn Sipkema
2002-08-19 13:01           ` aside - alsa-docs Patrick Shirkey
2002-08-20 21:11           ` Forcing an absolute timestamp for every midi event Frank van de Pol
2002-08-21  1:10             ` Martijn Sipkema

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=s5h4rdqu9z6.wl@alsa2.suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=coding@reduz.com.ar \
    --cc=fvdpol@home.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.