Update of /cvsroot/alsa/alsa-lib/src/control
In directory sc8-pr-cvs1:/tmp/cvs-serv9895/src/control

Modified Files:
        control.c control_hw.c control_local.h 
Log Message:
- added support for user control elements


Index: control.c
===================================================================
RCS file: /cvsroot/alsa/alsa-lib/src/control/control.c,v
retrieving revision 1.99
retrieving revision 1.100
diff -u -r1.99 -r1.100
--- control.c   29 Jul 2003 13:19:19 -0000      1.99
+++ control.c   21 Oct 2003 17:39:14 -0000      1.100
@@ -253,6 +253,48 @@
 }
 
 /**
+ * \brief Create and add an user CTL element
+ * \param ctl CTL handle
+ * \param info CTL element info
+ * \return 0 on success otherwise a negative error code
+ *
+ * Note that the new element is locked!
+ */
+int snd_ctl_elem_add(snd_ctl_t *ctl, snd_ctl_elem_info_t *info)
+{
+       assert(ctl && info && info->id.name[0]);
+       return ctl->ops->element_add(ctl, info);
+}
+
+/**
+ * \brief Replace an user CTL element
+ * \param ctl CTL handle
+ * \param info CTL element info
+ * \return 0 on success otherwise a negative error code
+ *
+ * Note that the new element is locked!
+ */
+int snd_ctl_elem_replace(snd_ctl_t *ctl, snd_ctl_elem_info_t *info)
+{
+       assert(ctl && info && info->id.name[0]);
+       return ctl->ops->element_replace(ctl, info);
+}
+
+/**
+ * \brief Remove an user CTL element
+ * \param ctl CTL handle
+ * \param id CTL element identification
+ * \return 0 on success otherwise a negative error code
+ *
+ * Note that the new element is locked!
+ */
+int snd_ctl_elem_remove(snd_ctl_t *ctl, snd_ctl_elem_id_t *id)
+{
+       assert(ctl && id && (id->name[0] || id->numid));
+       return ctl->ops->element_remove(ctl, id);
+}
+
+/**
  * \brief Get CTL element value
  * \param ctl CTL handle
  * \param control CTL element id/value pointer

Index: control_hw.c
===================================================================
RCS file: /cvsroot/alsa/alsa-lib/src/control/control_hw.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- control_hw.c        25 Jul 2003 17:02:01 -0000      1.38
+++ control_hw.c        21 Oct 2003 17:39:15 -0000      1.39
@@ -39,7 +39,7 @@
 #endif
 
 #define SNDRV_FILE_CONTROL     "/dev/snd/controlC%i"
-#define SNDRV_CTL_VERSION_MAX  SNDRV_PROTOCOL_VERSION(2, 0, 2)
+#define SNDRV_CTL_VERSION_MAX  SNDRV_PROTOCOL_VERSION(2, 0, 3)
 
 typedef struct {
        int card;
@@ -142,6 +142,30 @@
        return 0;
 }
 
+static int snd_ctl_hw_elem_add(snd_ctl_t *handle, snd_ctl_elem_info_t *info)
+{
+       snd_ctl_hw_t *hw = handle->private_data;
+       if (ioctl(hw->fd, SNDRV_CTL_IOCTL_ELEM_ADD, info) < 0)
+               return -errno;
+       return 0;
+}
+
+static int snd_ctl_hw_elem_replace(snd_ctl_t *handle, snd_ctl_elem_info_t *info)
+{
+       snd_ctl_hw_t *hw = handle->private_data;
+       if (ioctl(hw->fd, SNDRV_CTL_IOCTL_ELEM_REPLACE, info) < 0)
+               return -errno;
+       return 0;
+}
+
+static int snd_ctl_hw_elem_remove(snd_ctl_t *handle, snd_ctl_elem_id_t *id)
+{
+       snd_ctl_hw_t *hw = handle->private_data;
+       if (ioctl(hw->fd, SNDRV_CTL_IOCTL_ELEM_REMOVE, id) < 0)
+               return -errno;
+       return 0;
+}
+
 static int snd_ctl_hw_elem_read(snd_ctl_t *handle, snd_ctl_elem_value_t *control)
 {
        snd_ctl_hw_t *hw = handle->private_data;
@@ -272,6 +296,9 @@
        .card_info = snd_ctl_hw_card_info,
        .element_list = snd_ctl_hw_elem_list,
        .element_info = snd_ctl_hw_elem_info,
+       .element_add = snd_ctl_hw_elem_add,
+       .element_replace = snd_ctl_hw_elem_replace,
+       .element_remove = snd_ctl_hw_elem_remove,
        .element_read = snd_ctl_hw_elem_read,
        .element_write = snd_ctl_hw_elem_write,
        .element_lock = snd_ctl_hw_elem_lock,

Index: control_local.h
===================================================================
RCS file: /cvsroot/alsa/alsa-lib/src/control/control_local.h,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- control_local.h     7 Nov 2002 15:18:47 -0000       1.29
+++ control_local.h     21 Oct 2003 17:39:15 -0000      1.30
@@ -29,6 +29,9 @@
        int (*card_info)(snd_ctl_t *handle, snd_ctl_card_info_t *info);
        int (*element_list)(snd_ctl_t *handle, snd_ctl_elem_list_t *list);
        int (*element_info)(snd_ctl_t *handle, snd_ctl_elem_info_t *info);
+       int (*element_add)(snd_ctl_t *handle, snd_ctl_elem_info_t *info);
+       int (*element_replace)(snd_ctl_t *handle, snd_ctl_elem_info_t *info);
+       int (*element_remove)(snd_ctl_t *handle, snd_ctl_elem_id_t *id);
        int (*element_read)(snd_ctl_t *handle, snd_ctl_elem_value_t *control);
        int (*element_write)(snd_ctl_t *handle, snd_ctl_elem_value_t *control);
        int (*element_lock)(snd_ctl_t *handle, snd_ctl_elem_id_t *lock);



-------------------------------------------------------
This SF.net email is sponsored by OSDN developer relations
Here's your chance to show off your extensive product knowledge
We want to know what you know. Tell us and you have a chance to win $100
http://www.zoomerang.com/survey.zgi?HRPT1X3RYQNC5V4MLNSV3E54
_______________________________________________
Alsa-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-cvslog

Reply via email to