Added examples (test/pcm.c and test/latency.c)

This commit is contained in:
Jaroslav Kysela 2001-10-18 19:35:56 +00:00
parent 78f86ed011
commit 791ee4298e
2 changed files with 36 additions and 2 deletions

View file

@ -21,7 +21,7 @@ EXCLUDE = ../src/control/control_local.h \
../src/seq/seq_local.h ../src/seq/seq_local.h
RECURSIVE = YES RECURSIVE = YES
FILE_PATTERNS = *.c *.h FILE_PATTERNS = *.c *.h
#EXAMPLE_PATH = example_test.cpp EXAMPLE_PATH = ../test/pcm.c ../test/latency.c
QUIET = YES QUIET = YES
EXTRACT_ALL = NO EXTRACT_ALL = NO

View file

@ -197,7 +197,8 @@ returns 24 in the case.
There are two methods to transfer samples in application. The first method There are two methods to transfer samples in application. The first method
is the standard read / write one. The second method, uses the direct audio is the standard read / write one. The second method, uses the direct audio
buffer to communicate with the device while ALSA library manages this space buffer to communicate with the device while ALSA library manages this space
itself. itself. You can find example of all communication schemes for playback
in \ref example_test_pcm "Sine-wave generator example".
\subsection alsa_pcm_rw Read / Write transfer \subsection alsa_pcm_rw Read / Write transfer
@ -222,4 +223,37 @@ to allow the ALSA library update the pointers to ring buffer. This sort of
communication is also called "zero-copy", because the device does not require communication is also called "zero-copy", because the device does not require
to copy the samples from application to another place in system memory. to copy the samples from application to another place in system memory.
\par
If you like to use the compatibility functions in mmap mode, there are
read / write routines equaling to standard read / write transfers. Using
these functions discards the benefits of direct access to memory region.
See the \link ::snd_pcm_mmap_readi() \endlink,
\link ::snd_pcm_writei() \endlink, \link ::snd_pcm_readn() \endlink
and \link ::snd_pcm_writen() \endlink functions.
\section pcm_examples Examples
The full featured examples with cross-links:
\par Sine-wave generator
\ref example_test_pcm "example code"
\par
This example shows various transfer methods for the playback direction.
\par Latency measuring tool
\ref example_test_latency "example code"
\par
This example shows the measuring of minimal latency between capture and
playback devices.
*/ */
/**
* \example ../test/pcm.c
* \anchor example_test_pcm
*/
/**
* \example ../test/latency.c
* \anchor example_test_latency
*/