acp: add support for soft volume

Add a set_soft_volume/mute event.
If we can't configure the hardware volume completely, notify
the remainder with the soft_volume/mute events.
This commit is contained in:
Wim Taymans 2020-07-06 17:22:42 +02:00
parent 4db6e0e2b3
commit d80d593271
4 changed files with 87 additions and 10 deletions

View file

@ -181,14 +181,25 @@ static inline int pa_cvolume_compatible_with_channel_map(const pa_cvolume *v,
static inline pa_volume_t pa_cvolume_max(const pa_cvolume *a)
{
pa_volume_t m = PA_VOLUME_MUTED;
unsigned c;
for (c = 0; c < a->channels; c++)
if (a->values[c] > m)
m = a->values[c];
return m;
pa_volume_t m = PA_VOLUME_MUTED;
unsigned c;
for (c = 0; c < a->channels; c++)
if (a->values[c] > m)
m = a->values[c];
return m;
}
static inline pa_volume_t pa_cvolume_min(const pa_cvolume *a)
{
pa_volume_t m = PA_VOLUME_MAX;
unsigned c;
for (c = 0; c < a->channels; c++)
if (a->values[c] < m)
m = a->values[c];
return m;
}
#ifdef __cplusplus
} /* extern "C" */
#endif