summaryrefslogtreecommitdiffstats
path: root/src/pulse
diff options
context:
space:
mode:
authorTanu Kaskinen <tanu.kaskinen@digia.com>2011-02-24 16:16:38 +0200
committerColin Guthrie <cguthrie@mandriva.org>2011-02-26 10:37:20 +0000
commitc9c88fb8dcbd35774e7aaae09e057e1b8bcdc3d4 (patch)
treee7172312a1200124979985a2c6b3096e21a3a4a3 /src/pulse
parentdbdb4607b02bf312255da980e3b01aa6733c0800 (diff)
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.
Diffstat (limited to 'src/pulse')
-rw-r--r--src/pulse/def.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/pulse/def.h b/src/pulse/def.h
index ac4ae538..a3b86223 100644
--- a/src/pulse/def.h
+++ b/src/pulse/def.h
@@ -748,6 +748,16 @@ typedef enum pa_sink_flags {
/**< The HW volume changes are syncronized with SW volume.
* \since 1.0 */
+/** \cond fulldocs */
+ /* PRIVATE: Server-side values -- do not try to use these at client-side.
+ * The server will filter out these flags anyway, so you should never see
+ * these flags in sinks. */
+
+ PA_SINK_SHARE_VOLUME_WITH_MASTER = 0x0400U,
+ /**< This sink shares the volume with the master sink (used by some filter
+ * sinks). */
+/** \endcond */
+
} pa_sink_flags_t;
/** \cond fulldocs */
@@ -761,6 +771,7 @@ typedef enum pa_sink_flags {
#define PA_SINK_DYNAMIC_LATENCY PA_SINK_DYNAMIC_LATENCY
#define PA_SINK_PASSTHROUGH PA_SINK_PASSTHROUGH
#define PA_SINK_SYNC_VOLUME PA_SINK_SYNC_VOLUME
+#define PA_SINK_SHARE_VOLUME_WITH_MASTER PA_SINK_SHARE_VOLUME_WITH_MASTER
/** \endcond */