c - Correctly sizing Alsa buffers, weird API -
I am currently working on a project for which I have to do some sample with Alsa. I am trying to configure, but how am I determining my reading size correctly?
There are two priorities which are interesting to my work:
The name of the first one tells that the output will be a period of time for a sample period, although it is weird: If I am setting sample rate on F = 44100Hz
should be in the sample duration (in nanosecond) T0 = 1e 9/44100 ~ = 22676 ns
while the function answers T1 = 725 us = 725000 ns
. In the meantime, even I have been asked to use non-locking primitives, even if I am trying to lock the 'readi' time profile, and this It is known that for the sample T2 = 8028603 ns
in the worst case and T3 = 12436217 ns
in the worst case.
In the end, I do not know what it means to the following two:
snd_pcm_hw_par Ams_get_buffer_time snd_pcm_hw_params_get_period_size
I buffer in time and How to measure the duration of the shape, however, returns the same value as get_buffer_size
, while the latter returns any value like get_period_time
.
Any hint?
- Frames: Samples x channels (ie: stereo frames made of two samples Mono Frame is composed of 1 sample, ...)
- Duration: The number of samples that are transmitted, after which the device accepts transfer to application (usually through a barrier).
* _size function returns the frames in the frame.
HH
Comments
Post a Comment