[alsa-devel] [RFC PATCH] ucm: Add support for device positions
Lin, Mengdong
mengdong.lin at intel.com
Tue Jan 3 16:32:11 CET 2017
> -----Original Message-----
> From: Liam Girdwood [mailto:liam.r.girdwood at linux.intel.com]
> Sent: Tuesday, January 3, 2017 10:59 PM
> > Users can provide prosition info of audio devices as a device value.
> > This will help the sound server to choose an audio devices from some
> > candidates based on the their locations and the status of the machine.
> >
> > The value name is the "Postion",
>
> We should change this to "Location" and use "Position" for x,y,z coordinates
> of the device to help for beam forming etc (separate patch series for
> Position).
Okay. "Location" seem better here.
>
> > and its value should be a composition of "Top", "Bottom", "Left",
> > "Right", "Front" and "Back". For example, a speaker may have a
> > position like "Front Top".
> >
> > The postion value can be got by either of the two APIs:
> > - snd_use_case_get(), via identifier 'Postion/device', to get the original
> > position string defined by the user.
> > - snd_use_case_geti(), via identifier '_devpos/device', to get the integer
> > value of the position. If the user has not define a position, 0 will be
> > returned that means an unknown position.
> >
> > Signed-off-by: Mengdong Lin <mengdong.lin at linux.intel.com>
> >
> > diff --git a/include/use-case.h b/include/use-case.h index
> > 8911645..b3b451b 100644
> > --- a/include/use-case.h
> > +++ b/include/use-case.h
> > @@ -165,6 +165,28 @@ extern "C" {
> > #define SND_USE_CASE_TQ_VOICE "Voice" /**< Voice
> Tone Quality */
> > #define SND_USE_CASE_TQ_TONES "Tones" /**<
> Tones Tone Quality */
> >
> > +
> > +/**
> > + * Device Position bits
> > + *
> > + * 0 is reserved for unknown position in each dimesion. Users can get
> > +the
> > + * integer value of the device postion by API snd_use_case_geti() via
> > + * identifier '_devpos/device', and the returned value is a
> > +compostion of
> > + * three dimesions.
> > + *
> > + * NOTE: Users can also get the position string like "Top Left" by
> > +API
> > + * snd_use_case_get() via identifier 'Position/device".
> > + */
> > +#define SND_USE_CASE_POS_LEFT (1<<0)
> > +#define SND_USE_CASE_POS_RIGHT (2<<0)
> > +#define SND_USE_CASE_POS_HORIZON_MASK (0xffff<<0)
> > +#define SND_USE_CASE_POS_TOP (1<<4)
> > +#define SND_USE_CASE_POS_BOTTOM (2<<4)
> > +#define SND_USE_CASE_POS_VERTICAL_MASK (0xffff<<4)
> > +#define SND_USE_CASE_POS_FRONT (1<<8)
> > +#define SND_USE_CASE_POS_BACK (2<<8)
> > +#define SND_USE_CASE_DEPTH_MASK (0xffff<<8)
>
> These are a little restrictive. It would be best to copy the other examples and
> use strings as users can easily append new locations by adding a string to a
> value list (without having to update any UCM core code).
>
> We would have a set of the common default locations so that sound servers
> could use present this info to users in meaningful ways, bespoke locations
> could also be presented to users (but only in string format).
>
> SectionDevice."Mic".0 {
>
> EnableSequence [
> ....
> ]
>
> DisableSequence [
> ....
> ]
>
> Value {
> Location "Left"
> Position "19.5, 34.2, 3.1"
> }
> }
>
> Using the above format means we just return the value of location to the
> client. We dont have to do any parsing or validation. Same applies for
> position.
> Liam
Okay. And If we only need to provide "Location" or "Position" in string format, current UCM code can already support it. We just need to specify these two variable names in the comments :-)
Users can get the info by API snd_use_case_get() with the identifier 'Location/device" or "Position/device" , e.g. "Location/Speaker".
Thanks
Mengdong
More information about the Alsa-devel
mailing list