]> git.alsa-project.org Git - alsa-gobject.git/commitdiff
seq: event_variable: add GObject object for event with variable length data
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/alsaseq.map
src/seq/event-variable.c [new file with mode: 0644]
src/seq/event-variable.h [new file with mode: 0644]
src/seq/meson.build
tests/alsaseq-event-variable [new file with mode: 0644]
tests/meson.build

index 92dd9d9a4da8f772ce699003b498bec6b5711bfc..a3ecbe080741fd79c964c4db90564d441f16c7fe 100644 (file)
@@ -63,6 +63,8 @@ ALSA_GOBJECT_0_0_0 {
 
     "alsaseq_event_fixed_get_type";
     "alsaseq_event_fixed_new";
+
+    "alsaseq_event_variable_get_type";
   local:
     *;
 };
diff --git a/src/seq/event-variable.c b/src/seq/event-variable.c
new file mode 100644 (file)
index 0000000..7cb192f
--- /dev/null
@@ -0,0 +1,14 @@
+// SPDX-License-Identifier: LGPL-3.0-or-later
+#include "event-variable.h"
+
+G_DEFINE_TYPE(ALSASeqEventVariable, alsaseq_event_variable, ALSASEQ_TYPE_EVENT)
+
+static void alsaseq_event_variable_class_init(ALSASeqEventVariableClass *klass)
+{
+    return;
+}
+
+static void alsaseq_event_variable_init(ALSASeqEventVariable *self)
+{
+    return;
+}
diff --git a/src/seq/event-variable.h b/src/seq/event-variable.h
new file mode 100644 (file)
index 0000000..9ca9303
--- /dev/null
@@ -0,0 +1,49 @@
+// SPDX-License-Identifier: LGPL-3.0-or-later
+#ifndef __ALSA_GOBJECT_ALSASEQ_EVENT_VARIABLE_H__
+#define __ALSA_GOBJECT_ALSASEQ_EVENT_VARIABLE_H__
+
+#include <glib.h>
+#include <glib-object.h>
+
+#include <seq/event.h>
+
+G_BEGIN_DECLS
+
+#define ALSASEQ_TYPE_EVENT_VARIABLE     (alsaseq_event_variable_get_type())
+
+#define ALSASEQ_EVENT_VARIABLE(obj)                             \
+    (G_TYPE_CHECK_INSTANCE_CAST((obj),                          \
+                                ALSASEQ_TYPE_EVENT_VARIABLE,    \
+                                ALSASeqEventVariable))
+#define ALSASEQ_IS_EVENT_VARIABLE(obj)                          \
+    (G_TYPE_CHECK_INSTANCE_TYPE((obj),                          \
+                                ALSASEQ_TYPE_EVENT_VARIABLE))
+
+#define ALSASEQ_EVENT_VARIABLE_CLASS(klass)                     \
+    (G_TYPE_CHECK_CLASS_CAST((klass),                           \
+                             ALSASEQ_TYPE_EVENT_VARIABLE,       \
+                             ALSASeqEventVariableClass))
+#define ALSASEQ_IS_EVENT_VARIABLE_CLASS(klass)                  \
+    (G_TYPE_CHECK_CLASS_TYPE((klass),                           \
+                             ALSASEQ_TYPE_EVENT_VARIABLE))
+#define ALSASEQ_EVENT_VARIABLE_GET_CLASS(obj)                   \
+    (G_TYPE_INSTANCE_GET_CLASS((obj),                           \
+                               ALSASEQ_TYPE_EVENT_VARIABLE,     \
+                               ALSASeqEventVariableClass))
+
+typedef struct _ALSASeqEventVariable        ALSASeqEventVariable;
+typedef struct _ALSASeqEventVariableClass   ALSASeqEventVariableClass;
+
+struct _ALSASeqEventVariable {
+    ALSASeqEvent parent_instance;
+};
+
+struct _ALSASeqEventVariableClass {
+    ALSASeqEventClass parent_class;
+};
+
+GType alsaseq_event_variable_get_type() G_GNUC_CONST;
+
+G_END_DECLS
+
+#endif
index c249c752e9abf79b2c348cf5d5e263febdc7fd97..91a2db695419dfce02251fbb299abb2ce0c18593 100644 (file)
@@ -19,6 +19,7 @@ sources = files(
   'tstamp.c',
   'event.c',
   'event-fixed.c',
+  'event-variable.c',
 )
 
 headers = files(
@@ -32,6 +33,7 @@ headers = files(
   'tstamp.h',
   'event.h',
   'event-fixed.h',
+  'event-variable.h',
 )
 
 privates = files(
diff --git a/tests/alsaseq-event-variable b/tests/alsaseq-event-variable
new file mode 100644 (file)
index 0000000..f28a42a
--- /dev/null
@@ -0,0 +1,19 @@
+#!/usr/bin/env python3
+
+from sys import exit
+from errno import ENXIO
+
+from helper import test
+
+import gi
+gi.require_version('ALSASeq', '0.0')
+from gi.repository import ALSASeq
+
+target = ALSASeq.EventVariable()
+props = ()
+methods = ()
+signals = ()
+
+if not test(target, props, methods, signals):
+    exit(ENXIO)
+
index fe1335b360479235342db5c52910c0a514f27421..b81326cd60e9a028e23a24e479e143e290bd8fa2 100644 (file)
@@ -37,6 +37,7 @@ tests = {
     'alsaseq-client-pool',
     'alsaseq-event',
     'alsaseq-event-fixed',
+    'alsaseq-event-variable',
   ],
 }