Skip to contentSkip to conversation

.dimen ?

PATCH Giuliano Pochini 2 participants 3 messages May 18, 2003 – May 20, 2003

lore
Share & tools
lore
#0 lore raw

In struct sndrv_ctl_elem_info what is the union .dimen for ? A grep(1) in all sources show that it's referenced only in snd_ctl_elem_info_get_dimension() and snd_ctl_elem_info_get_dimensions(). The latter seems quite buggy (patch against 0.9.3 is attached).

Bye.

src/control/control.c renamed from src/control/control.c.old +4 -4
@@ -1699,10 +1699,10 @@
 	assert(obj);
 	if (obj->access & SNDRV_CTL_ELEM_ACCESS_DINDIRECT)
 		return 0;			/* FIXME: implement indirect access as well */
-	for (i = 3; i >= 0; i++)
-		if (obj->dimen.d[0])
-			break;
-	return i >= 0 ? i + 1 : 0;
+	for (i = 3; i >= 0; i--)
+		if (obj->dimen.d[i])
+			return(i+1);
+	return 0;
 }
 use_default_symbol_version(__snd_ctl_elem_info_get_dimensions, snd_ctl_elem_info_get_dimensions, ALSA_0.9.3);
 
#1 lore raw

At 18 May 2003 17:05:33 +0000,

Quoted 5 lines · Giuliano Pochini

[1 <text/plain (7bit)>]

In struct sndrv_ctl_elem_info what is the union .dimen for ?

it was introduced to describe the size of matrix controls. basically the control API accepts the linear index, so user (or alsa-lib) needs to map the multi-dimensional array to the linear index. the dimen field specifies the number of elements in each dimension. (up to 4 dimensions are supposed.)
so far, no driver supports this feature yet, though...

Quoted 5 lines

A grep(1)
in all sources show that it's referenced only in snd_ctl_elem_info_get_dimension() and snd_ctl_elem_info_get_dimensions(). The latter seems quite buggy (patch against 0.9.3 is attached).

thanks, patch is applied to cvs.

ciao,

Takashi

-------------------------------------------------------
This SF.net email is sponsored by: ObjectStore.
If flattening out C++ or Java code to make your application fit in a relational database is painful, don't do it! Check out ObjectStore. Now part of Progress Software. http://www.objectstore.net/sourceforge

#2 lore raw
Quoted 8 lines · On 20-May-2003 Takashi Iwai wrote:
Quoted 1 line

In struct sndrv_ctl_elem_info what is the union .dimen for ?

it was introduced to describe the size of matrix controls. basically the control API accepts the linear index, so user (or alsa-lib) needs to map the multi-dimensional array to the linear index. the dimen field specifies the number of elements in each dimension. (up to 4 dimensions are supposed.)
so far, no driver supports this feature yet, though...

Fine, it's very useful. I'll try it ASAP.

Bye.

-------------------------------------------------------
This SF.net email is sponsored by: ObjectStore.
If flattening out C++ or Java code to make your application fit in a relational database is painful, don't do it! Check out ObjectStore. Now part of Progress Software. http://www.objectstore.net/sourceforge