From: Takashi Sakamoto Date: Sun, 14 Jun 2020 11:08:19 +0000 (+0900) Subject: seq: user_client: add an API to create port with indicated numerical ID X-Git-Tag: v0.1.0~46 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=2e27187446d63c8b69cf0337ef90b4c76f16c01f;p=alsa-gobject.git seq: user_client: add an API to create port with indicated numerical ID Signed-off-by: Takashi Sakamoto --- diff --git a/src/seq/alsaseq.map b/src/seq/alsaseq.map index 131289b..e0c8821 100644 --- a/src/seq/alsaseq.map +++ b/src/seq/alsaseq.map @@ -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"; diff --git a/src/seq/user-client.c b/src/seq/user-client.c index dd3f877..a9b8cfb 100644 --- a/src/seq/user-client.c +++ b/src/seq/user-client.c @@ -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. diff --git a/src/seq/user-client.h b/src/seq/user-client.h index b11a094..f175579 100644 --- a/src/seq/user-client.h +++ b/src/seq/user-client.h @@ -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, diff --git a/tests/alsaseq-user-client b/tests/alsaseq-user-client index a7384c4..dbe508c 100644 --- a/tests/alsaseq-user-client +++ b/tests/alsaseq-user-client @@ -19,6 +19,7 @@ methods = ( 'set_info', 'get_info', 'create_port', + 'create_port_at', 'update_port', 'delete_port', 'set_pool',