acp: move pro channel init to init_auto

This commit is contained in:
Wim Taymans 2021-10-18 10:51:48 +02:00
parent 9dccd79191
commit a475926f87
2 changed files with 9 additions and 13 deletions

View file

@ -373,7 +373,7 @@ static int add_pro_profile(pa_card *impl, uint32_t index)
snd_pcm_close(m->output_pcm);
m->output_pcm = NULL;
m->supported = true;
pa_channel_map_init_pro(&m->channel_map, m->sample_spec.channels);
pa_channel_map_init_auto(&m->channel_map, m->sample_spec.channels, PA_CHANNEL_MAP_AUX);
}
pa_idxset_put(ap->output_mappings, m, NULL);
free(name);
@ -403,7 +403,7 @@ static int add_pro_profile(pa_card *impl, uint32_t index)
snd_pcm_close(m->input_pcm);
m->input_pcm = NULL;
m->supported = true;
pa_channel_map_init_pro(&m->channel_map, m->sample_spec.channels);
pa_channel_map_init_auto(&m->channel_map, m->sample_spec.channels, PA_CHANNEL_MAP_AUX);
}
pa_idxset_put(ap->input_mappings, m, NULL);
free(name);

View file

@ -144,6 +144,8 @@ static inline pa_channel_map* pa_channel_map_init(pa_channel_map *m)
static inline pa_channel_map* pa_channel_map_init_auto(pa_channel_map *m, unsigned channels, pa_channel_map_def_t def)
{
unsigned i;
pa_assert(m);
pa_assert(pa_channels_valid(channels));
pa_assert(def < PA_CHANNEL_MAP_DEF_MAX);
@ -179,6 +181,10 @@ static inline pa_channel_map* pa_channel_map_init_auto(pa_channel_map *m, unsign
default:
return NULL;
}
case PA_CHANNEL_MAP_AUX:
for (i = 0; i < channels; i++)
m->map[i] = PA_CHANNEL_POSITION_AUX0 + (i & 31);
break;
default:
break;
}
@ -201,17 +207,6 @@ static inline pa_channel_map* pa_channel_map_init_extend(pa_channel_map *m,
return NULL;
}
static inline pa_channel_map* pa_channel_map_init_pro(pa_channel_map *m,
unsigned channels)
{
unsigned i;
pa_channel_map_init(m);
for (i = 0; i < channels; i++)
m->map[i] = PA_CHANNEL_POSITION_AUX0 + i;
m->channels = (uint8_t) channels;
return m;
}
typedef uint64_t pa_channel_position_mask_t;
#define PA_CHANNEL_POSITION_MASK(f) ((pa_channel_position_mask_t) (1ULL << (f)))
@ -327,6 +322,7 @@ static const char *const pa_position_table[PA_CHANNEL_POSITION_MAX] = {
[PA_CHANNEL_POSITION_AUX29] = "aux29",
[PA_CHANNEL_POSITION_AUX30] = "aux30",
[PA_CHANNEL_POSITION_AUX31] = "aux31",
[PA_CHANNEL_POSITION_TOP_CENTER] = "top-center",
[PA_CHANNEL_POSITION_TOP_FRONT_CENTER] = "top-front-center",
[PA_CHANNEL_POSITION_TOP_FRONT_LEFT] = "top-front-left",