mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-07 13:30:03 -05:00
alsa-ucm: Support Playback/CaptureVolume
This allows us to support the PlaybackVolume and CaptureVolume commands in UCM, specifying a mixer control to use for hardware volume control. This only works with ports corresponding to single devices at the moment, and doesn't support stacking controls for combination ports. The configuration is intended to provide a control (like Headphone Playback Volume), but we try to resolve to a simple mixer control (Headphone) to reuse existing volume paths. On the UCM side, this also requires that when disabling the device for the port, the volume should be reset to some default. When enabling/disabling combination devices, things are a bit iffy since we have no way to reset the volume before switching to a combination device. It would be nice to have a combination-transition-sequence command in UCM to handle this and other similar cases. PlaybackSwitch and CaptureSwitch are yet to be implemented.
This commit is contained in:
parent
1c240b7a12
commit
3dfccada46
7 changed files with 295 additions and 66 deletions
|
|
@ -113,10 +113,11 @@ typedef struct pa_alsa_ucm_modifier pa_alsa_ucm_modifier;
|
|||
typedef struct pa_alsa_ucm_device pa_alsa_ucm_device;
|
||||
typedef struct pa_alsa_ucm_config pa_alsa_ucm_config;
|
||||
typedef struct pa_alsa_ucm_mapping_context pa_alsa_ucm_mapping_context;
|
||||
typedef struct pa_alsa_ucm_port_data pa_alsa_ucm_port_data;
|
||||
|
||||
int pa_alsa_ucm_query_profiles(pa_alsa_ucm_config *ucm, int card_index);
|
||||
pa_alsa_profile_set* pa_alsa_ucm_add_profile_set(pa_alsa_ucm_config *ucm, pa_channel_map *default_channel_map);
|
||||
int pa_alsa_ucm_set_profile(pa_alsa_ucm_config *ucm, const char *new_profile, const char *old_profile);
|
||||
int pa_alsa_ucm_set_profile(pa_alsa_ucm_config *ucm, pa_card *card, const char *new_profile, const char *old_profile);
|
||||
|
||||
int pa_alsa_ucm_get_verb(snd_use_case_mgr_t *uc_mgr, const char *verb_name, const char *verb_desc, pa_alsa_ucm_verb **p_verb);
|
||||
|
||||
|
|
@ -125,7 +126,9 @@ void pa_alsa_ucm_add_ports(
|
|||
pa_proplist *proplist,
|
||||
pa_alsa_ucm_mapping_context *context,
|
||||
bool is_sink,
|
||||
pa_card *card);
|
||||
pa_card *card,
|
||||
snd_pcm_t *pcm_handle,
|
||||
bool ignore_dB);
|
||||
void pa_alsa_ucm_add_ports_combination(
|
||||
pa_hashmap *hash,
|
||||
pa_alsa_ucm_mapping_context *context,
|
||||
|
|
@ -157,6 +160,11 @@ struct pa_alsa_ucm_device {
|
|||
unsigned playback_channels;
|
||||
unsigned capture_channels;
|
||||
|
||||
/* These may be different per verb, so we store this as a hashmap of verb -> volume_control. We might eventually want to
|
||||
* make this a hashmap of verb -> per-verb-device-properties-struct. */
|
||||
pa_hashmap *playback_volumes;
|
||||
pa_hashmap *capture_volumes;
|
||||
|
||||
pa_alsa_mapping *playback_mapping;
|
||||
pa_alsa_mapping *capture_mapping;
|
||||
|
||||
|
|
@ -224,4 +232,18 @@ struct pa_alsa_ucm_mapping_context {
|
|||
pa_idxset *ucm_modifiers;
|
||||
};
|
||||
|
||||
struct pa_alsa_ucm_port_data {
|
||||
pa_alsa_ucm_config *ucm;
|
||||
pa_device_port *core_port;
|
||||
|
||||
/* A single port will be associated with multiple devices if it represents
|
||||
* a combination of devices. */
|
||||
pa_dynarray *devices; /* pa_alsa_ucm_device */
|
||||
|
||||
/* profile -> pa_alsa_path for volume control */
|
||||
pa_hashmap *paths;
|
||||
/* Current path, set when activating profile */
|
||||
pa_alsa_path *path;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue