From eabd2a49a4a150f48650d8d8e0128bdbda6f3cf1 Mon Sep 17 00:00:00 2001 From: George Kiagiadakis <george.kiagiadakis@collabora.com> Date: Tue, 11 Jun 2019 11:58:12 +0300 Subject: [PATCH] softdsp-endpoint: add the "selected" control This shall be a temporary method of selecting which endpoint is going to be the default input or output, for testing purposes --- modules/module-pw-audio-softdsp-endpoint.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/modules/module-pw-audio-softdsp-endpoint.c b/modules/module-pw-audio-softdsp-endpoint.c index e1fdd9eb..c7fe9526 100644 --- a/modules/module-pw-audio-softdsp-endpoint.c +++ b/modules/module-pw-audio-softdsp-endpoint.c @@ -27,6 +27,10 @@ struct _WpPwAudioSoftdspEndpoint { WpEndpoint parent; + /* temporary method to select which endpoint + * is going to be the default input/output */ + gboolean selected; + /* The core proxy */ struct pw_core_proxy *core_proxy; @@ -67,6 +71,7 @@ enum { enum { CONTROL_VOLUME = 0, CONTROL_MUTE, + CONTROL_SELECTED, }; G_DECLARE_FINAL_TYPE (WpPwAudioSoftdspEndpoint, endpoint, @@ -348,6 +353,14 @@ endpoint_constructed (GObject * object) g_variant_dict_insert (&d, "default-value", "b", self->master_mute); wp_endpoint_register_control (WP_ENDPOINT (self), g_variant_dict_end (&d)); + self->selected = FALSE; + g_variant_dict_init (&d, NULL); + g_variant_dict_insert (&d, "id", "u", CONTROL_SELECTED); + g_variant_dict_insert (&d, "name", "s", "selected"); + g_variant_dict_insert (&d, "type", "s", "b"); + g_variant_dict_insert (&d, "default-value", "b", self->selected); + wp_endpoint_register_control (WP_ENDPOINT (self), g_variant_dict_end (&d)); + G_OBJECT_CLASS (endpoint_parent_class)->constructed (object); } @@ -459,6 +472,8 @@ endpoint_get_control_value (WpEndpoint * ep, guint32 control_id) return g_variant_new_double (self->master_volume); case CONTROL_MUTE: return g_variant_new_boolean (self->master_mute); + case CONTROL_SELECTED: + return g_variant_new_boolean (self->selected); default: g_warning ("Unknown control id %u", control_id); return NULL; @@ -510,6 +525,11 @@ endpoint_set_control_value (WpEndpoint * ep, guint32 control_id, NULL)); break; + case CONTROL_SELECTED: + self->selected = g_variant_get_boolean (value); + wp_endpoint_notify_control_value (ep, CONTROL_SELECTED); + break; + default: g_warning ("Unknown control id %u", control_id); return FALSE; -- GitLab