acp: add option to set Pro Audio channels

We always probe the Pro Audio profile with the maximum number of
channels but this can lead to a more limited amount of sample rates.

Add an option to set the channels used when probing so that the other
samplerates become available.

Fixes #2990
This commit is contained in:
Wim Taymans 2023-01-31 15:59:39 +01:00
parent e4f4ef9e1c
commit 2681d7e3ec
2 changed files with 5 additions and 1 deletions

View file

@ -315,7 +315,7 @@ static int add_pro_profile(pa_card *impl, uint32_t index)
ss.format = PA_SAMPLE_S32LE; ss.format = PA_SAMPLE_S32LE;
ss.rate = impl->rate; ss.rate = impl->rate;
ss.channels = 64; ss.channels = impl->pro_channels;
ap = pa_xnew0(pa_alsa_profile, 1); ap = pa_xnew0(pa_alsa_profile, 1);
ap->profile_set = ps; ap->profile_set = ps;
@ -1564,6 +1564,7 @@ struct acp_card *acp_card_new(uint32_t index, const struct acp_dict *props)
impl->auto_port = true; impl->auto_port = true;
impl->ignore_dB = false; impl->ignore_dB = false;
impl->rate = DEFAULT_RATE; impl->rate = DEFAULT_RATE;
impl->pro_channels = 64;
if (props) { if (props) {
if ((s = acp_dict_lookup(props, "api.alsa.use-ucm")) != NULL) if ((s = acp_dict_lookup(props, "api.alsa.use-ucm")) != NULL)
@ -1582,6 +1583,8 @@ struct acp_card *acp_card_new(uint32_t index, const struct acp_dict *props)
impl->auto_port = spa_atob(s); impl->auto_port = spa_atob(s);
if ((s = acp_dict_lookup(props, "api.acp.probe-rate")) != NULL) if ((s = acp_dict_lookup(props, "api.acp.probe-rate")) != NULL)
impl->rate = atoi(s); impl->rate = atoi(s);
if ((s = acp_dict_lookup(props, "api.acp.pro-channels")) != NULL)
impl->pro_channels = atoi(s);
} }
impl->ucm.default_sample_spec.format = PA_SAMPLE_S16NE; impl->ucm.default_sample_spec.format = PA_SAMPLE_S16NE;

View file

@ -48,6 +48,7 @@ struct pa_card {
bool auto_port; bool auto_port;
bool ignore_dB; bool ignore_dB;
uint32_t rate; uint32_t rate;
uint32_t pro_channels;
pa_alsa_ucm_config ucm; pa_alsa_ucm_config ucm;
pa_alsa_profile_set *profile_set; pa_alsa_profile_set *profile_set;