pulseaudio/src/pulse
Tanu Kaskinen c9c88fb8dc Implement the "volume sharing" feature.
When we have a filter sink that does some processing, currently the
benefits of the flat volume feature are not really available. That's
because if you have a music player that is connected to the filter sink,
the hardware sink doesn't have any idea of the music player's stream
volume.

This problem is solved by this "volume sharing" feature. The volume
sharing feature works so that the filter sinks that want to avoid the
previously described problem declare that they don't want to have
independent volume, but they follow the master sink volume instead.
The PA_SINK_SHARE_VOLUME_WITH_MASTER sink flag is used for that
declaration. Then the volume logic is changed so that the hardware
sink calculates its real volume using also the streams connected to the
filter sink in addition to the streams that are connected directly to
the hardware sink. Basically we're trying to create an illusion that
from volume point of view all streams are connected directly to the
hardware sink.

For that illusion to work, the volumes of the filter sinks and their
virtual streams have to be managed carefully according to a set of
rules:

If a filter sink follows the hardware sink volume, then the filter sink's
 * reference_volume always equals the hw sink's reference_volume
 * real_volume always equals the hw sink's real_volume
 * soft_volume is always 0dB (ie. no soft volume)

If a filter sink doesn't follow the hardware sink volume, then the filter
sink's
 * reference_volume can be whatever (completely independent from the hw sink)
 * real_volume always equals reference_volume
 * soft_volume always equals real_volume (and reference_volume)

If a filter sink follows the hardware sink volume, and the hardware sink
supports flat volume, then the filter sink's virtual stream's
 * volume always equals the hw sink's real_volume
 * reference_ratio is calculated normally from the stream volume and the hw
   sink's reference_volume
 * real_ratio always equals 0dB (follows from the first point)
 * soft_volume always equals volume_factor (follows from the previous point)

If a filter sink follows the hardware sink volume, and the hardware sink
doesn't support flat volume, then the filter sink's virtual stream's
 * volume is always 0dB
 * reference_ratio is always 0dB
 * real_ratio is always 0dB
 * soft_volume always equals volume_factor

If a filter sink doesn't follow the hardware sink volume, then the filter
sink's virtual stream is handled as a regular stream.

Since the volumes of the virtual streams are controlled by a set of rules,
the user is not allowed to change the virtual streams' volumes. It would
probably also make sense to forbid changing the filter sinks' volume, but
that's not strictly necessary, and currently changing a filter sink's volume
changes actually the hardware sink's volume, and from there it propagates to
all filter sinks ("funny" effects are expected when adjusting a single
channel in cases where all sinks don't have the same channel maps).

This patch is based on the work of Marc-André Lureau, who did the
initial implementation for Pulseaudio 0.9.15.
2011-02-26 10:37:20 +00:00
..
.gitignore add another .gitignore file, this time for pulse/ 2008-06-18 00:47:32 +02:00
browser.c Use LGPL 2.1 on all files previously using LGPL 2 2009-03-03 20:23:02 +00:00
browser.h Use LGPL 2.1 on all files previously using LGPL 2 2009-03-03 20:23:02 +00:00
cdecl.h Use LGPL 2.1 on all files previously using LGPL 2 2009-03-03 20:23:02 +00:00
channelmap.c channelmap: Use "Subwoofer" as pretty name for LFE 2010-02-21 17:48:36 +01:00
channelmap.h doxygen: Add 'See also' linking to the overview page 2010-10-13 09:07:39 +01:00
client-conf-x11.c x11: Use the default screen for X11 properties. 2010-09-18 12:05:38 +01:00
client-conf-x11.h Use LGPL 2.1 on all files previously using LGPL 2 2009-03-03 20:23:02 +00:00
client-conf.c client: introduce auto-connect-display= following the scheme of auto-connect-localhost= 2010-01-13 22:15:52 +01:00
client-conf.h client: introduce auto-connect-display= following the scheme of auto-connect-localhost= 2010-01-13 22:15:52 +01:00
client.conf.in client.conf.in: Typo. s/a/are/ 2010-02-02 09:02:21 +01:00
context.c Apply #ifdefs around functionality not available on win32 2011-02-17 11:58:22 +01:00
context.h doxygen: Add 'See also' linking to the overview page 2010-10-13 09:07:39 +01:00
def.h Implement the "volume sharing" feature. 2011-02-26 10:37:20 +00:00
error.c libpulse: add new error code PA_ERR_BUSY 2009-09-11 01:20:45 +02:00
error.h Use LGPL 2.1 on all files previously using LGPL 2 2009-03-03 20:23:02 +00:00
ext-device-manager.c device-manager: Rather than flagging the device as available, just include the sink/source index with PA_INVALID_INDEX meaning unavailable 2009-10-10 15:45:49 +01:00
ext-device-manager.h device-manager: Update docs version -> 0.9.20 2009-11-11 17:24:57 +00:00
ext-stream-restore.c Fix checking for NULL after usage 2009-08-28 17:12:44 +02:00
ext-stream-restore.h libpulse: add missing includes 2009-10-12 21:21:26 +02:00
fork-detect.c add pa_assert_cc() for compile time assertions 2009-03-23 21:03:52 +01:00
fork-detect.h try to detect when stupid clients forks and refuse all service from then on 2009-03-05 04:33:40 +01:00
gccmacro.h gccmacro: enable weakrefs only on ELF 2009-09-15 04:31:54 +02:00
glib-mainloop.c Use LGPL 2.1 on all files previously using LGPL 2 2009-03-03 20:23:02 +00:00
glib-mainloop.h doxygen: Add 'See also' linking to the overview page 2010-10-13 09:07:39 +01:00
i18n.c add i18n support 2008-08-06 18:54:13 +02:00
i18n.h import version.h in all header files to make sure that version-based feature testing works 2009-01-27 02:36:42 +01:00
internal.h dbus: remove filter functions only if they were actually set before 2010-02-09 22:28:17 +00:00
introspect.c introspect: Include whether a stream is corked in the info callback. 2010-10-06 09:17:01 +01:00
introspect.h Allow read-only or non-existing sink input volume. 2011-02-22 20:12:31 +00:00
mainloop-api.c don't use PA_GCC_UNUSED anymore 2008-08-09 16:20:29 +02:00
mainloop-api.h win32: Implement rtclock based on QueryPerformanceCounter 2011-02-17 12:02:31 +01:00
mainloop-signal.c use cloexec wrappers wherever applicable 2009-10-30 03:32:38 +01:00
mainloop-signal.h Use LGPL 2.1 on all files previously using LGPL 2 2009-03-03 20:23:02 +00:00
mainloop.c Use <pulsecore/socket.h> instead of <sys/socket.h> 2011-02-17 11:58:21 +01:00
mainloop.h doxygen: Add 'See also' linking to the overview page 2010-10-13 09:07:39 +01:00
operation.c Use LGPL 2.1 on all files previously using LGPL 2 2009-03-03 20:23:02 +00:00
operation.h client: extend documentation on pa_operation_cancel() a bit 2009-08-03 23:07:59 +02:00
proplist.c Merge branch 'master' of git://0pointer.de/pulseaudio into dbus-work 2009-08-30 20:07:31 +03:00
proplist.h proplist: explicitly mention a role 'test' 2010-02-21 17:48:42 +01:00
pulseaudio.h doxygen: add rtclock.h to documentation 2009-09-11 01:49:39 +02:00
rtclock.c win32: Implement rtclock based on QueryPerformanceCounter 2011-02-17 12:02:31 +01:00
rtclock.h rtclock: document that we fallback to wallclock time if monotonic time is not supported 2009-06-23 00:15:57 +02:00
sample.c sample: manually inline table lookups 2009-08-20 11:31:04 +02:00
sample.h doxygen: Add 'See also' linking to the overview page 2010-10-13 09:07:39 +01:00
scache.c volume: Use a macro to check if a volume is valid 2010-10-15 01:10:00 +05:30
scache.h doxygen: Add 'See also' linking to the overview page 2010-10-13 09:07:39 +01:00
simple.c simple: check for == RUNNING instead of != DONE when waiting for operations 2009-08-05 01:05:35 +02:00
simple.h doxygen: Add 'See also' linking to the overview page 2010-10-13 09:07:39 +01:00
stream.c client: Don't update smoother while corked 2011-01-15 16:08:45 +00:00
stream.h doxygen: Add 'See also' linking to the overview page 2010-10-13 09:07:39 +01:00
subscribe.c Use LGPL 2.1 on all files previously using LGPL 2 2009-03-03 20:23:02 +00:00
subscribe.h doxygen: Add 'See also' linking to the overview page 2010-10-13 09:07:39 +01:00
thread-mainloop.c Use pa_read, pa_write and pa_poll instead of system functions 2011-02-17 12:02:31 +01:00
thread-mainloop.h doxygen: Add 'See also' linking to the overview page 2010-10-13 09:07:39 +01:00
timeval.c win32: Implement rtclock based on QueryPerformanceCounter 2011-02-17 12:02:31 +01:00
timeval.h doxygen: Fix documentation typos 2010-10-13 09:07:39 +01:00
utf8.c utf8: minor simplification 2009-09-08 23:49:42 +02:00
utf8.h add new API pa_ascii_valid(), pa_ascii_filter() 2009-02-04 17:11:56 +01:00
util.c Apply #ifdefs around functionality not available on win32 2011-02-17 11:58:22 +01:00
util.h util: if NULL is passed to pa_path_get_filename() just hand it through 2009-04-19 19:02:16 +02:00
version.h.in version: Drop the micro version number 2010-11-28 15:56:20 +00:00
volume.c volume: Clamp volume to PA_VOLUME_MAX 2010-10-15 01:10:00 +05:30
volume.h volume: Trivial cosmetics (remove a space) 2010-12-06 15:45:22 +00:00
xmalloc.c Use LGPL 2.1 on all files previously using LGPL 2 2009-03-03 20:23:02 +00:00
xmalloc.h malloc: implement pa_xrenew() 2009-06-17 03:07:42 +02:00