]> git.alsa-project.org Git - alsa-gobject.git/commitdiff
seq: addr: add accessor methods and constructors
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Wed, 1 Apr 2020 09:13:28 +0000 (18:13 +0900)
committer坂本 貴史 <o-takashi@sakamocchi.jp>
Fri, 3 Apr 2020 13:06:25 +0000 (22:06 +0900)
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
src/seq/addr.c
src/seq/addr.h
src/seq/alsaseq.map

index 242826a65b3c078a1b964179f6b5548c8a1ea1b4..f7599b76e3094bd0c1cb44d3ecd7e450a5ba68b0 100644 (file)
@@ -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;
+}
index 6844697c229857e50737874cb7b84b6beaf481af..1bf2f460e0ba67a95f9115ed45060804bbba45bc 100644 (file)
@@ -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
index a39fa39a99939506ac2fa3e46cbab5322764c6b6..798d74a408ae7cc0461e04c9ba6a0be8b201dd17 100644 (file)
@@ -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:
     *;
 };