All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: alsa-devel@alsa-project.org
Subject: Re: Join play of pcm in multiple playback devices
Date: Tue, 03 Jan 2012 15:32:23 -0600	[thread overview]
Message-ID: <4F0373E7.2060807@linux.intel.com> (raw)
In-Reply-To: <4F029F10.7060704@sasken.com>

> while(1)
> {
>       retval=snd_pcm_readi(pAlsaConfig->pcm_handle, buffer,
> pAlsaConfig->alsaBufferSize);
>       snd_pcm_writei(pAlsaConfig->pcm_handle1, buffer,retval);
>       snd_pcm_writei(pAlsaConfig->pcm_handle2, buffer,retval);
> }

This code doesn't work in the general case where the different devices 
don't share a common audio clock and have different physical 
capture/playback rates. Compensating for clock drift requires the use of 
asynchronous sample-rate conversion.
Assuming you have a perfectly synchronous system, you could make use of 
snd_pcm_delay() to compensate for delays incurred in the 
driver/firmware/hardware. This is not well supported by all drivers though.
-Pierre

      reply	other threads:[~2012-01-03 21:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-03  6:24 Join play of pcm in multiple playback devices Irfan shaikh
2012-01-03 21:32 ` Pierre-Louis Bossart [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=4F0373E7.2060807@linux.intel.com \
    --to=pierre-louis.bossart@linux.intel.com \
    --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.