echomixer: obsolete usage of dimension information

In current implementation for a series of echoaudio drivers, some control
element set delivers information to use element values for
multi-dimensional array. Essentially, ALSA control interface of asound.h
has no common way to parse the information. As a result, the drivers
forces 'echomixer' application to parse the information by several ways.

This issue was reported by a commit 51db452df07b ('Revert "ALSA: echoaudio:
purge contradictions between dimension matrix members and total number of
members"') to Linux kernel. As a result of discussion at Linux
miniconference 2017, usage of 'dimen' member of 'struct snd_ctl_elem_info'
is going to be deprecated for future removal.

According to the above decision, this commit obsoletes usage of 'dimen'
information in 'echomixer' application. In a series of echoaudio drivers,
a control element set named as 'Channels info' includes duplicated
information of the dimension information on value array. Additionally,
some of dimension information have fixed values. This commit utilizes them
to obsolete usage of dimension information.

This patch is tested with Echo Gina 3G.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Takashi Sakamoto 2017-11-04 11:28:35 +09:00 committed by Takashi Iwai
parent e926822747
commit f0ffe1b732

View file

@ -525,6 +525,25 @@ void GetChannels(void) {
nLOut=snd_ctl_elem_value_get_integer(control, 2); // Number of output channels nLOut=snd_ctl_elem_value_get_integer(control, 2); // Number of output channels
fdOut=snd_ctl_elem_value_get_integer(control, 3); // First digital out fdOut=snd_ctl_elem_value_get_integer(control, 3); // First digital out
nPOut=snd_ctl_elem_value_get_integer(control, 4); // Number of virtual output channels (==nLOut on non-vmixer cards) nPOut=snd_ctl_elem_value_get_integer(control, 4); // Number of virtual output channels (==nLOut on non-vmixer cards)
mixerControl.outputs = nLOut;
mixerControl.inputs = nIn;
if (vmixerId) {
vmixerControl.outputs = nLOut;
vmixerControl.inputs = nPOut;
/* For outputs and inputs. */
metersStreams = 2;
} else {
/* For outputs, inputs and system outputs. */
metersStreams = 3;
}
/* For the number of channels. */
metersNumber = 16;
/* For each of levels and peaks. */
metersTypes = 2;
} }
ClockMask=snd_ctl_elem_value_get_integer(control, 5); // Bitmask of available input clocks ClockMask=snd_ctl_elem_value_get_integer(control, 5); // Bitmask of available input clocks
} }
@ -1712,15 +1731,11 @@ int OpenControls(const char *card, const char *cardname) {
if (!mixerId) { if (!mixerId) {
mixerId=numid; mixerId=numid;
CTLID_DEBUG(("First Mixer id=%d\n", mixerId)); CTLID_DEBUG(("First Mixer id=%d\n", mixerId));
mixerControl.outputs=snd_ctl_elem_info_get_dimension(info, 0);
mixerControl.inputs=snd_ctl_elem_info_get_dimension(info, 1);
} }
} else if (!strcmp("VMixer Volume", snd_ctl_elem_id_get_name(id))) { } else if (!strcmp("VMixer Volume", snd_ctl_elem_id_get_name(id))) {
if (!vmixerId) { if (!vmixerId) {
vmixerId=vmixerControl.id=numid; vmixerId=vmixerControl.id=numid;
CTLID_DEBUG(("First Vmixer id=%d\n", vmixerId)); CTLID_DEBUG(("First Vmixer id=%d\n", vmixerId));
vmixerControl.outputs=snd_ctl_elem_info_get_dimension(info, 0);
vmixerControl.inputs=snd_ctl_elem_info_get_dimension(info, 1);
} }
} else if (!strcmp("PCM Playback Volume", snd_ctl_elem_id_get_name(id))) { } else if (!strcmp("PCM Playback Volume", snd_ctl_elem_id_get_name(id))) {
pcmoutId=pcmoutControl.id=numid; pcmoutId=pcmoutControl.id=numid;
@ -1789,9 +1804,6 @@ int OpenControls(const char *card, const char *cardname) {
CTLID_DEBUG(("VU-meter switch id=%d\n", numid)); CTLID_DEBUG(("VU-meter switch id=%d\n", numid));
} else if (!strcmp("VU-meters", snd_ctl_elem_id_get_name(id))) { } else if (!strcmp("VU-meters", snd_ctl_elem_id_get_name(id))) {
vumetersId=numid; vumetersId=numid;
metersStreams=snd_ctl_elem_info_get_dimension(info, 0); // 2 or 3: output, input and (vmixer cards only) pcm
metersNumber=snd_ctl_elem_info_get_dimension(info, 1); // Number of channels
metersTypes=snd_ctl_elem_info_get_dimension(info, 2); // 2: level and peak
CTLID_DEBUG(("VU-meters id=%d\n", numid)); CTLID_DEBUG(("VU-meters id=%d\n", numid));
} else if (!strcmp("Channels info", snd_ctl_elem_id_get_name(id))) { } else if (!strcmp("Channels info", snd_ctl_elem_id_get_name(id))) {
channelsId=numid; channelsId=numid;