* How to count PCM frames captured?
@ 2006-09-15 7:27 Agata Ma
2006-09-15 7:36 ` Clemens Ladisch
0 siblings, 1 reply; 3+ messages in thread
From: Agata Ma @ 2006-09-15 7:27 UTC (permalink / raw)
To: alsa-devel
Hi,
I'm new to ALSA programming so I hope you can excuse
me if I say
trivial things...
I have read various Alsa programming introduction
guides and
tutorial I found on Alsa-Project web site and
Googling...
http://www.suse.de/~mana/alsa090_howto.html
http://equalarea.com/paul/alsa-audio.html
http://www.linuxjournal.com/article/6735
My target is to build a simple C application to:
open interface to capture
set hardware parameters
while there is data to be processed:
read pcm data
count how many frames have been captured
write only 1 frame every 1000 frames captured into a
file
close interface
Reading the programming guides I understand I have to
think in term of
frames.
So, my question is: does exist an ALSA function to
count the PCM frames
captured and moved to buffer?
If I'm not wrong the buffer is divided in periods and
each period
contain a number of frames.
So, the hypothetical PCM_FRAME_COUNT_FUNCTION should
work before the
frames are passed to the buffer..M'I wrong?
If the hypothetical PCM_FRAMES_COUNT_FUNCTION does not
exist, does exist
an hypothetical PCM_PERIODS_COUNT_FUNCTION?
I would like to point out that in my situation is not
important to be
precise to record on a file a frame every 1000.
The number 1000 is the lower threshold, so if the
program record on the
file a frame every 1023 or 10xx is not relevant to me.
I could work with a PCM_PERIODS_COUNT_FUNCTION if it
exist!
Can you suggest me some ideas and why not..if you
can..examples...
Thanks for your time and help
a newbie, Agata
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: How to count PCM frames captured?
2006-09-15 7:27 How to count PCM frames captured? Agata Ma
@ 2006-09-15 7:36 ` Clemens Ladisch
0 siblings, 0 replies; 3+ messages in thread
From: Clemens Ladisch @ 2006-09-15 7:36 UTC (permalink / raw)
To: Agata Ma, alsa-devel
Agata Ma wrote:
> So, my question is: does exist an ALSA function to count the PCM
> frames captured and moved to buffer?
The function snd_pcm_avail_update() returns how many frames are
available in the device's buffer.
The function snd_pcm_readi() returns how many frames it has copied to
your buffer.
HTH
Clemens
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: How to count PCM frames captured?
@ 2006-09-16 8:57 Agata Ma
0 siblings, 0 replies; 3+ messages in thread
From: Agata Ma @ 2006-09-16 8:57 UTC (permalink / raw)
To: alsa-devel
Clemens Ladisch wrote:
> Agata Ma wrote:
>> So, my question is: does exist an ALSA function to
count the PCM
>> frames captured and moved to buffer?
>
> The function snd_pcm_avail_update() returns how many
frames are
> available in the device's buffer.
>
> The function snd_pcm_readi() returns how many frames
it has copied to
> your buffer.
>
>
> HTH
> Clemens
>
>
Hi Clemens,
Thanks for your suggestion, I have wrote a simple C
code using
snd_pcm_readi() and it work..I can count the frames..
Now, a new "problem" arise...but I'm going to open a
new thread to be
more precise.
Thanks
Agata
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-09-16 8:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-15 7:27 How to count PCM frames captured? Agata Ma
2006-09-15 7:36 ` Clemens Ladisch
-- strict thread matches above, loose matches on Subject: below --
2006-09-16 8:57 Agata Ma
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.