This patch adds a volume to the ports. Now we can save and restore the volume per port. BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=55262 --- src/pulsecore/device-port.c | 16 ++++++++++++++++ src/pulsecore/device-port.h | 3 +++ 2 files changed, 19 insertions(+) diff --git a/src/pulsecore/device-port.c b/src/pulsecore/device-port.c index 9ea54e3..c7605d5 100644 --- a/src/pulsecore/device-port.c +++ b/src/pulsecore/device-port.c @@ -98,6 +98,7 @@ pa_device_port *pa_device_port_new(pa_core *c, const char *name, const char *des p->is_input = FALSE; p->is_output = FALSE; p->latency_offset = 0; + pa_cvolume_init(&p->volume); p->proplist = pa_proplist_new(); return p; @@ -147,3 +148,18 @@ void pa_device_port_set_latency_offset(pa_device_port *p, int64_t offset) { if (p == pa_hashmap_get(card->ports, p->name)) pa_subscription_post(core, PA_SUBSCRIPTION_EVENT_CARD|PA_SUBSCRIPTION_EVENT_CHANGE, card->index); } + +void pa_device_port_set_volume(pa_device_port *p, pa_cvolume volume) { + uint32_t state; + pa_core *core; + pa_card *card; + + pa_assert(p); + + p->volume = volume; + + pa_assert_se(core = p->core); + PA_IDXSET_FOREACH(card, core->cards, state) + if (p == pa_hashmap_get(card->ports, p->name)) + pa_subscription_post(core, PA_SUBSCRIPTION_EVENT_CARD|PA_SUBSCRIPTION_EVENT_CHANGE, card->index); +} diff --git a/src/pulsecore/device-port.h b/src/pulsecore/device-port.h index a5c6420..0d56079 100644 --- a/src/pulsecore/device-port.h +++ b/src/pulsecore/device-port.h @@ -33,6 +33,7 @@ typedef struct pa_device_port pa_device_port; #include <inttypes.h> #include <pulse/def.h> +#include <pulse/volume.h> #include <pulsecore/object.h> #include <pulsecore/hashmap.h> #include <pulsecore/core.h> @@ -52,6 +53,7 @@ struct pa_device_port { pa_bool_t is_input:1; pa_bool_t is_output:1; int64_t latency_offset; + pa_cvolume volume; /* .. followed by some implementation specific data */ }; @@ -70,4 +72,5 @@ void pa_device_port_set_available(pa_device_port *p, pa_port_available_t availab void pa_device_port_set_latency_offset(pa_device_port *p, int64_t offset); +void pa_device_port_set_volume(pa_device_port *p, pa_cvolume volume); #endif -- 1.8.1