All of lore.kernel.org
 help / color / mirror / Atom feed
* Playback and capture synchronization
@ 2011-11-09  2:19 Patrick Lai
  2011-11-09 11:55 ` Clemens Ladisch
  0 siblings, 1 reply; 5+ messages in thread
From: Patrick Lai @ 2011-11-09  2:19 UTC (permalink / raw)
  To: alsa-devel; +Cc: Mark Brown

Hi,

I have a use case requiring playback and capture starting at the same
time. Latency between starting of playback and capture streams need to
be less than few PCM samples. Base on my understanding on ALSA which
does not have the concept of grouping multiple streams, the best I can
do is getting playback and capture to prepared state then trigger start
two streams one after the other. Then, the latency would be the time
for trigger start of first stream to complete. Is there a better way to
deal with my use case from ALSA API standpoint?

Thanks
Patrick

----
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Playback and capture synchronization
  2011-11-09  2:19 Playback and capture synchronization Patrick Lai
@ 2011-11-09 11:55 ` Clemens Ladisch
  2011-11-09 18:38   ` Patrick Lai
  0 siblings, 1 reply; 5+ messages in thread
From: Clemens Ladisch @ 2011-11-09 11:55 UTC (permalink / raw)
  To: Patrick Lai; +Cc: alsa-devel, Mark Brown

Patrick Lai wrote:
> I have a use case requiring playback and capture starting at the same
> time. Latency between starting of playback and capture streams need to
> be less than few PCM samples. Base on my understanding on ALSA which
> does not have the concept of grouping multiple streams,

snd_pcm_link()

> the best I can do is getting playback and capture to prepared state
> then trigger start two streams one after the other. Then, the latency
> would be the time for trigger start of first stream to complete.

If the driver doesn't actually implement starting of linked streams
(which would be pointless if the hardware doesn't support it), ALSA
calls the second trigger callback after the first one.

It might be possible to implement simultaneous starting of two streams.
What hardware (driver) are you using?


Regards,
Clemens

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Playback and capture synchronization
  2011-11-09 11:55 ` Clemens Ladisch
@ 2011-11-09 18:38   ` Patrick Lai
  2011-11-09 22:36     ` Eliot Blennerhassett
  0 siblings, 1 reply; 5+ messages in thread
From: Patrick Lai @ 2011-11-09 18:38 UTC (permalink / raw)
  To: Clemens Ladisch; +Cc: alsa-devel, Mark Brown

On 11/9/2011 3:55 AM, Clemens Ladisch wrote:
> Patrick Lai wrote:
>> I have a use case requiring playback and capture starting at the same
>> time. Latency between starting of playback and capture streams need to
>> be less than few PCM samples. Base on my understanding on ALSA which
>> does not have the concept of grouping multiple streams,
>
> snd_pcm_link()
Awesome! I will look into this API

> If the driver doesn't actually implement starting of linked streams
> (which would be pointless if the hardware doesn't support it), ALSA
> calls the second trigger callback after the first one.
>
> It might be possible to implement simultaneous starting of two streams.
> What hardware (driver) are you using?
It's Qualcomm hardware. As far as I know, HW has this synchronization 
support but I would have to build driver to make use of this functionality

Thanks very much for the feedback

>
>
> Regards,
> Clemens
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel


-- 
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Playback and capture synchronization
  2011-11-09 18:38   ` Patrick Lai
@ 2011-11-09 22:36     ` Eliot Blennerhassett
  0 siblings, 0 replies; 5+ messages in thread
From: Eliot Blennerhassett @ 2011-11-09 22:36 UTC (permalink / raw)
  To: Patrick Lai; +Cc: alsa-devel

On 10/11/11 07:38, Patrick Lai wrote:
> It's Qualcomm hardware. As far as I know, HW has this synchronization 
> support but I would have to build driver to make use of this functionality

To see examples of drivers that support HW linking, search for
snd_pcm_group_for_each_entry

-- 
Eliot Blennerhassett
AudioScience Inc.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Playback and capture synchronization
       [not found] <mailman.1622.1320881582.2097.alsa-devel@alsa-project.org>
@ 2011-11-10 14:57 ` anish kumar
  0 siblings, 0 replies; 5+ messages in thread
From: anish kumar @ 2011-11-10 14:57 UTC (permalink / raw)
  To: plai; +Cc: linux, alsa-devel, broonie, clemens


> > Patrick Lai wrote:
> >> I have a use case requiring playback and capture starting at the same
> >> time. Latency between starting of playback and capture streams need to
> >> be less than few PCM samples. Base on my understanding on ALSA which
> >> does not have the concept of grouping multiple streams,

Is this use case for loopback?Right now i am doing loopback with two
terminals with one terminal running aplay and other arecord and before
running aplay and arecord we use couple of mixer controls to set the
paths but we want to do all this from user space i.e. ALSA UCM(use case
manager) & Android Audio Flinger.We are not using snd-aloop for
loopback.
After reading this thread looks like I need to implement support in
driver to trigger playback and capture at the same time using the api's
mentioned in this thread.
Is my understanding correct?Or am I completely off track here?
Kernel used is:3.0 

> > snd_pcm_link()
> Awesome! I will look into this API
> 
> > If the driver doesn't actually implement starting of linked streams
> > (which would be pointless if the hardware doesn't support it), ALSA
> > calls the second trigger callback after the first one.
> >
> > It might be possible to implement simultaneous starting of two streams.
> > What hardware (driver) are you using?
> It's Qualcomm hardware. As far as I know, HW has this synchronization 
> support but I would have to build driver to make use of this functionality

> To see examples of drivers that support HW linking, search for
> snd_pcm_group_for_each_entry

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-11-10 14:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-09  2:19 Playback and capture synchronization Patrick Lai
2011-11-09 11:55 ` Clemens Ladisch
2011-11-09 18:38   ` Patrick Lai
2011-11-09 22:36     ` Eliot Blennerhassett
     [not found] <mailman.1622.1320881582.2097.alsa-devel@alsa-project.org>
2011-11-10 14:57 ` anish kumar

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.