m-mixer-api: track monitorMute and allow modifying them
This commit is contained in:
@@ -35,6 +35,7 @@ struct node_info {
|
|||||||
struct volume monitorVolume;
|
struct volume monitorVolume;
|
||||||
struct channel_map map;
|
struct channel_map map;
|
||||||
bool mute;
|
bool mute;
|
||||||
|
bool monitorMute;
|
||||||
float svolume;
|
float svolume;
|
||||||
float base;
|
float base;
|
||||||
float step;
|
float step;
|
||||||
@@ -151,6 +152,7 @@ node_info_fill (struct node_info * info, WpSpaPod * props)
|
|||||||
"volumeStep", "?f", &info->step,
|
"volumeStep", "?f", &info->step,
|
||||||
"volume", "?f", &info->svolume,
|
"volume", "?f", &info->svolume,
|
||||||
"monitorVolumes", "?P", &monitorVolumes,
|
"monitorVolumes", "?P", &monitorVolumes,
|
||||||
|
"monitorMute", "?b", &info->monitorMute,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
info->volume.channels = spa_pod_copy_array (
|
info->volume.channels = spa_pod_copy_array (
|
||||||
@@ -399,7 +401,9 @@ wp_mixer_api_set_volume (WpMixerApi * self, guint32 id, GVariant * vvolume)
|
|||||||
struct volume new_volume = {0};
|
struct volume new_volume = {0};
|
||||||
struct volume new_monVolume = {0};
|
struct volume new_monVolume = {0};
|
||||||
gboolean has_mute = FALSE;
|
gboolean has_mute = FALSE;
|
||||||
|
gboolean has_monitorMute = FALSE;
|
||||||
gboolean mute = FALSE;
|
gboolean mute = FALSE;
|
||||||
|
gboolean monitorMute = FALSE;
|
||||||
WpSpaIdTable t_audioChannel =
|
WpSpaIdTable t_audioChannel =
|
||||||
wp_spa_id_table_from_name ("Spa:Enum:AudioChannel");
|
wp_spa_id_table_from_name ("Spa:Enum:AudioChannel");
|
||||||
|
|
||||||
@@ -419,6 +423,7 @@ wp_mixer_api_set_volume (WpMixerApi * self, guint32 id, GVariant * vvolume)
|
|||||||
gdouble val;
|
gdouble val;
|
||||||
|
|
||||||
has_mute = g_variant_lookup (vvolume, "mute", "b", &mute);
|
has_mute = g_variant_lookup (vvolume, "mute", "b", &mute);
|
||||||
|
has_monitorMute = g_variant_lookup (vvolume, "monitorMute", "b", &monitorMute);
|
||||||
|
|
||||||
if (g_variant_lookup (vvolume, "volume", "d", &val)) {
|
if (g_variant_lookup (vvolume, "volume", "d", &val)) {
|
||||||
new_volume = info->volume;
|
new_volume = info->volume;
|
||||||
@@ -490,6 +495,8 @@ wp_mixer_api_set_volume (WpMixerApi * self, guint32 id, GVariant * vvolume)
|
|||||||
new_monVolume.channels, new_monVolume.values, NULL);
|
new_monVolume.channels, new_monVolume.values, NULL);
|
||||||
if (has_mute)
|
if (has_mute)
|
||||||
wp_spa_pod_builder_add (b, "mute", "b", mute, NULL);
|
wp_spa_pod_builder_add (b, "mute", "b", mute, NULL);
|
||||||
|
if (has_monitorMute)
|
||||||
|
wp_spa_pod_builder_add (b, "monitorMute", "b", monitorMute, NULL);
|
||||||
|
|
||||||
props = wp_spa_pod_builder_end (b);
|
props = wp_spa_pod_builder_end (b);
|
||||||
|
|
||||||
@@ -544,6 +551,7 @@ wp_mixer_api_get_volume (WpMixerApi * self, guint32 id)
|
|||||||
g_variant_builder_add (&b, "{sv}", "monitorVolume", g_variant_new_double (
|
g_variant_builder_add (&b, "{sv}", "monitorVolume", g_variant_new_double (
|
||||||
volume_from_linear (info->monitorVolume.values[0], self->scale)));
|
volume_from_linear (info->monitorVolume.values[0], self->scale)));
|
||||||
}
|
}
|
||||||
|
g_variant_builder_add (&b, "{sv}", "monitorMute", g_variant_new_boolean (info->monitorMute));
|
||||||
|
|
||||||
for (guint i = 0; i < info->volume.channels; i++) {
|
for (guint i = 0; i < info->volume.channels; i++) {
|
||||||
gchar index_str[10];
|
gchar index_str[10];
|
||||||
|
Reference in New Issue
Block a user