From 8c31974f56ebbbfc1a4978150026acf77c32689e Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 19 Aug 2009 02:55:02 +0200 Subject: 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. --- src/pulsecore/sink.h | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src/pulsecore/sink.h') diff --git a/src/pulsecore/sink.h b/src/pulsecore/sink.h index 3cd7e59d..936d1c2a 100644 --- a/src/pulsecore/sink.h +++ b/src/pulsecore/sink.h @@ -90,9 +90,10 @@ struct pa_sink { unsigned n_volume_steps; /* shall be constant */ /* Also see http://pulseaudio.org/wiki/InternalVolumes */ - pa_cvolume virtual_volume; /* The volume clients are informed about */ - pa_cvolume reference_volume; /* The volume taken as refernce base for relative sink input volumes */ + pa_cvolume reference_volume; /* The volume exported and taken as reference base for relative sink input volumes */ + pa_cvolume real_volume; /* The volume that the hardware is configured to */ pa_cvolume soft_volume; /* The internal software volume we apply to all PCM data while it passes through */ + pa_bool_t muted:1; pa_bool_t refresh_volume:1; @@ -303,11 +304,8 @@ int pa_sink_update_status(pa_sink*s); int pa_sink_suspend(pa_sink *s, pa_bool_t suspend, pa_suspend_cause_t cause); int pa_sink_suspend_all(pa_core *c, pa_bool_t suspend, pa_suspend_cause_t cause); -void pa_sink_update_flat_volume(pa_sink *s, pa_cvolume *new_volume); -void pa_sink_propagate_flat_volume(pa_sink *s); - -void pa_sink_set_volume(pa_sink *sink, const pa_cvolume *volume, pa_bool_t propagate, pa_bool_t sendmsg, pa_bool_t become_reference, pa_bool_t save); -const pa_cvolume *pa_sink_get_volume(pa_sink *sink, pa_bool_t force_refresh, pa_bool_t reference); +void pa_sink_set_volume(pa_sink *sink, const pa_cvolume *volume, pa_bool_t sendmsg, pa_bool_t save); +const pa_cvolume *pa_sink_get_volume(pa_sink *sink, pa_bool_t force_refresh); void pa_sink_set_mute(pa_sink *sink, pa_bool_t mute, pa_bool_t save); pa_bool_t pa_sink_get_mute(pa_sink *sink, pa_bool_t force_refresh); -- cgit