]> git.alsa-project.org Git - alsa-gobject.git/commitdiff
seq: user_client: add an API to create port with indicated numerical ID
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Sun, 14 Jun 2020 11:08:19 +0000 (20:08 +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/alsaseq.map
src/seq/user-client.c
src/seq/user-client.h
tests/alsaseq-user-client

index 131289b6c786d2590be6ab66da0d61b05f953072..e0c88215dc2fa7f60a245d89cece57e118cc56a2 100644 (file)
@@ -45,6 +45,7 @@ ALSA_GOBJECT_0_0_0 {
     "alsaseq_user_client_set_info";
     "alsaseq_user_client_get_info";
     "alsaseq_user_client_create_port";
+    "alsaseq_user_client_create_port_at";
     "alsaseq_user_client_update_port";
     "alsaseq_user_client_delete_port";
     "alsaseq_user_client_set_pool";
index dd3f877436079a1fd95660834a1a1c548e92efab..a9b8cfb62cee751be0e42257e020069b2ad7c2a1 100644 (file)
@@ -270,6 +270,35 @@ void alsaseq_user_client_create_port(ALSASeqUserClient *self,
         generate_error(error, errno);
 }
 
+/**
+ * alsaseq_user_client_create_port_at:
+ * @self: A #ALSASeqUserClient.
+ * @port_info: (inout): A #ALSASeqPortInfo.
+ * @port_id: The numerical ID of port to create.
+ * @error: A #GError.
+ *
+ * Create a port into the client with the given numerical port ID.
+ *
+ * The call of function executes ioctl(2) system call with
+ * SNDRV_SEQ_IOCTL_CREATE_PORT command for ALSA sequencer character device.
+ */
+void alsaseq_user_client_create_port_at(ALSASeqUserClient *self,
+                                        ALSASeqPortInfo *const *port_info,
+                                        guint8 port_id, GError **error)
+{
+    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));
+
+    seq_port_info_refer_private(*port_info, &info);
+
+    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_update_port:
  * @self: A #ALSASeqUserClient.
index b11a094d302a999bb97269aa44e4bdb9cc5cb240..f17557977328dfd72f52717bae6999733a92b83e 100644 (file)
@@ -84,6 +84,9 @@ void alsaseq_user_client_get_info(ALSASeqUserClient *self,
 void alsaseq_user_client_create_port(ALSASeqUserClient *self,
                                      ALSASeqPortInfo *port_info,
                                      const guint8 *port_id, GError **error);
+void alsaseq_user_client_create_port_at(ALSASeqUserClient *self,
+                                        ALSASeqPortInfo *const *port_info,
+                                        guint8 port_id, GError **error);
 
 void alsaseq_user_client_update_port(ALSASeqUserClient *self,
                                      ALSASeqPortInfo *port_info,
index a7384c46175ddd88f5dfbf341b9ecb71f918a3d5..dbe508c56aeb0925b5a5dc07c9164c4ee8913d5a 100644 (file)
@@ -19,6 +19,7 @@ methods = (
     'set_info',
     'get_info',
     'create_port',
+    'create_port_at',
     'update_port',
     'delete_port',
     'set_pool',