[PATCH 1/3] device-port: Add a maximum volume variable to the port struct

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "poljar (Damir Jeli?)" <poljarinho@xxxxxxxxx>

A maximum volume variable was added to the port struct and a function to
set the maximum volume.

The maximum volume does nothing for now, it will be later added to the
sink/source to enforce a maximum volume if the port is currently active.
---
 src/pulsecore/device-port.c | 10 ++++++++++
 src/pulsecore/device-port.h |  3 +++
 2 files changed, 13 insertions(+)

diff --git a/src/pulsecore/device-port.c b/src/pulsecore/device-port.c
index 9ea54e3..c467a09 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;
+    p->max_volume = PA_VOLUME_INVALID;
     p->proplist = pa_proplist_new();
 
     return p;
@@ -147,3 +148,12 @@ 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_max_volume(pa_device_port *p, pa_volume_t max) {
+    pa_assert(p);
+
+    if (max == PA_VOLUME_MUTED)
+        p->max_volume = PA_VOLUME_INVALID;
+    else
+        p->max_volume = max;
+}
diff --git a/src/pulsecore/device-port.h b/src/pulsecore/device-port.h
index a5c6420..b3ae261 100644
--- a/src/pulsecore/device-port.h
+++ b/src/pulsecore/device-port.h
@@ -52,6 +52,7 @@ struct pa_device_port {
     pa_bool_t is_input:1;
     pa_bool_t is_output:1;
     int64_t latency_offset;
+    pa_volume_t max_volume;
 
     /* .. followed by some implementation specific data */
 };
@@ -70,4 +71,6 @@ 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_max_volume(pa_device_port *p, pa_volume_t max);
+
 #endif
-- 
1.7.11.4



[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux