[alsa-devel] Timing Info

Paul Dugas paul at dugasenterprises.com
Sat Jun 12 23:59:27 CEST 2010


On Fri, Jun 11, 2010 at 6:00 PM, Paul Dugas <paul at dugasenterprises.com> wrote:
> I'm using snd_pcm_readi() to collect samples and am wondering if/how I
> can get accurate timestamps for them.  Seems like the snd_pcm_status()
> gives me this info but I'm unclear on the specifics.  Can someone
> point me toward the correct field in the status structure that I
> should be using and what sample that timestamp corresponds to?
>
> Does snd_pcm_status_get_tstamp() get me the timestamp for the first
> frame returned by the next snd_pcm_readi() call?

I know now get_tstamp() isn't what I'm looking for after reading some
prior postings and other web sites.  Can't seem to find a discussion
of timing in the ALSA docs themselves.  Maybe I'm being dense.

Looks like some processing of the trigger timestamp is what I need but
I'm not following the logic of "triggers" in the simple use of
snd_pcm_readi() that I've got.  Before the first readi() call, the
trigger time is 0.  The second time, it's pretty close to the wall
time for the first call.  Perhaps that's the timestamp of the first
sample of the first period I read and I need to add the period_time
each time?  Seems like that'd accrue error when recording over longer
periods of time (which my application does).

What's the "timestamp mode".  Does it generate a timestamp each
period?  How would I access that timestamp?

Thanks in advance for any assistance,

Paul


More information about the Alsa-devel mailing list