OSDN Git Service

Added snd_ctl_elem_info_get_dimensions() and snd_ctl_elem_info_get_dimension() functions.
authorJaroslav Kysela <perex@perex.cz>
Tue, 1 Apr 2003 13:58:09 +0000 (13:58 +0000)
committerJaroslav Kysela <perex@perex.cz>
Tue, 1 Apr 2003 13:58:09 +0000 (13:58 +0000)
include/control.h
include/sound/asound.h
src/Versions
src/control/control.c
src/control/control_hw.c

index c333899..3753dc7 100644 (file)
@@ -340,7 +340,6 @@ int snd_ctl_elem_info_is_volatile(const snd_ctl_elem_info_t *obj);
 int snd_ctl_elem_info_is_inactive(const snd_ctl_elem_info_t *obj);
 int snd_ctl_elem_info_is_locked(const snd_ctl_elem_info_t *obj);
 int snd_ctl_elem_info_is_owner(const snd_ctl_elem_info_t *obj);
-int snd_ctl_elem_info_is_indirect(const snd_ctl_elem_info_t *obj);
 pid_t snd_ctl_elem_info_get_owner(const snd_ctl_elem_info_t *obj);
 unsigned int snd_ctl_elem_info_get_count(const snd_ctl_elem_info_t *obj);
 long snd_ctl_elem_info_get_min(const snd_ctl_elem_info_t *obj);
@@ -352,6 +351,8 @@ long long snd_ctl_elem_info_get_step64(const snd_ctl_elem_info_t *obj);
 unsigned int snd_ctl_elem_info_get_items(const snd_ctl_elem_info_t *obj);
 void snd_ctl_elem_info_set_item(snd_ctl_elem_info_t *obj, unsigned int val);
 const char *snd_ctl_elem_info_get_item_name(const snd_ctl_elem_info_t *obj);
+int snd_ctl_elem_info_get_dimensions(const snd_ctl_elem_info_t *obj);
+int snd_ctl_elem_info_get_dimension(const snd_ctl_elem_info_t *obj, unsigned int idx);
 void snd_ctl_elem_info_get_id(const snd_ctl_elem_info_t *obj, snd_ctl_elem_id_t *ptr);
 unsigned int snd_ctl_elem_info_get_numid(const snd_ctl_elem_info_t *obj);
 snd_ctl_elem_iface_t snd_ctl_elem_info_get_interface(const snd_ctl_elem_info_t *obj);
index efdafbf..7fdf1c4 100644 (file)
@@ -574,7 +574,7 @@ struct sndrv_timer_ginfo {
        int card;                       /* card number */
        unsigned char id[64];           /* timer identification */
        unsigned char name[80];         /* timer name */
-       unsigned long ticks;            /* maximum ticks between interrupts */
+       unsigned long reserved0;        /* reserved for future use */
        unsigned long resolution;       /* average period resolution in ns */
        unsigned long resolution_min;   /* minimal period resolution in ns */
        unsigned long resolution_max;   /* maximal period resolution in ns */
@@ -584,9 +584,8 @@ struct sndrv_timer_ginfo {
 
 struct sndrv_timer_gparams {
        struct sndrv_timer_id tid;      /* requested timer ID */
-       unsigned long period;           /* requested minimal period in ns */
-       unsigned long period_num;       /* requested precise period resolution (in seconds) - numerator */
-       unsigned long period_den;       /* requested precise period resolution (in seconds) - denominator */
+       unsigned long period_num;       /* requested precise period duration (in seconds) - numerator */
+       unsigned long period_den;       /* requested precise period duration (in seconds) - denominator */
        unsigned char reserved[32];
 };
 
@@ -608,7 +607,7 @@ struct sndrv_timer_info {
        int card;                       /* card number */
        unsigned char id[64];           /* timer identificator */
        unsigned char name[80];         /* timer name */
-       unsigned long ticks;            /* maximum ticks between interrupts */
+       unsigned long reserved0;        /* reserved for future use */
        unsigned long resolution;       /* average period resolution in ns */
        unsigned char reserved[64];     /* reserved */
 };
@@ -682,7 +681,7 @@ struct sndrv_timer_tread {
  *                                                                          *
  ****************************************************************************/
 
-#define SNDRV_CTL_VERSION              SNDRV_PROTOCOL_VERSION(2, 0, 1)
+#define SNDRV_CTL_VERSION              SNDRV_PROTOCOL_VERSION(2, 0, 2)
 
 struct sndrv_ctl_card_info {
        int card;                       /* card number */
@@ -727,7 +726,8 @@ enum sndrv_ctl_elem_iface {
 #define SNDRV_CTL_ELEM_ACCESS_INACTIVE         (1<<8)  /* control does actually nothing, but may be updated */
 #define SNDRV_CTL_ELEM_ACCESS_LOCK             (1<<9)  /* write lock */
 #define SNDRV_CTL_ELEM_ACCESS_OWNER            (1<<10) /* write lock owner */
-#define SNDRV_CTL_ELEM_ACCESS_INDIRECT         (1<<31) /* indirect access */
+#define SNDRV_CTL_ELEM_ACCESS_DINDIRECT                (1<<30) /* indirect access for matrix dimensions in the info structure */
+#define SNDRV_CTL_ELEM_ACCESS_INDIRECT         (1<<31) /* indirect access for element value in the value structure */
 
 /* for further details see the ACPI and PCI power management specification */
 #define SNDRV_CTL_POWER_D0             0x0000  /* full On */
@@ -779,7 +779,11 @@ struct sndrv_ctl_elem_info {
                } enumerated;
                unsigned char reserved[128];
        } value;
-       unsigned char reserved[64];
+       union {
+               unsigned short d[4];            /* dimensions */
+               unsigned short *d_ptr;          /* indirect */
+       } dimen;
+       unsigned char reserved[64-4*sizeof(unsigned short)];
 };
 
 struct sndrv_ctl_elem_value {
index fbcacbc..0ca00aa 100644 (file)
@@ -101,3 +101,10 @@ ALSA_0.9.0 {
     snd_timer_params_set_filter;
     snd_timer_params_get_filter;
 } ALSA_0.9.0rc8;
+
+ALSA_0.9.3 {
+  global:
+
+    snd_ctl_elem_info_get_dimensions;
+    snd_ctl_elem_info_get_dimension;
+} ALSA_0.9.0;
index f589202..afa051e 100644 (file)
@@ -1543,7 +1543,7 @@ int snd_ctl_elem_info_is_owner(const snd_ctl_elem_info_t *obj)
 }
 
 /**
- * \brief Get info about values passing policy from a CTL element id/info
+ * \brief (DEPRECATED) Get info about values passing policy from a CTL element value
  * \param obj CTL element id/info
  * \return 0 if element value need to be passed by contents, 1 if need to be passed with a pointer
  */
@@ -1552,6 +1552,7 @@ int snd_ctl_elem_info_is_indirect(const snd_ctl_elem_info_t *obj)
        assert(obj);
        return !!(obj->access & SNDRV_CTL_ELEM_ACCESS_INDIRECT);
 }
+link_warning(snd_ctl_elem_info_is_indirect, "Warning: snd_ctl_elem_info_is_indirect is deprecated, do not use it");
 
 /**
  * \brief Get owner of a locked element
@@ -1683,6 +1684,49 @@ const char *snd_ctl_elem_info_get_item_name(const snd_ctl_elem_info_t *obj)
 }
 
 /**
+ * \brief Get count of dimensions for given element
+ * \param obj CTL element id/info
+ * \return zero value if no dimensions are defined, otherwise positive value with count of dimensions
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_ctl_elem_info_get_dimensions)(const snd_ctl_elem_info_t *obj)
+#else
+int snd_ctl_elem_info_get_dimensions(const snd_ctl_elem_info_t *obj)
+#endif
+{
+       int i;
+
+       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;
+}
+use_default_symbol_version(__snd_ctl_elem_info_get_dimensions, snd_ctl_elem_info_get_dimensions, ALSA_0.9.3);
+
+/**
+ * \brief Get specified of dimension width for given element
+ * \param obj CTL element id/info
+ * \return zero value if no dimension width is defined, otherwise positive value with with of specified dimension
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_ctl_elem_info_get_dimension)(const snd_ctl_elem_info_t *obj, unsigned int idx)
+#else
+int snd_ctl_elem_info_get_dimension(const snd_ctl_elem_info_t *obj, unsigned int idx)
+#endif
+{
+       assert(obj);
+       if (obj->access & SNDRV_CTL_ELEM_ACCESS_DINDIRECT)
+               return 0;                       /* FIXME: implement indirect access as well */
+       if (idx >= 3)
+               return 0;
+       return obj->dimen.d[0];
+}
+use_default_symbol_version(__snd_ctl_elem_info_get_dimension, snd_ctl_elem_info_get_dimension, ALSA_0.9.3);
+
+/**
  * \brief Get CTL element identifier of a CTL element id/info
  * \param obj CTL element id/info
  * \param ptr Pointer to returned CTL element identifier
index 6f84388..7e905f3 100644 (file)
@@ -39,7 +39,7 @@ const char *_snd_module_control_hw = "";
 #endif
 
 #define SNDRV_FILE_CONTROL     "/dev/snd/controlC%i"
-#define SNDRV_CTL_VERSION_MAX  SNDRV_PROTOCOL_VERSION(2, 0, 0)
+#define SNDRV_CTL_VERSION_MAX  SNDRV_PROTOCOL_VERSION(2, 0, 2)
 
 typedef struct {
        int card;