All of lore.kernel.org
 help / color / mirror / Atom feed
From: Clemens Ladisch <clemens@ladisch.de>
To: alsa-devel@alsa-project.org
Subject: Re: how to handle buffer underrun in a softsynth
Date: Tue, 29 Nov 2011 11:46:38 +0100	[thread overview]
Message-ID: <4ED4B80E.3050106@ladisch.de> (raw)
In-Reply-To: <alpine.DEB.2.00.1111290913010.27304@anubis.informatik.uni-halle.de>

Henning Thielemann wrote:
> I must somehow map timestamps of ALSA sequencer events to sample
> counts in order to let notes start within a sample block. JACK claims
> to synchronize everything and it runs on top of ALSA - how does it
> manage synchronization between MIDI and PCM?

It takes timestamps whenever ALSA reports a period boundary.  (This
requires that the code doesn't run too late, i.e., that underruns do
not happen.)  There may be some DLL to smooth out the measurements.

The timestamps can be made more reliable by using a recent enough kernel
and alsa-lib, and enabling timestamps for PCM pointer updates with
snd_pcm_sw_params_set_tstamp_mode(); then snd_pcm_status() will return
both the buffer position and the corresponding timestamp.

> How can I detect a buffer underrun when I disabled underrun detection?

The avail value is larger than the buffer size.


Regards,
Clemens

      reply	other threads:[~2011-11-29 10:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-28 16:06 how to handle buffer underrun in a softsynth Henning Thielemann
2011-11-28 20:16 ` Clemens Ladisch
2011-11-29  8:39   ` Henning Thielemann
2011-11-29 10:46     ` Clemens Ladisch [this message]

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=4ED4B80E.3050106@ladisch.de \
    --to=clemens@ladisch.de \
    --cc=alsa-devel@alsa-project.org \
    /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.