]> git.alsa-project.org Git - alsa-gobject.git/commitdiff
rawmidi: substream_params: add object to represent parameters of attached substream
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Mon, 18 Nov 2019 04:22:44 +0000 (13:22 +0900)
committer坂本 貴史 <o-takashi@sakamocchi.jp>
Sun, 12 Apr 2020 05:30:33 +0000 (14:30 +0900)
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
src/rawmidi/alsarawmidi.map
src/rawmidi/meson.build
src/rawmidi/substream-params.c [new file with mode: 0644]
src/rawmidi/substream-params.h [new file with mode: 0644]
tests/alsarawmidi-substream-params [new file with mode: 0644]
tests/meson.build

index cc7edd7cfb3e2c9c9e09d482f3873abaa7e214a4..a29d26e08ded8b05fef641f07582e679d5bd0d9a 100644 (file)
@@ -15,6 +15,9 @@ ALSA_GOBJECT_0_0_0 {
     "alsarawmidi_stream_pair_new";
     "alsarawmidi_stream_pair_open";
     "alsarawmidi_stream_pair_get_substream_info";
+
+    "alsarawmidi_substream_params_get_type";
+    "alsarawmidi_substream_params_new";
   local:
     *;
 };
index b686511f616ca9e3598ab4c0f80b8aafab4e46a7..cf845f8cf31c5ba53b405f7f503ad98952718005 100644 (file)
@@ -12,12 +12,14 @@ sources = files(
   'query.c',
   'substream-info.c',
   'stream-pair.c',
+  'substream-params.c',
 )
 
 headers = files(
   'query.h',
   'substream-info.h',
   'stream-pair.h',
+  'substream-params.h',
 )
 
 privates = files(
diff --git a/src/rawmidi/substream-params.c b/src/rawmidi/substream-params.c
new file mode 100644 (file)
index 0000000..c08769b
--- /dev/null
@@ -0,0 +1,24 @@
+// SPDX-License-Identifier: LGPL-3.0-or-later
+#include "substream-params.h"
+
+G_DEFINE_TYPE(ALSARawmidiSubstreamParams, alsarawmidi_substream_params, G_TYPE_OBJECT)
+
+static void alsarawmidi_substream_params_class_init(ALSARawmidiSubstreamParamsClass *klass)
+{
+    return;
+}
+
+static void alsarawmidi_substream_params_init(ALSARawmidiSubstreamParams *self)
+{
+    return;
+}
+
+/**
+ * alsarawmidi_substream_params_new:
+ *
+ * Allocate and return an instance of ALSARawmidiSubstreamParams class.
+ */
+ALSARawmidiSubstreamParams *alsarawmidi_substream_params_new()
+{
+    return g_object_new(ALSARAWMIDI_TYPE_SUBSTREAM_PARAMS, NULL);
+}
diff --git a/src/rawmidi/substream-params.h b/src/rawmidi/substream-params.h
new file mode 100644 (file)
index 0000000..a8deb52
--- /dev/null
@@ -0,0 +1,49 @@
+// SPDX-License-Identifier: LGPL-3.0-or-later
+#ifndef __ALSA_GOBJECT_ALSARAWMIDI_SUBSTREAM_PARAMS__H__
+#define __ALSA_GOBJECT_ALSARAWMIDI_SUBSTREAM_PARAMS__H__
+
+#include <glib.h>
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define ALSARAWMIDI_TYPE_SUBSTREAM_PARAMS (alsarawmidi_substream_params_get_type())
+
+#define ALSARAWMIDI_SUBSTREAM_PARAMS(obj)                           \
+    (G_TYPE_CHECK_INSTANCE_CAST((obj),                              \
+                                ALSARAWMIDI_TYPE_SUBSTREAM_PARAMS,  \
+                                ALSARawmidiSubstreamParams))
+#define ALSARAWMIDI_IS_SUBSTREAM_PARAMS(obj)                        \
+    (G_TYPE_CHECK_INSTANCE_TYPE((obj),                              \
+                                ALSARAWMIDI_TYPE_SUBSTREAM_PARAMS))
+
+#define ALSARAWMIDI_SUBSTREAM_PARAMS_CLASS(klass)                   \
+    (G_TYPE_CHECK_CLASS_CAST((klass),                               \
+                             ALSARAWMIDI_TYPE_SUBSTREAM_PARAMS,     \
+                             ALSARawmidiSubstreamParamsClass))
+#define ALSARAWMIDI_IS_SUBSTREAM_PARAMS_CLASS(klass)                \
+    (G_TYPE_CHECK_CLASS_TYPE((klass),                               \
+                             ALSARAWMIDI_TYPE_SUBSTREAM_PARAMS))
+#define ALSARAWMIDI_SUBSTREAM_PARAMS_GET_CLASS(obj)                 \
+    (G_TYPE_INSTANCE_GET_CLASS((obj),                               \
+                               ALSARAWMIDI_TYPE_SUBSTREAM_PARAMS,   \
+                               ALSARawmidiSubstreamParamsClass))
+
+typedef struct _ALSARawmidiSubstreamParams          ALSARawmidiSubstreamParams;
+typedef struct _ALSARawmidiSubstreamParamsClass     ALSARawmidiSubstreamParamsClass;
+
+struct _ALSARawmidiSubstreamParams {
+    GObject parent_instance;
+};
+
+struct _ALSARawmidiSubstreamParamsClass {
+    GObjectClass parent_class;
+};
+
+GType alsarawmidi_substream_params_get_type(void) G_GNUC_CONST;
+
+ALSARawmidiSubstreamParams *alsarawmidi_substream_params_new();
+
+G_END_DECLS
+
+#endif
diff --git a/tests/alsarawmidi-substream-params b/tests/alsarawmidi-substream-params
new file mode 100644 (file)
index 0000000..8212a82
--- /dev/null
@@ -0,0 +1,20 @@
+#!/usr/bin/env python3
+
+from sys import exit
+from errno import ENXIO
+
+from helper import test
+
+import gi
+gi.require_version('ALSARawmidi', '0.0')
+from gi.repository import ALSARawmidi
+
+target = ALSARawmidi.SubstreamParams()
+props = ()
+methods = (
+    'new',
+)
+signals = ()
+
+if not test(target, props, methods, signals):
+    exit(ENXIO)
index 38d192b708f29fdb7059138673d88deedbc83c63..bf4b7f5bbf5900db7db3625b68c145819797dac9 100644 (file)
@@ -53,6 +53,7 @@ tests = {
     'alsarawmidi-enums',
     'alsarawmidi-substream-info',
     'alsarawmidi-stream-pair',
+    'alsarawmidi-substream-params',
   ],
 }