Tutorials Multimedia in the Net
Winter Semester 2006/2007
Linux APIs: Sound
Debugging
Raphael Wimmer
<raphael.wimmer@medien.ifi.lmu.de>
What we will cover today
Introduction to Linux Sound APIs
Debugging:
strace
and
gdb
Exercise 4: 'Audio Player'
Linux Sound APIs
Kernel sound drivers
OSS
Old, deprecated Linux sound API
ALSA
Current Linux sound API
Sound servers
JACK (Jack Audio Connection Kit
High-End, MIMO sound server
aRTS (analog RealTime Synthesizer)
KDE sound daemon (to be discontinued in KDE 4)
ESD (Enlightenment Sound Daemon)
ALSA
kernel-level Linux sound driver and API
drivers in userspace
software mixing
PCM and MIDI I/O
multi-processor, thread-safe
ALSA API
interesting for us:
PCM (digital audio) interface
Setup hardware:
snd_pcm_hw_params()
Play audio:
snd_pcm_writei(), snd_pcm_writen()
Capture audio:
snd_pcm_readi(), snd_pcm_readn()
Different transfer methods:
standard I/O transfers (read() / write())
mmap'ed direct read/write
Debugging I:
strace
trace system calls and signals
useful for researching the reason of a segfault or failing hardware access
works with all ELF executables
run
strace (command) (parameters)
Debugging II:
gdb
help: man gdb, type "help" in gdb
compile in symbols:
gcc -g ...
execute:
gdb (filename)
run program:
run (arguments)
run program until start of main function:
start (arguments)
single-step:
step
get value of variable:
print (variable)
print value of variable every stop:
display (variable)