alsa-acp: collect channelmap from volume update

It's not used yet but would ideally need to be used to remap the
volumes.
This commit is contained in:
Wim Taymans 2020-12-18 16:22:00 +01:00
parent b05dcacc99
commit 67d10ad3c7

View file

@ -518,6 +518,9 @@ static int apply_device_props(struct impl *this, struct acp_device *dev, struct
struct spa_pod_prop *prop; struct spa_pod_prop *prop;
struct spa_pod_object *obj = (struct spa_pod_object *) props; struct spa_pod_object *obj = (struct spa_pod_object *) props;
int changed = 0; int changed = 0;
float volumes[ACP_MAX_CHANNELS];
uint32_t channels[ACP_MAX_CHANNELS];
uint32_t n_volumes = 0, n_channels = 0;
if (!spa_pod_is_object_type(props, SPA_TYPE_OBJECT_Props)) if (!spa_pod_is_object_type(props, SPA_TYPE_OBJECT_Props))
return -EINVAL; return -EINVAL;
@ -537,20 +540,23 @@ static int apply_device_props(struct impl *this, struct acp_device *dev, struct
} }
break; break;
case SPA_PROP_channelVolumes: case SPA_PROP_channelVolumes:
{
float volumes[64];
uint32_t n_volumes;
if ((n_volumes = spa_pod_copy_array(&prop->value, SPA_TYPE_Float, if ((n_volumes = spa_pod_copy_array(&prop->value, SPA_TYPE_Float,
volumes, 64)) > 0) { volumes, ACP_MAX_CHANNELS)) > 0) {
acp_device_set_volume(dev, volumes, n_volumes); changed++;
}
break;
case SPA_PROP_channelMap:
if ((n_channels = spa_pod_copy_array(&prop->value, SPA_TYPE_Id,
channels, ACP_MAX_CHANNELS)) > 0) {
changed++; changed++;
} }
break; break;
} }
}
} }
return 0; if (n_volumes > 0)
acp_device_set_volume(dev, volumes, n_volumes);
return changed;
} }
static int impl_set_param(void *object, static int impl_set_param(void *object,