summaryrefslogtreecommitdiffstats
path: root/src/pulsecore/sink-input.h
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2009-08-19 02:55:02 +0200
committerLennart Poettering <lennart@poettering.net>2009-08-19 02:55:02 +0200
commit8c31974f56ebbbfc1a4978150026acf77c32689e (patch)
tree3078845a45638377a5d181695ed352dd32bf44cb /src/pulsecore/sink-input.h
parent5207e191424675df74059aaf30f9b1292a05cb5d (diff)
sink: volume handling rework, new flat volume logic
- We now implement a logic where the sink maintains two distinct volumes: the 'reference' volume which is shown to the users, and the 'real' volume, which is configured to the hardware. The latter is configured to the max of all streams. Volume changes on sinks are propagated back to the streams proportional to the reference volume change. Volume changes on sink inputs are forwarded to the sink by 'pushing' the volume if necessary. This renames the old 'virtual_volume' to 'real_volume'. The 'reference_volume' is now the one exposed to users. By this logic the sink volume visible to the user, will always be the "upper" boundary for everything that is played. Saved/restored stream volumes are measured relative to this boundary, the factor here is always < 1.0. - introduce accuracy for sink volumes, similar to the accuracy we already have for source volumes. - other cleanups.
Diffstat (limited to 'src/pulsecore/sink-input.h')
-rw-r--r--src/pulsecore/sink-input.h15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/pulsecore/sink-input.h b/src/pulsecore/sink-input.h
index b5502c45..ea0f8c0e 100644
--- a/src/pulsecore/sink-input.h
+++ b/src/pulsecore/sink-input.h
@@ -94,10 +94,12 @@ struct pa_sink_input {
pa_sink_input *sync_prev, *sync_next;
/* Also see http://pulseaudio.org/wiki/InternalVolumes */
- pa_cvolume virtual_volume; /* The volume clients are informed about */
- pa_cvolume volume_factor; /* An internally used volume factor that can be used by modules to apply effects and suchlike without having that visible to the outside */
- double relative_volume[PA_CHANNELS_MAX]; /* The calculated volume relative to the sink volume as linear factors. */
- pa_cvolume soft_volume; /* The internal software volume we apply to all PCM data while it passes through. Usually calculated as relative_volume * volume_factor */
+ pa_cvolume volume; /* The volume clients are informed about */
+ pa_cvolume reference_ratio; /* The ratio of the stream's volume to the sink's reference volume */
+ pa_cvolume real_ratio; /* The ratio of the stream's volume to the sink's real volume */
+ pa_cvolume volume_factor; /* An internally used volume factor that can be used by modules to apply effects and suchlike without having that visible to the outside */
+ pa_cvolume soft_volume; /* The internal software volume we apply to all PCM data while it passes through. Usually calculated as real_ratio * volume_factor */
+
pa_bool_t muted:1;
/* if TRUE then the source we are connected to and/or the volume
@@ -325,8 +327,6 @@ pa_usec_t pa_sink_input_get_latency(pa_sink_input *i, pa_usec_t *sink_latency);
void pa_sink_input_set_volume(pa_sink_input *i, const pa_cvolume *volume, pa_bool_t save, pa_bool_t absolute);
pa_cvolume *pa_sink_input_get_volume(pa_sink_input *i, pa_cvolume *volume, pa_bool_t absolute);
-pa_cvolume *pa_sink_input_get_relative_volume(pa_sink_input *i, pa_cvolume *v);
-
void pa_sink_input_set_mute(pa_sink_input *i, pa_bool_t mute, pa_bool_t save);
pa_bool_t pa_sink_input_get_mute(pa_sink_input *i);
@@ -369,9 +369,6 @@ pa_bool_t pa_sink_input_safe_to_remove(pa_sink_input *i);
pa_memchunk* pa_sink_input_get_silence(pa_sink_input *i, pa_memchunk *ret);
-/* To be used by sink.c only */
-void pa_sink_input_set_relative_volume(pa_sink_input *i, const pa_cvolume *v);
-
#define pa_sink_input_assert_io_context(s) \
pa_assert(pa_thread_mq_get() || !PA_SINK_INPUT_IS_LINKED((s)->state))