summaryrefslogtreecommitdiffstats
path: root/binding/audiomixer.h
diff options
context:
space:
mode:
authorGeorge Kiagiadakis <george.kiagiadakis@collabora.com>2019-06-07 17:44:35 +0300
committerGeorge Kiagiadakis <george.kiagiadakis@collabora.com>2019-06-24 13:32:08 +0300
commit224712ad5f07dccb6acb19ddf8333d822c7928ce (patch)
tree397ba7656f0589b04fea3d5b7bb0e4e3b1dca4e2 /binding/audiomixer.h
parent7dff10809be5feeda6f81b942c8671cdda2e3a27 (diff)
Initial binding version
Signed-off-by: George Kiagiadakis <george.kiagiadakis@collabora.com> Change-Id: I89e493d88c7fa1309f1b2991d346fc496caa6898
Diffstat (limited to 'binding/audiomixer.h')
-rw-r--r--binding/audiomixer.h60
1 files changed, 60 insertions, 0 deletions
diff --git a/binding/audiomixer.h b/binding/audiomixer.h
new file mode 100644
index 0000000..f4e83c7
--- /dev/null
+++ b/binding/audiomixer.h
@@ -0,0 +1,60 @@
+/*
+ * Copyright © 2019 Collabora Ltd.
+ * @author George Kiagiadakis <george.kiagiadakis@collabora.com>
+ *
+ * SPDX-License-Identifier: MIT
+ */
+
+#include <stdbool.h>
+
+struct audiomixer;
+
+struct mixer_control
+{
+ char name[32];
+ double volume;
+ bool mute;
+};
+
+struct audiomixer_events
+{
+ void (*controls_changed) (void *data);
+
+ void (*value_changed) (void *data,
+#define MIXER_CONTROL_CHANGE_FLAG_VOLUME (1<<0)
+#define MIXER_CONTROL_CHANGE_FLAG_MUTE (1<<1)
+ unsigned int change_mask,
+ const struct mixer_control *control);
+};
+
+struct audiomixer * audiomixer_new(void);
+void audiomixer_free(struct audiomixer *self);
+
+/* locking is required to call any of the methods below
+ * and to access any structure maintained by audiomixer */
+void audiomixer_lock(struct audiomixer *self);
+void audiomixer_unlock(struct audiomixer *self);
+
+int audiomixer_ensure_connected(struct audiomixer *self, int timeout_sec);
+int audiomixer_ensure_controls(struct audiomixer *self, int timeout_sec);
+
+const struct mixer_control ** audiomixer_get_active_controls(
+ struct audiomixer *self,
+ unsigned int *n_controls);
+
+const struct mixer_control * audiomixer_find_control(
+ struct audiomixer *self,
+ const char *name);
+
+void audiomixer_add_event_listener(struct audiomixer *self,
+ const struct audiomixer_events *events,
+ void *data);
+
+void audiomixer_change_volume(struct audiomixer *self,
+ const struct mixer_control *control,
+ double volume);
+
+void audiomixer_change_mute(struct audiomixer *self,
+ const struct mixer_control *control,
+ bool mute);
+