]> git.alsa-project.org Git - alsa-gobject.git/commitdiff
seq: addr: add API to compare two instances
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Wed, 15 Apr 2020 03:01:03 +0000 (12:01 +0900)
committer坂本 貴史 <o-takashi@sakamocchi.jp>
Wed, 22 Apr 2020 07:46:49 +0000 (16:46 +0900)
It's convenient to compare two instances of address in ALSA Sequencer.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
src/seq/addr.c
src/seq/addr.h
src/seq/alsaseq.map

index 67950d636ba508e6d085e49644ef6c55b4cd36e5..a4a1d560ab965cf9bd2d372d6be3f216607f4a1a 100644 (file)
@@ -50,3 +50,20 @@ void alsaseq_addr_get_port_id(const ALSASeqAddr *self, guint8 *port_id)
 {
     *port_id = self->port;
 }
+
+/**
+ * alsaseq_addr_equal:
+ * @self: A #ALSASeqAddr.
+ * @target: A #ALSASeqAddr to compare.
+ *
+ * Returns: whether the given object indicates the same element.
+ */
+gboolean alsaseq_addr_equal(const ALSASeqAddr *self, const ALSASeqAddr *target)
+{
+    const struct snd_seq_addr *lhs, *rhs;
+
+    lhs = (const struct snd_seq_addr *)self;
+    rhs = (const struct snd_seq_addr *)target;
+
+    return lhs->client == rhs->client && lhs->port == rhs->port;
+}
index 1bf2f460e0ba67a95f9115ed45060804bbba45bc..14628e1567004bc96b5b89b5ed34e7e32b7ad970 100644 (file)
@@ -21,6 +21,8 @@ void alsaseq_addr_get_client_id(const ALSASeqAddr *self, guint8 *client_id);
 
 void alsaseq_addr_get_port_id(const ALSASeqAddr *self, guint8 *port_id);
 
+gboolean alsaseq_addr_equal(const ALSASeqAddr *self, const ALSASeqAddr *target);
+
 G_END_DECLS
 
 #endif
index c1e6cc28eb5045cf05b8b1e491064081a5fe6d76..f002ff121bfaba4fe1a44c96d57346f0d4b568b8 100644 (file)
@@ -66,6 +66,7 @@ ALSA_GOBJECT_0_0_0 {
     "alsaseq_addr_new";
     "alsaseq_addr_get_client_id";
     "alsaseq_addr_get_port_id";
+    "alsaseq_addr_equal";
 
     "alsaseq_port_info_get_type";
     "alsaseq_port_info_new";