]> git.alsa-project.org Git - alsa-gobject.git/commitdiff
seq: event_cntr: add accesor APIs for the numerical ID of queue to deliver the event...
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Mon, 8 Jun 2020 14:10:10 +0000 (23:10 +0900)
committer坂本 貴史 <o-takashi@sakamocchi.jp>
Tue, 9 Jun 2020 00:16:09 +0000 (09:16 +0900)
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
src/seq/alsaseq.map
src/seq/event-cntr.c
src/seq/event-cntr.h
tests/alsaseq-event-cntr

index 88318a868fe5ea0aa13ef8903d39d9fa7c9e8966..e7f5b26c8016abd8b754f59a9637b50e2cc1dbbc 100644 (file)
@@ -186,6 +186,8 @@ ALSA_GOBJECT_0_0_0 {
     "alsaseq_event_cntr_set_priority_mode";
     "alsaseq_event_cntr_get_tag";
     "alsaseq_event_cntr_set_tag";
+    "alsaseq_event_cntr_get_queue_id";
+    "alsaseq_event_cntr_set_queue_id";
   local:
     *;
 };
index b6bccbf217ae774b2203025f2bd0a65724f00e8a..4b104bc64c361c7d9539606877e81c0e1adf5224 100644 (file)
@@ -543,3 +543,65 @@ void alsaseq_event_cntr_set_tag(ALSASeqEventCntr *self, gsize index,
 
     ev->tag = tag;
 }
+
+/**
+ * alsaseq_event_cntr_get_queue_id:
+ * @self: A #ALSASeqEventCntr.
+ * @index: The index of event to set.
+ * @queue_id: (out): The numerical ID of queue to deliver the event. One of
+ *                   #ALSASeqSpecificQueueId is available as well.
+ * @error: A #GError.
+ *
+ * Get the numerical ID of queue to deliver the event.
+ */
+void alsaseq_event_cntr_get_queue_id(ALSASeqEventCntr *self, gsize index,
+                                       guint8 *queue_id, GError **error)
+{
+    ALSASeqEventCntrPrivate *priv;
+    struct event_iterator iter;
+    struct snd_seq_event *ev;
+
+    g_return_if_fail(ALSASEQ_IS_EVENT_CNTR(self));
+    priv = alsaseq_event_cntr_get_instance_private(self);
+
+    event_iterator_init(&iter, priv->buf, priv->length, priv->allocated);
+
+    ev = event_iterator_find(&iter, index);
+    if (ev == NULL) {
+        generate_error(error, ENOENT);
+        return;
+    }
+
+    *queue_id = ev->queue;
+}
+
+/**
+ * alsaseq_event_cntr_set_queue_id:
+ * @self: A #ALSASeqEventCntr.
+ * @index: The index of event to set.
+ * @queue_id: The numerical ID of queue to deliver the event. One of
+ *            #ALSASeqSpecificQueueId is available as well.
+ * @error: A #GError.
+ *
+ * Set the numerical ID of queue to deliver the event.
+ */
+void alsaseq_event_cntr_set_queue_id(ALSASeqEventCntr *self, gsize index,
+                                       guint8 queue_id, GError **error)
+{
+    ALSASeqEventCntrPrivate *priv;
+    struct event_iterator iter;
+    struct snd_seq_event *ev;
+
+    g_return_if_fail(ALSASEQ_IS_EVENT_CNTR(self));
+    priv = alsaseq_event_cntr_get_instance_private(self);
+
+    event_iterator_init(&iter, priv->buf, priv->length, priv->allocated);
+
+    ev = event_iterator_find(&iter, index);
+    if (ev == NULL) {
+        generate_error(error, ENOENT);
+        return;
+    }
+
+    ev->queue = queue_id;
+}
index 8ffbfd8d79ec99ba10eaa9f8944be027374ad1ad..755e2e6e05ff9693d54a72d81a62884e1086bd01 100644 (file)
@@ -90,6 +90,11 @@ void alsaseq_event_cntr_get_tag(ALSASeqEventCntr *self, gsize index,
 void alsaseq_event_cntr_set_tag(ALSASeqEventCntr *self, gsize index,
                                   gint8 tag, GError **error);
 
+void alsaseq_event_cntr_get_queue_id(ALSASeqEventCntr *self, gsize index,
+                                       guint8 *queue_id, GError **error);
+void alsaseq_event_cntr_set_queue_id(ALSASeqEventCntr *self, gsize index,
+                                       guint8 queue_id, GError **error);
+
 G_END_DECLS
 
 #endif
index e5e5a9e5f3777adc3f42fb7381c11ecee93ff6a3..0b9b369564a758f1f894ff4822520aaa2350f25e 100644 (file)
@@ -26,6 +26,8 @@ methods = (
     'set_priority_mode',
     'get_tag',
     'set_tag',
+    'get_queue_id',
+    'set_queue_id',
 )
 signals = ()