]> git.alsa-project.org Git - alsa-gobject.git/commitdiff
seq: user_client: return filled object after creating port
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Sun, 14 Jun 2020 08:16:09 +0000 (17:16 +0900)
committer坂本 貴史 <o-takashi@sakamocchi.jp>
Sun, 14 Jun 2020 13:07:29 +0000 (22:07 +0900)
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
src/seq/user-client.c
src/seq/user-client.h

index a9b8cfb62cee751be0e42257e020069b2ad7c2a1..cb513071121158802896f042732721778be35048 100644 (file)
@@ -239,8 +239,7 @@ void alsaseq_user_client_get_info(ALSASeqUserClient *self,
 /**
  * alsaseq_user_client_create_port:
  * @self: A #ALSASeqUserClient.
- * @port_info: A #ALSASeqPortInfo.
- * @port_id: (nullable): The numerical ID of port if specified.
+ * @port_info: (inout): A #ALSASeqPortInfo.
  * @error: A #GError.
  *
  * Create a port into the client.
@@ -249,23 +248,19 @@ void alsaseq_user_client_get_info(ALSASeqUserClient *self,
  * SNDRV_SEQ_IOCTL_CREATE_PORT command for ALSA sequencer character device.
  */
 void alsaseq_user_client_create_port(ALSASeqUserClient *self,
-                                     ALSASeqPortInfo *port_info,
-                                     const guint8 *port_id, GError **error)
+                                     ALSASeqPortInfo *const *port_info,
+                                     GError **error)
 {
     ALSASeqUserClientPrivate *priv;
     struct snd_seq_port_info *info;
 
     g_return_if_fail(ALSASEQ_IS_USER_CLIENT(self));
-    g_return_if_fail(ALSASEQ_IS_PORT_INFO(port_info));
+    g_return_if_fail(ALSASEQ_IS_PORT_INFO(*port_info));
     priv = alsaseq_user_client_get_instance_private(self);
 
-    seq_port_info_refer_private(port_info, &info);
+    seq_port_info_refer_private(*port_info, &info);
 
     info->addr.client = priv->client_id;
-    if (port_id != NULL) {
-        info->addr.port = *port_id;
-        info->flags |= SNDRV_SEQ_PORT_FLG_GIVEN_PORT;
-    }
     if (ioctl(priv->fd, SNDRV_SEQ_IOCTL_CREATE_PORT, info) < 0)
         generate_error(error, errno);
 }
@@ -296,7 +291,7 @@ void alsaseq_user_client_create_port_at(ALSASeqUserClient *self,
     info->addr.port = port_id;
     info->flags |= SNDRV_SEQ_PORT_FLG_GIVEN_PORT;
 
-    alsaseq_user_client_create_port(self, *port_info, NULL, error);
+    alsaseq_user_client_create_port(self, port_info, error);
 }
 
 /**
index f17557977328dfd72f52717bae6999733a92b83e..0aae1b0304a46fa3ed663e0521330c66ebf20470 100644 (file)
@@ -82,8 +82,8 @@ void alsaseq_user_client_get_info(ALSASeqUserClient *self,
                                   GError **error);
 
 void alsaseq_user_client_create_port(ALSASeqUserClient *self,
-                                     ALSASeqPortInfo *port_info,
-                                     const guint8 *port_id, GError **error);
+                                     ALSASeqPortInfo *const *port_info,
+                                     GError **error);
 void alsaseq_user_client_create_port_at(ALSASeqUserClient *self,
                                         ALSASeqPortInfo *const *port_info,
                                         guint8 port_id, GError **error);