[alsa-devel] Support for floating point controls?

Takashi Iwai tiwai at suse.de
Mon Feb 1 17:57:06 CET 2010


At Mon, 1 Feb 2010 17:43:22 +0100 (CET),
Jaroslav Kysela wrote:
> 
> On Thu, 28 Jan 2010, Eliot Blennerhassett wrote:
> 
> > Greetings,
> >
> > some of our products now have control paramters that are 32 bit floating
> > point values.
> >
> > I wonder if a patch implementing float ctl elements would be accepted?
> >
> > Note that the floats are not manipulated in the kernel at all, the
> > values are just passed through from the hardware to userspace (?)
> 
> If hardware supports this format, I have no objections against this 
> extension.
> 
> > Adding something like:
> >
> > #define	SNDRV_CTL_ELEM_TYPE_FLOAT	((__force snd_ctl_elem_type_t) 7)
> >
> > struct snd_ctl_elem_info {
> > ...
> >  union {
> > 	struct {
> > 		float min;		/* R: minimum value */
> > 		float max;		/* R: maximum value */
> > 		float step;		/* R: step (0 variable) */
> > 	} float;
> > ...
> > }
> >
> > struct snd_ctl_elem_value {
> >  union {
> > 	union {
> > 		float value[128];
> > 	} float;

I think this isn't allowed in C.  The field name should be _float or
so...

> 
> Looks good. Also, don't forget to add the support for this type to 
> alsa-lib.

And don't forget to add a protocol-version check there, too.


thanks,

Takashi


More information about the Alsa-devel mailing list