From: Takashi Sakamoto Date: Wed, 1 Apr 2020 09:13:28 +0000 (+0900) Subject: seq: addr: add accessor methods and constructors X-Git-Tag: v0.1.0~294 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=6d52aed50e3fd3d45f285b2f4d1b355ecf9e0731;p=alsa-gobject.git seq: addr: add accessor methods and constructors Signed-off-by: Takashi Sakamoto --- diff --git a/src/seq/addr.c b/src/seq/addr.c index 242826a..f7599b7 100644 --- a/src/seq/addr.c +++ b/src/seq/addr.c @@ -7,3 +7,46 @@ ALSASeqAddr *seq_addr_copy(const ALSASeqAddr *self) } G_DEFINE_BOXED_TYPE(ALSASeqAddr, alsaseq_addr, seq_addr_copy, g_free) + +/** + * alsaseq_addr_new: + * @client_id: The numerical ID of client to address. + * @port_id: The numerical ID of port to address. + * + * Allocate and return an instance of ALSASeqAddr. + * + * Returns: (transfer full): A #ALSASeqAddr. + */ +ALSASeqAddr *alsaseq_addr_new(guint8 client_id, guint8 port_id) +{ + ALSASeqAddr *self = g_malloc0(sizeof(*self)); + + self->client = client_id; + self->port = port_id; + + return self; +} + +/** + * alsaseq_addr_get_client_id: + * @self: A #ALSASeqAddr. + * @client_id: (out): The numerical ID of client to address. + * + * Get the numerical ID of client to address. + */ +void alsaseq_addr_get_client_id(const ALSASeqAddr *self, guint8 *client_id) +{ + *client_id = self->client; +} + +/** + * alsaseq_addr_get_port_id: + * @self: A #ALSASeqAddr. + * @port_id: (out): The numerical ID of port to address. + * + * Get the numerical ID of port to address. + */ +void alsaseq_addr_get_port_id(const ALSASeqAddr *self, guint8 *port_id) +{ + *port_id = self->port; +} diff --git a/src/seq/addr.h b/src/seq/addr.h index 6844697..1bf2f46 100644 --- a/src/seq/addr.h +++ b/src/seq/addr.h @@ -15,6 +15,12 @@ typedef struct snd_seq_addr ALSASeqAddr; GType alsaseq_addr_get_type() G_GNUC_CONST; +ALSASeqAddr *alsaseq_addr_new(guint8 client_id, guint8 port_id); + +void alsaseq_addr_get_client_id(const ALSASeqAddr *self, guint8 *client_id); + +void alsaseq_addr_get_port_id(const ALSASeqAddr *self, guint8 *port_id); + G_END_DECLS #endif diff --git a/src/seq/alsaseq.map b/src/seq/alsaseq.map index a39fa39..798d74a 100644 --- a/src/seq/alsaseq.map +++ b/src/seq/alsaseq.map @@ -38,6 +38,8 @@ ALSA_GOBJECT_0_0_0 { "alsaseq_addr_get_type"; "alsaseq_addr_new"; + "alsaseq_addr_get_client_id"; + "alsaseq_addr_get_port_id"; local: *; };