@@ -96,7 +96,7 @@ standard C open function - see 'man 2 open'). In non-blocked behaviour,
96
96
these I/O functions never stops, they return -EAGAIN error code, when no
97
97
data can be transferred (the ring buffer is full in our case). In blocked
98
98
behaviour, these I/O functions stop and wait until there is a room in the
99
- ring buffer (playback) or until there are a new samples (capture). The ALSA
99
+ ring buffer (playback) or until there are new samples (capture). The ALSA
100
100
implementation can be found in the \ref alsa_pcm_rw section.
101
101
102
102
\subsection pcm_transfer_event Event waiting routines
@@ -351,9 +351,9 @@ enumeration.
351
351
These parameters - #snd_pcm_sw_params_t can be modified at
352
352
any time including the running state.
353
353
354
- \par Minimum available count of samples
354
+ \par Minimum available count of frames
355
355
356
- This parameter controls the wakeup point. If the count of available samples
356
+ This parameter controls the wakeup point. If the count of available frames
357
357
is equal or greater than this value, then application will be activated.
358
358
359
359
\par Timestamp mode
@@ -372,49 +372,49 @@ is ignored by device. Usually, this value is set to one (no align).
372
372
\par Start threshold
373
373
374
374
The start threshold parameter is used to determine the start point in
375
- stream. For playback, if samples in ring buffer is equal or greater than
376
- the start threshold parameters and the stream is not running, the stream will
377
- be started automatically from the device. For capture, if the application wants
378
- to read count of samples equal or greater then the stream will be started.
379
- If you want to use explicit start (#snd_pcm_start), you can
380
- set this value greater than ring buffer size (in samples), but use the
381
- constant LONG_MAX or the boundary value is not a bad idea.
375
+ stream. For playback, if the frame count in the ring buffer is equal or greater
376
+ than the start threshold parameter and the stream is not running, the stream
377
+ will be started automatically from the device. For capture, if the application
378
+ wants to read count of frames equal or greater then the stream will be started.
379
+ If you want to use explicit start (#snd_pcm_start), you can set this value
380
+ greater than the ring buffer size (in frames). For that simply using a large
381
+ constant such as LONG_MAX or the boundary value is not a bad idea.
382
382
383
383
\par Stop threshold
384
384
385
385
Similarly, the stop threshold parameter is used to automatically stop
386
- the running stream, when the available samples crosses this boundary.
386
+ the running stream, when the available frames crosses this boundary.
387
387
It means, for playback, the empty samples in ring buffer and for capture,
388
388
the filled (used) samples in ring buffer.
389
389
390
390
\par Silence threshold
391
391
392
- The silence threshold specifies count of samples filled with silence
393
- ahead of the current application pointer for playback. It is usable
394
- for applications when an overrun is possible (like tasks depending on
395
- network I/O etc.). If application wants to manage the ahead samples itself,
396
- the #snd_pcm_rewind() function allows to forget the last
397
- samples in the stream.
392
+ The silence threshold specifies the count of frames before an underrun when the
393
+ buffer gets filled with frames of silence according to the silence size parameter
394
+ ahead of the current application pointer for playback. It is usable for applications
395
+ when an underrun is possible (like tasks depending on network I/O etc.). If
396
+ application wants to manage the ahead samples itself, the #snd_pcm_rewind() function
397
+ allows to forget the last samples in the stream.
398
398
399
399
\section pcm_status Obtaining stream status
400
400
401
401
The stream status is stored in #snd_pcm_status_t structure.
402
402
These parameters can be obtained: the current stream state -
403
403
#snd_pcm_status_get_state(), timestamp of trigger -
404
404
#snd_pcm_status_get_trigger_tstamp(), timestamp of last
405
- pointer update #snd_pcm_status_get_tstamp(), delay in samples -
406
- #snd_pcm_status_get_delay(), available count in samples -
407
- #snd_pcm_status_get_avail(), maximum available samples -
405
+ pointer update #snd_pcm_status_get_tstamp(), delay in frames -
406
+ #snd_pcm_status_get_delay(), available count in frames -
407
+ #snd_pcm_status_get_avail(), maximum available frames -
408
408
#snd_pcm_status_get_avail_max(), ADC over-range count in
409
- samples - #snd_pcm_status_get_overrange(). The last two
409
+ frames - #snd_pcm_status_get_overrange(). The last two
410
410
parameters - avail_max and overrange are reset to zero after the status
411
411
call.
412
412
413
413
\subsection pcm_status_fast Obtaining stream state fast and update r/w pointer
414
414
415
415
<p>
416
416
The function #snd_pcm_avail_update() updates the current
417
- available count of samples for writing (playback) or filled samples for
417
+ available count of frames for writing (playback) or filled frames for
418
418
reading (capture). This call is mandatory for updating actual r/w pointer.
419
419
Using standalone, it is a light method to obtain current stream position,
420
420
because it does not require the user <-> kernel context switch, but the value
@@ -427,10 +427,10 @@ The function #snd_pcm_avail() reads the current hardware pointer
427
427
in the ring buffer from hardware and calls #snd_pcm_avail_update() then.
428
428
</p>
429
429
<p>
430
- The function #snd_pcm_delay() returns the delay in samples .
431
- For playback, it means count of samples in the ring buffer before
432
- the next sample will be sent to DAC. For capture, it means count of samples
433
- in the ring buffer before the next sample will be captured from ADC. It works
430
+ The function #snd_pcm_delay() returns the delay in frames .
431
+ For playback, it means count of frames in the ring buffer before
432
+ the next frames will be sent to DAC. For capture, it means count of frames
433
+ in the ring buffer before the next frames will be captured from ADC. It works
434
434
only when the stream is in the running or draining (playback only) state.
435
435
Note that this function does not update the current r/w pointer for applications,
436
436
so the function #snd_pcm_avail_update() must be called afterwards
0 commit comments