On Tue, 2013-04-09 at 21:59 +0200, Clemens Ladisch wrote:
> jon wrote:
> > I am reading the latency like this :
> >
> > int get_playback_latency_ms()
> > {
> > int framesleft;
> > int ms_in_buffer;
> > framesleft=snd_pcm_avail (playback_handle);
> > // How many samples behind is the player
> >
> > return( (framesleft*1000)/playback_sample_rate );
> > // frames to milliseconds
> > }
> >
> > If I increase the bufchunks value I seem to get larger latency
>
> Yes.
>
> > yet the latency values i'm reading always seem to be the same.
>
> Apparently, your program fills the buffer fast enough so that there
> are never too many frames available. I'd guess that if your program
> gets delayed more, by its own computations, by scheduling delays, or
> by increasing the period time, you would see higher values.
>
Thanks for the reply.
I'm not sure I understand that behaviour at all... I would expect ALSA
to keep the buffer as full as possible not as empty ?
If I set the buffer length to say 100ms does ALSA not maintain a 100ms
fill of the buffer only dropping if I don't send samples fast enough,
then re-filling when I do - that is the behaviour I want (and would
expect). What is the point in increasing the buffer size if ALSA claws
it back to a minimum the moment it has an excess of samples is
available !
I am trying to cope with frequent short freezes (30ms or so) making
buffer filling jittery. I want to maintain a cache of about 80ms between
the ALSA write and my ears, with ALSA using data from cache during the
slower iterations of the fill loop. How can I do this ?
Thanks,
Jon
------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
Alsa-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-user