All of lore.kernel.org
 help / color / mirror / Atom feed
* how many processed frames? + various thoughts
@ 2010-09-30 18:49 John John
  2010-10-01  7:03 ` Clemens Ladisch
  0 siblings, 1 reply; 2+ messages in thread
From: John John @ 2010-09-30 18:49 UTC (permalink / raw)
  To: alsa-devel


Hello all,
I'm rather new to ALSA development. I would like to build a little loop-player driven by a beat counter 
and a good mail exchange from linuxaudio.org gave me a smart solution: to count the beat bars into the 
audio thread. Knowing the sample rate and the processed samples, I'm able to calculate the clock (what do you 
think about this approach?). And now my question: is there a good function into alsa API which returns 
the number of processed frames? Or even better, is it possibile to fire a callback after N frames?
Thank you in advance (and sorry for my English)!

JJ
 		 	   		  

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

* Re: how many processed frames? + various thoughts
  2010-09-30 18:49 how many processed frames? + various thoughts John John
@ 2010-10-01  7:03 ` Clemens Ladisch
  0 siblings, 0 replies; 2+ messages in thread
From: Clemens Ladisch @ 2010-10-01  7:03 UTC (permalink / raw)
  To: John John; +Cc: alsa-devel

John John wrote:
> Knowing the sample rate and the processed samples, I'm able to
> calculate the clock (what do you think about this approach?).

The sound card's clock will not be exactly synchronous with the
computer's clock.

> is there a good function into alsa API which returns the number of
> processed frames?

snd_pcm_writei() does return the number of processed frames.

snd_pcm_delay() returns the offset to the position of the sample that is
currently being played.


Regards,
Clemens

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

end of thread, other threads:[~2010-10-01  7:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-30 18:49 how many processed frames? + various thoughts John John
2010-10-01  7:03 ` Clemens Ladisch

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.