On Fri, 12 Sep 2003 16:51:26 +0200 (METDST), Clemens Ladisch <[EMAIL PROTECTED]> wrote:

Arve Knudsen wrote:
I did a little test where I set start threshold to buffer size,
acquire memory using snd_pcm_mmap_begin (number of returned frames
equals buffer size), fill the buffer and do a snd_pcm_mmap_commit.
After the commit I check the state of the card, which is
SND_PCM_STATE_PREPARED (a started pcm would be in the running
state?).

In theory, what you do sounds correct. (I assume you've used frames, not bytes, for the start threshold.)

Maybe you want to compare your code with aplay.c, which uses start
threshold, too. (It calls snd_pcm_mmap_writei, which calls
snd_pcm_write_areas, which calls snd_pcm_mmap_write_areas (defined in
alsa-lib/src/pcm/pcm_mmap.c), which calls snd_pcm_mmap_begin and
snd_pcm_mmap_commit.

Back to my original goal: I did an explicit start of the pcm after filling
the buffer, but the output still sounds muted for some reason. If I start
the pcm *before* writing to the buffer however (like I normally would),
the output is like expected. Any idea what causes this initial muting of
the output?

In theory, starting the pcm with an empty buffer causes an underrun to occur immediately.

If I understand you correctly, the first buffer of audio data is
replaced by silence. Maybe you've set a silence threshold?

Maybe I should rephrase my question, now that I've got some time to think about it. Exactly what gets started when the start threshold is reached, the transfer of frames to the audio card (assuming we're writing frames)? Obviously it doesn't affect the state of the pcm, like snd_pcm_start does (SND_PCM_STATE_RUNNING). Basically, before I've just used 0 as the start threshold and filled the buffer with zeros prior to starting the pcm. It seems to me a start threshold equal to buffer size would mean no transfer of data goes on before the buffer is filled? If this is correct, what would it mean in the case of capture (reading frames from the card).


Again thanks

Arve Knudsen


------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Alsa-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/alsa-devel

Reply via email to