sink/source: Fix restore of volume on devices without hw volume

Module-device-restore sets reference_volume, but soft_volume remains at
zero dB, so if a device only has soft_volume (i e no hw volume controls),
its volume was not restored correctly.

Reported-by: Richardo Salveti de Araujo <ricardo.salveti@canonical.com>
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
This commit is contained in:
David Henningsson 2014-08-26 13:44:02 +02:00
parent 10da0578c1
commit 5dba418160
2 changed files with 6 additions and 2 deletions

View file

@ -613,8 +613,10 @@ void pa_sink_put(pa_sink* s) {
* the sink implementor to set this flag as needed. * the sink implementor to set this flag as needed.
* *
* Note: This flag can also change over the life time of the sink. */ * Note: This flag can also change over the life time of the sink. */
if (!(s->flags & PA_SINK_HW_VOLUME_CTRL) && !(s->flags & PA_SINK_SHARE_VOLUME_WITH_MASTER)) if (!(s->flags & PA_SINK_HW_VOLUME_CTRL) && !(s->flags & PA_SINK_SHARE_VOLUME_WITH_MASTER)) {
pa_sink_enable_decibel_volume(s, true); pa_sink_enable_decibel_volume(s, true);
s->soft_volume = s->reference_volume;
}
/* If the sink implementor support DB volumes by itself, we should always /* If the sink implementor support DB volumes by itself, we should always
* try and enable flat volumes too */ * try and enable flat volumes too */

View file

@ -564,8 +564,10 @@ void pa_source_put(pa_source *s) {
* the source implementor to set this flag as needed. * the source implementor to set this flag as needed.
* *
* Note: This flag can also change over the life time of the source. */ * Note: This flag can also change over the life time of the source. */
if (!(s->flags & PA_SOURCE_HW_VOLUME_CTRL) && !(s->flags & PA_SOURCE_SHARE_VOLUME_WITH_MASTER)) if (!(s->flags & PA_SOURCE_HW_VOLUME_CTRL) && !(s->flags & PA_SOURCE_SHARE_VOLUME_WITH_MASTER)) {
pa_source_enable_decibel_volume(s, true); pa_source_enable_decibel_volume(s, true);
s->soft_volume = s->reference_volume;
}
/* If the source implementor support DB volumes by itself, we should always /* If the source implementor support DB volumes by itself, we should always
* try and enable flat volumes too */ * try and enable flat volumes too */