[pulseaudio-discuss] Querying the number of samples played
ossman at cendio.se
Tue Feb 13 23:50:33 PST 2007
Kevin Mescher wrote:
> Thanks for the quick response. PulseAudio looks like a very robust API,
> the cross-platform nature makes my job MUCH easier.
Np. You shouldn't top post though, terribly annoying.
> I'm going to do a sanity check on my thinking here:
> Where each frame is a single sample from one or more channels:
> The number of "samples" (in this case, frames) = pa_get_stream_time(...) *
> sampling_rate / 1000000
Yes, but with the slight error that you do not use the return value from
pa_get_stream_time(). (you use r_usec).
> Should I use PA_STREAM_INTERPOLATE_TIMING and PA_STREAM_AUTO_TIMING_UPDATE
> to save on network traffic?
They are usually a good idea if you want stable latency values.
> For later development, I'd like to change the model to this:
> In the playback procedure, run pa_mainloop_iterate, and use a
> pa_stream_write callback to set the "needs more data" flag, rather than
> using a sample count method. If the flag is set, send more data, and
> the waveform marker.
> When loading data, I would send (325 + msec_latency) msec worth of
> data. Or
> is there a way to calculate the optimum chunk size to send?
I'd suggest using a pull model. You tell pulse to use a buffer size of
325 ms, then give it as much data as it asks for (via the callbacks).
Pierre Ossman OpenSource-based Thin Client Technology
System Developer Telephone: +46-13-21 46 00
Cendio AB Web: http://www.cendio.com
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 251 bytes
Desc: OpenPGP digital signature
More information about the pulseaudio-discuss