The best way to learn code is to work on it. I did just that implementing a feature to add tsched buffer size to the configuration file. Late in the process, I discovered that it was already possible to pass it to the ALSA module, so I abandoned the additional code. Since it stumped me, I figured the configuration of PulseAudio might be somewhat confusing and could use a blog entry, hence this.
First, if you have not yet read PerfectSetup, start with that. You can find it here: http://www.pulseaudio.org/wiki/PerfectSetup
There are 3 places to change the configuration parameters and behavior of PulseAudio.
system.pa/default.pa – startup script to specify module loading, etc, module parameters are passed here, more on that later
client.conf – does just what is says, config file for clients
daemon.conf – configuration specific to the sound server daemon
On Ubuntu, these files are installed in /etc/pulse. The system.pa startup script is used when PulseAudio is used in system-wide mode. The other, daemon.conf is used when the sound server is started in user mode.
The values listed in these files are default values and are commented out. Obviously, uncommenting the parameter will not change anything unless the assignment is value changed.
The startup script can be used to pass module specific parameters. This is done by uncommenting the line in the file. For example, passing a new tsched buffer size to the ALSA module would look like this:
load-module module-alsa-sink tsched_buffer_size=XYZ
Here are all the module specific parameters for the ALSA module (from module-alsa-card.c) :
“name=<name for the card/sink/source, to be prefixed> ”
“card_name=<name for the card> ”
“card_properties=<properties for the card> ”
“sink_name=<name for the sink> ”
“sink_properties=<properties for the sink> ”
“source_name=<name for the source> ”
“source_properties=<properties for the source> ”
“namereg_fail=<pa_namereg_register() fail parameter value> ”
“device_id=<ALSA card index> ”
“format=<sample format> ”
“rate=<sample rate> ”
“fragments=<number of fragments> ”
“fragment_size=<fragment size> ”
“mmap=<enable memory mapping?> ”
“tsched=<enable system timer based scheduling mode?> ”
“tsched_buffer_size=<buffer size when using timer based scheduling> ”
“tsched_buffer_watermark=<lower fill watermark> ”
“profile=<profile name> ”
“ignore_dB=<ignore dB information from the device?> ”
“sync_volume=<syncronize sw and hw voluchanges in IO-thread?> ”
“profile_set=<profile set configuration file> “