[alsa-devel] USB dB data
Takashi Iwai
tiwai at suse.de
Wed Sep 6 08:04:54 CEST 2017
On Wed, 06 Sep 2017 01:55:51 +0200,
Jack Bates wrote:
>
> On 01/09/17 12:34 AM, Takashi Iwai wrote:
> > On Wed, 30 Aug 2017 21:48:58 +0200,
> > Jack Bates wrote:
> >>
> >> I confirmed with Wireshark that my USB sound card responds to GET_MIN
> >> with 0x0000 and GET_MAX with 0x6300 .. The audio device class
> >> definition [1] says the units are 1/256 dB (section 5.2.2.2.3: Mixer
> >> Control) ... So by my calculation, the min and max are 0 and 99 dB
> >> (0x6300 / 256 == 99) ... Why then does alsactl print:
> >>
> >>> range '0 - 99'
> >>> dbmin 0
> >>> dbmax 38
> >>
> >> (/usr/sbin/aslactl -f - store)
> >>
> >> I originally asked about this on the pulseaudio-discuss list [2]
> >> because it uses "dB data" [3].
> >>
> >> The "0 - 99" makes sense -- it lines up with my calculation ... Where
> >> does the 38 come from? (I expect it's obvious, I just haven't found
> >> the explanation?)
> >
> > Hm, what shows /proc/asound/card*/usbmixer proc file?
> > It contains some raw data.
>
> It also shows dBmax=38 (it matches alsactl):
>
> > nottheoilrig at debian:~$ cat /proc/asound/card2/usbmixer
> > USB Mixer: usb_id=0x05a740fa, ctrlif=0, ctlerr=0
> > Card: Bose Corporation Bose Revolve SoundLink at usb-0000:00:14.0-1, full speed
> > Unit: 2
> > Control: name="PCM Playback Volume", index=0
> > Info: id=2, control=2, cmask=0x0, channels=1, type="S16"
> > Volume: min=0, max=99, dBmin=0, dBmax=38
> > Unit: 2
> > Control: name="PCM Playback Switch", index=0
> > Info: id=2, control=1, cmask=0x0, channels=1, type="INV_BOOLEAN"
> > Volume: min=0, max=1, dBmin=0, dBmax=0
> > nottheoilrig at debian:~$
>
> > Basically the driver simply interprets the USB descriptor min/max
> > unless there are overriding mappings by quirk list.
>
> How can I inspect the device's USB descriptor min/max (to confirm that
> 38 *is* what's advertised)? I was using Wireshark to capture the
> GET_MAX request and response ([1] section 5.2.2.2.2: Get Mixer Unit
> Control Request) -- in which case the response data is 0x6300 ...
>
> If the source behind the usbmixer proc file/dB data is the GET_MAX
> response, then how does 0x6300 turn into 38 dB? I haven't spotted any
> obvious quirks for usb_id=0x05a740fa (although I haven't read all of
> mixer.c) ... get_min_max_with_quirks() would seem to interpret it as
> 1/256 dB [2] (as per the spec) but 0x6300 / 256 != 38 ...
I also see no special code doing wrong, could you check via an
old-good way, e.g. just adding some debug prints?
thanks,
Takashi
More information about the Alsa-devel
mailing list