Date: | 2017-08-27 |
---|
This library is under development. Do not expect any stability. The API (Application Programming Interface) may change at any time.
Here is a simple setup, for more details read
Documentation/how_to_use.rst
.
- Set flags, card, device, format, channels, rate and
period_size in
struct snd_config
.
- flags: SND_INPUT or SND_OUTPUT.
- card and device: Usually both are set to zero. See
/dev/snd/
directory. - format: Defines the sample resolution. SND_FORMAT_S16_LE
is the most common. See
snd_parameters.h
for more. - channels: one (mono), two (stereo).
- rate: frames per second. 44100 is the most common.
- period_size: size of a period. This defines the latency.
- Call
snd_open((struct snd*), (struct snd_config*))
. - Call
snd_start((struct snd*))
. - Poll in
fd
file descriptor ofstruct snd
. - On wake up, use
snd_write()
and writeperiod_size
frames. - When done, call
snd_close()
.
If you think something can be improved or added in the
documentation please let me know by sending an email
to pasqualirb at gmail dot com
or by creating an issue
in GitHub.
sound_setup.c
: open/close device, set hardware/software parameters, mmap/munmap areas.sound_operations.c
: synchronize, start, stop sound device.sound_transfer.c
: transfer helpers.sound_parameters.c
: helpers to obtain the allowed values for hardware parameters. It's actually wrappers to a few functions fromhardware_parameters.c
.hardware_parameters.c
: manipulate hardware parameters (bit masking, conversions, etc).sound_global.h
: global header file. Contains sound structures and macros.
See tools/
directory.
sound_device_info.c
: print information about sound device.waveplay.c
: play .wav files, test timer_wakeup, deadline_wakeup and mix_utility.timer_wakeup.c
: helpers for application wake up using a system timer. ReadDocumentation/timer_wakeup.rst
.deadline_wakeup.c
: application wake up using SCHED_DEADLINE Linux scheduler. ReadDocumentation/timer_wakeup.rst
.mix_utility.c
: sound mixing helpers.