[pulseaudio-discuss] [PATCH 0/5] HW and SW volume syncronization in IO-thread

oku at iki.fi oku at iki.fi
Wed Oct 13 09:40:17 PDT 2010


From: Jyri Sarha <jyri.sarha at nokia.com>

The first patch in the set gives sink implementor a possibility to
synchronize HW and SW volume usage in IO-thread. The remaining patches
implement the synchronization for the alsa-sink and add the necessary
module parameters and defaults for them in daemon configuration.

This code has been tested on Nokia's ARM based Meego platform, on i686
laptop and on amd64 desktop. Tanu Kaskinen has also reviewed the code.

To check what this set of patches does, please try following:

1. play white noise in background on low volume:
# pacat --fix-rate --volume=10000 < /dev/urandom

2. play a short transient stream with high volume while the noise
   plays in background:
# dd if=/dev/zero count=200 | pacat --fix-rate --volume=65536

Without these patches on most hardware you hear an annoying snap
either in the beginning or the end (sometimes both) of the transient
stream. After applying the patch the snap should be gone or at least
less audible. With a little fiddling of the parameters it should be
possible to get rid of the snap on all hardware. The default
parameters work well at least on my Lenovo T60 running Debian Squeeze
and they should be good, maybe a bit conservative, for most HW out
there.

This patch is pretty much mandatory for proper usage of flat volume
especially on less powerful HW.

Cheers,
  Jyri

ps. This is my second attempt to try to get this functionality
in. This second version the patches is improved from the earlier and
there is no need locks anymore. I can't think of any more improvements
to it, so please let me know if I should still do something to get
this integrated.

Jyri Sarha (5):
  core: Add infrastructure for synchronizing HW and SW volume changes
  alsa: Take syncronized HW volume infra into use for alsa-sink
  udev-detect: Add sync_volume parameter
  daemon-conf: Add sync volume parameters to daemon-conf
  man: sync_volume parameters to manual page

 man/pulse-daemon.conf.5.xml.in      |   26 ++++
 src/daemon/daemon-conf.c            |    9 +
 src/daemon/daemon-conf.h            |    5 +-
 src/daemon/daemon.conf.in           |    4 +
 src/daemon/main.c                   |    3 +
 src/modules/alsa/alsa-mixer.c       |  117 ++++++++++++++-
 src/modules/alsa/alsa-mixer.h       |    9 +-
 src/modules/alsa/alsa-sink.c        |  128 ++++++++++++++--
 src/modules/alsa/alsa-source.c      |    2 +-
 src/modules/alsa/module-alsa-card.c |    4 +-
 src/modules/alsa/module-alsa-sink.c |   10 +-
 src/modules/module-udev-detect.c    |   18 ++-
 src/pulse/def.h                     |    7 +-
 src/pulsecore/core.c                |    4 +
 src/pulsecore/core.h                |    3 +
 src/pulsecore/sink.c                |  281 +++++++++++++++++++++++++++++++++--
 src/pulsecore/sink.h                |   97 ++++++++++--
 17 files changed, 672 insertions(+), 55 deletions(-)



More information about the pulseaudio-discuss mailing list