<p><br>
><br>
> Allow a mapping to relax the exact channel restriction:<br>
><br>
> exact-channels = yes | no # If no, and the exact number of channels is not supported,<br>
>                           # allow device to be opened with another channel count</p>
<p>Do you mean user have to define the mapping since these kind of devices usually support only playback channels >= 10 (even number) and capture channels >= 4 and does not support stereo ?</p>
<p>What happen when user define a mapping of an odd number of channels which is not supported by the sound card ?<br></p>
<p>> ---<br>
>  src/modules/alsa/alsa-mixer.c                    | 43 +++++++++++++++++++++---<br>
>  src/modules/alsa/alsa-mixer.h                    |  1 +<br>
>  src/modules/alsa/mixer/profile-sets/default.conf |  2 ++<br>
>  3 files changed, 42 insertions(+), 4 deletions(-)<br>
><br>
> diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c<br>
> index 58f9182..77c3c7e 100644<br>
> --- a/src/modules/alsa/alsa-mixer.c<br>
> +++ b/src/modules/alsa/alsa-mixer.c<br>
> @@ -3368,6 +3368,7 @@ pa_alsa_mapping *pa_alsa_mapping_get(pa_alsa_profile_set *ps, const char *name)<br>
><br>
>      m = pa_xnew0(pa_alsa_mapping, 1);<br>
>      m->profile_set = ps;<br>
> +    m->exact_channels = true;<br>
>      m->name = pa_xstrdup(name);<br>
>      pa_sample_spec_init(&m->sample_spec);<br>
>      pa_channel_map_init(&m->channel_map);<br>
> @@ -3485,6 +3486,30 @@ static int mapping_parse_paths(pa_config_parser_state *state) {<br>
>      return 0;<br>
>  }<br>
><br>
> +static int mapping_parse_exact_channels(pa_config_parser_state *state) {<br>
> +    pa_alsa_profile_set *ps;<br>
> +    pa_alsa_mapping *m;<br>
> +    int b;<br>
> +<br>
> +    pa_assert(state);<br>
> +<br>
> +    ps = state->userdata;<br>
> +<br>
> +    if (!(m = pa_alsa_mapping_get(ps, state->section))) {<br>
> +        pa_log("[%s:%u] %s invalid in section %s", state->filename, state->lineno, state->lvalue, state->section);<br>
> +        return -1;<br>
> +    }<br>
> +<br>
> +    if ((b = pa_parse_boolean(state->rvalue)) < 0) {<br>
> +        pa_log("[%s:%u] %s has invalid value '%s'", state->filename, state->lineno, state->lvalue, state->section);<br>
> +        return -1;<br>
> +    }<br>
> +<br>
> +    m->exact_channels = b;<br>
> +<br>
> +    return 0;<br>
> +}<br>
> +<br>
>  static int mapping_parse_element(pa_config_parser_state *state) {<br>
>      pa_alsa_profile_set *ps;<br>
>      pa_alsa_mapping *m;<br>
> @@ -4156,6 +4181,7 @@ pa_alsa_profile_set* pa_alsa_profile_set_new(const char *fname, const pa_channel<br>
>          { "element-input",          mapping_parse_element,        NULL, NULL },<br>
>          { "element-output",         mapping_parse_element,        NULL, NULL },<br>
>          { "direction",              mapping_parse_direction,      NULL, NULL },<br>
> +        { "exact-channels",         mapping_parse_exact_channels, NULL, NULL },<br>
><br>
>          /* Shared by [Mapping ...] and [Profile ...] */<br>
>          { "description",            mapping_parse_description,    NULL, NULL },<br>
> @@ -4264,10 +4290,12 @@ static void profile_finalize_probing(pa_alsa_profile *to_be_finalized, pa_alsa_p<br>
>  static snd_pcm_t* mapping_open_pcm(pa_alsa_mapping *m,<br>
>                                     const pa_sample_spec *ss,<br>
>                                     const char *dev_id,<br>
> +                                   bool exact_channels,<br>
>                                     int mode,<br>
>                                     unsigned default_n_fragments,<br>
>                                     unsigned default_fragment_size_msec) {<br>
><br>
> +    snd_pcm_t* handle;<br>
>      pa_sample_spec try_ss = *ss;<br>
>      pa_channel_map try_map = m->channel_map;<br>
>      snd_pcm_uframes_t try_period_size, try_buffer_size;<br>
> @@ -4279,10 +4307,17 @@ static snd_pcm_t* mapping_open_pcm(pa_alsa_mapping *m,<br>
>          pa_frame_size(&try_ss);<br>
>      try_buffer_size = default_n_fragments * try_period_size;<br>
><br>
> -    return pa_alsa_open_by_template(<br>
> +    handle = pa_alsa_open_by_template(<br>
>                                m->device_strings, dev_id, NULL, &try_ss,<br>
>                                &try_map, mode, &try_period_size,<br>
> -                              &try_buffer_size, 0, NULL, NULL, true);<br>
> +                              &try_buffer_size, 0, NULL, NULL, exact_channels);<br>
> +    if (handle && !exact_channels && m->channel_map.channels != try_map.channels) {<br>
> +        char buf[PA_CHANNEL_MAP_SNPRINT_MAX];<br>
> +        pa_log_debug("Channel map for mapping '%s' permanently changed to '%s'", m->name,<br>
> +                     pa_channel_map_snprint(buf, sizeof(buf), &try_map));<br>
> +        m->channel_map = try_map;<br>
> +    }<br>
> +    return handle;<br>
>  }<br>
></p>