From: Takashi Sakamoto Date: Mon, 8 Jun 2020 14:10:10 +0000 (+0900) Subject: seq: event_fixed: dismiss ALSASeqEventFixed X-Git-Tag: v0.1.0~107 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=762ff8483cb59c59cc1857c684edff504f1d7ef7;p=alsa-gobject.git seq: event_fixed: dismiss ALSASeqEventFixed Signed-off-by: Takashi Sakamoto --- diff --git a/doc/reference/seq/alsaseq-docs.xml b/doc/reference/seq/alsaseq-docs.xml index deda322..58ab9d4 100644 --- a/doc/reference/seq/alsaseq-docs.xml +++ b/doc/reference/seq/alsaseq-docs.xml @@ -42,7 +42,6 @@ - diff --git a/doc/reference/seq/alsaseq.types b/doc/reference/seq/alsaseq.types index ed8beb6..d1cac7a 100644 --- a/doc/reference/seq/alsaseq.types +++ b/doc/reference/seq/alsaseq.types @@ -7,7 +7,6 @@ alsaseq_event_data_ctl_get_type alsaseq_event_data_note_get_type alsaseq_event_data_queue_get_type alsaseq_event_data_result_get_type -alsaseq_event_fixed_get_type alsaseq_event_get_type alsaseq_event_length_mode_get_type alsaseq_event_priority_mode_get_type diff --git a/src/seq/alsaseq.map b/src/seq/alsaseq.map index c16127b..9c3fbfd 100644 --- a/src/seq/alsaseq.map +++ b/src/seq/alsaseq.map @@ -81,13 +81,6 @@ ALSA_GOBJECT_0_0_0 { "alsaseq_event_get_type"; - "alsaseq_event_fixed_get_type"; - "alsaseq_event_fixed_new"; - "alsaseq_event_fixed_get_byte_data"; - "alsaseq_event_fixed_set_byte_data"; - "alsaseq_event_fixed_get_quadlet_data"; - "alsaseq_event_fixed_set_quadlet_data"; - "alsaseq_event_data_result_get_type"; "alsaseq_event_data_result_get_event"; "alsaseq_event_data_result_set_event"; diff --git a/src/seq/event-data-connect.c b/src/seq/event-data-connect.c index 44e3b1e..1ec8457 100644 --- a/src/seq/event-data-connect.c +++ b/src/seq/event-data-connect.c @@ -7,8 +7,7 @@ * @Short_description: A boxed object to represent data of connect event * * A #ALSASeqEventDataConnect is a boxed object to represent data of connect - * event. The instance of object is one of data properties in - * #ALSASeqEventFixed. + * event. The instance of object is one of data properties in event. * * The object wraps 'struct snd_seq_connect' in UAPI of Linux sound subsystem. */ diff --git a/src/seq/event-data-ctl.c b/src/seq/event-data-ctl.c index 266abf4..1cbbefa 100644 --- a/src/seq/event-data-ctl.c +++ b/src/seq/event-data-ctl.c @@ -7,8 +7,7 @@ * @Short_description: A boxed object to represent data of control event * * A #ALSASeqEventDataCtl is a boxed object to represent data of control - * event. The instance of object is one of data properties in - * #ALSASeqEventFixed. + * event. The instance of object is one of data properties in event. * * The object wraps 'struct snd_seq_ev_ctrl' in UAPI of Linux sound subsystem. */ diff --git a/src/seq/event-data-note.c b/src/seq/event-data-note.c index 3779638..19cc517 100644 --- a/src/seq/event-data-note.c +++ b/src/seq/event-data-note.c @@ -7,7 +7,7 @@ * @Short_description: A boxed object to represent data of note event * * A #ALSASeqEventDataNote is a boxed object to represent data of note event. - * The instance of object is one of data properties in #ALSASeqEventFixed. + * The instance of object is one of data properties in event. * * The object wraps 'struct snd_seq_ev_note' in UAPI of Linux sound subsystem. */ diff --git a/src/seq/event-data-queue.c b/src/seq/event-data-queue.c index 5dad16b..5b5b4c0 100644 --- a/src/seq/event-data-queue.c +++ b/src/seq/event-data-queue.c @@ -7,7 +7,7 @@ * @Short_description: A boxed object to represent data of queue event * * A #ALSASeqEventDataQueue is a boxed object to represent data of queue event. - * The instance of object is one of data properties in #ALSASeqEventFixed. + * The instance of object is one of data properties in event. * * The object wraps 'struct snd_seq_ev_queue_control' in UAPI of Linux sound * subsystem. diff --git a/src/seq/event-data-result.c b/src/seq/event-data-result.c index 6cf376a..fc11834 100644 --- a/src/seq/event-data-result.c +++ b/src/seq/event-data-result.c @@ -7,8 +7,7 @@ * @Short_description: A boxed object to represent data of result event * * A #ALSASeqEventDataResult is a boxed object to represent data of result - * event. The instance of object is one of data properties in - * #ALSASeqEventFixed. + * event. The instance of object is one of data properties in event. * * The object wraps 'struct snd_seq_result' in UAPI of Linux sound subsystem. */ diff --git a/src/seq/event-fixed.c b/src/seq/event-fixed.c deleted file mode 100644 index f5355b4..0000000 --- a/src/seq/event-fixed.c +++ /dev/null @@ -1,308 +0,0 @@ -// SPDX-License-Identifier: LGPL-3.0-or-later -#include "event-fixed.h" -#include "privates.h" - -#include - -/** - * SECTION: event-fixed - * @Title: ALSASeqEventFixed - * @Short_description: A GObject-derived object to represent event with the - * various kind of fixed-size data. - * - * A #ALSASeqEventFixed is a GObject-derived object to represent event with the - * various kind of fixed-size data. The object has several properties to access - * to the data. The object inherits properties and methods from #ALSASeqEvent. - */ -G_DEFINE_TYPE(ALSASeqEventFixed, alsaseq_event_fixed, ALSASEQ_TYPE_EVENT) - -enum seq_event_fixed_prop_type { - SEQ_EVENT_FIXED_PROP_RESULT_DATA = 1, - SEQ_EVENT_FIXED_PROP_NOTE_DATA, - SEQ_EVENT_FIXED_PROP_CTL_DATA, - SEQ_EVENT_FIXED_PROP_QUEUE_DATA, - SEQ_EVENT_FIXED_PROP_ADDR_DATA, - SEQ_EVENT_FIXED_PROP_CONNECT_DATA, - SEQ_EVENT_FIXED_PROP_TSTAMP_DATA, - SEQ_EVENT_FIXED_PROP_COUNT, -}; -static GParamSpec *seq_event_fixed_props[SEQ_EVENT_FIXED_PROP_COUNT] = { NULL, }; - -static void seq_event_fixed_set_property(GObject *obj, guint id, - const GValue *val, GParamSpec *spec) -{ - ALSASeqEvent *parent = ALSASEQ_EVENT(obj); - struct snd_seq_event *ev; - seq_event_refer_private(parent, &ev); - - switch (id) { - case SEQ_EVENT_FIXED_PROP_RESULT_DATA: - { - ALSASeqEventDataResult *data = g_value_get_boxed(val); - if (data != NULL) - ev->data.result = *data; - break; - } - case SEQ_EVENT_FIXED_PROP_NOTE_DATA: - { - ALSASeqEventDataNote *data = g_value_get_boxed(val); - if (data != NULL) - ev->data.note = *data; - break; - } - case SEQ_EVENT_FIXED_PROP_CTL_DATA: - { - ALSASeqEventDataCtl *data = g_value_get_boxed(val); - if (data != NULL) - ev->data.control = *data; - break; - } - case SEQ_EVENT_FIXED_PROP_QUEUE_DATA: - { - ALSASeqEventDataQueue *data = g_value_get_boxed(val); - if (data != NULL) - ev->data.queue = *data; - break; - } - case SEQ_EVENT_FIXED_PROP_ADDR_DATA: - { - ALSASeqAddr *data = g_value_get_boxed(val); - if (data != NULL) - ev->data.addr = *data; - break; - } - case SEQ_EVENT_FIXED_PROP_CONNECT_DATA: - { - ALSASeqEventDataConnect *data = g_value_get_boxed(val); - if (data != NULL) - ev->data.connect = *data; - break; - } - case SEQ_EVENT_FIXED_PROP_TSTAMP_DATA: - { - ALSASeqTstamp *data = g_value_get_boxed(val); - if (data != NULL) - ev->data.time = *data; - break; - } - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, id, spec); - break; - } -} - -static void seq_event_fixed_get_property(GObject *obj, guint id, GValue *val, - GParamSpec *spec) -{ - ALSASeqEvent *parent = ALSASEQ_EVENT(obj); - struct snd_seq_event *ev; - seq_event_refer_private(parent, &ev); - - switch (id) { - case SEQ_EVENT_FIXED_PROP_RESULT_DATA: - g_value_set_static_boxed(val, &ev->data.result); - break; - case SEQ_EVENT_FIXED_PROP_NOTE_DATA: - g_value_set_static_boxed(val, &ev->data.note); - break; - case SEQ_EVENT_FIXED_PROP_CTL_DATA: - g_value_set_static_boxed(val, &ev->data.control); - break; - case SEQ_EVENT_FIXED_PROP_QUEUE_DATA: - g_value_set_static_boxed(val, &ev->data.queue); - break; - case SEQ_EVENT_FIXED_PROP_ADDR_DATA: - g_value_set_static_boxed(val, &ev->data.addr); - break; - case SEQ_EVENT_FIXED_PROP_CONNECT_DATA: - g_value_set_static_boxed(val, &ev->data.connect); - break; - case SEQ_EVENT_FIXED_PROP_TSTAMP_DATA: - g_value_set_static_boxed(val, &ev->data.time); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, id, spec); - break; - } -} - -static void alsaseq_event_fixed_class_init(ALSASeqEventFixedClass *klass) -{ - GObjectClass *gobject_class = G_OBJECT_CLASS(klass); - - gobject_class->set_property = seq_event_fixed_set_property; - gobject_class->get_property = seq_event_fixed_get_property; - - seq_event_fixed_props[SEQ_EVENT_FIXED_PROP_RESULT_DATA] = - g_param_spec_boxed("result-data", "result-data", - "The data of result type. This shares the same " - "storage between the other properties", - ALSASEQ_TYPE_EVENT_DATA_RESULT, - G_PARAM_READWRITE); - - seq_event_fixed_props[SEQ_EVENT_FIXED_PROP_NOTE_DATA] = - g_param_spec_boxed("note-data", "note-data", - "The data of note type. This shares the same " - "storage between the other properties", - ALSASEQ_TYPE_EVENT_DATA_NOTE, - G_PARAM_READWRITE); - - seq_event_fixed_props[SEQ_EVENT_FIXED_PROP_CTL_DATA] = - g_param_spec_boxed("ctl-data", "ctl-data", - "The data of ctl type. This shares the same " - "storage between the other properties", - ALSASEQ_TYPE_EVENT_DATA_CTL, - G_PARAM_READWRITE); - - seq_event_fixed_props[SEQ_EVENT_FIXED_PROP_QUEUE_DATA] = - g_param_spec_boxed("queue-data", "queue-data", - "The data of queue type. This shares the same " - "storage between the other properties", - ALSASEQ_TYPE_EVENT_DATA_QUEUE, - G_PARAM_READWRITE); - - seq_event_fixed_props[SEQ_EVENT_FIXED_PROP_ADDR_DATA] = - g_param_spec_boxed("addr-data", "addr-data", - "The data of addr type. This shares the same " - "storage between the other properties", - ALSASEQ_TYPE_ADDR, - G_PARAM_READWRITE); - - seq_event_fixed_props[SEQ_EVENT_FIXED_PROP_CONNECT_DATA] = - g_param_spec_boxed("connect-data", "connect-data", - "The data of connect type. This shares the same " - "storage between the other properties", - ALSASEQ_TYPE_EVENT_DATA_CONNECT, - G_PARAM_READWRITE); - - seq_event_fixed_props[SEQ_EVENT_FIXED_PROP_TSTAMP_DATA] = - g_param_spec_boxed("tstamp-data", "tstamp-data", - "The data of timestamp type. This shares the same " - "storage between the other properties", - ALSASEQ_TYPE_TSTAMP, - G_PARAM_READWRITE); - - g_object_class_install_properties(gobject_class, - SEQ_EVENT_FIXED_PROP_COUNT, - seq_event_fixed_props); -} - -static void alsaseq_event_fixed_init(ALSASeqEventFixed *self) -{ - return; -} - -/** - * alsaseq_event_fixed_new: - * @event_type: A #ALSASeqEventType. - * @error: A #GError. - * - * Allocate and returns an instance of #ALSASeqEventFixed class. - * - * Returns: A #ALSASeqEventFixed. - */ -ALSASeqEventFixed *alsaseq_event_fixed_new(ALSASeqEventType event_type, - GError **error) -{ - switch (event_type) { - case ALSASEQ_EVENT_TYPE_BOUNCE: - case ALSASEQ_EVENT_TYPE_USR_VAR0: - case ALSASEQ_EVENT_TYPE_USR_VAR1: - case ALSASEQ_EVENT_TYPE_USR_VAR2: - case ALSASEQ_EVENT_TYPE_USR_VAR3: - case ALSASEQ_EVENT_TYPE_USR_VAR4: - generate_error(error, EINVAL); - return NULL; - default: - break; - } - - return g_object_new(ALSASEQ_TYPE_EVENT_FIXED, - "type", event_type, - "length-mode", ALSASEQ_EVENT_LENGTH_MODE_FIXED, - NULL); -} - -/** - * alsaseq_event_fixed_get_byte_data: - * @self: A #ALSASeqEventFixed. - * @bytes: (array fixed-size=12)(out)(transfer none): The array with twelve - * elements for byte data of the event. - * - * Refer to the twelve bytes as the data of event. - */ -void alsaseq_event_fixed_get_byte_data(ALSASeqEventFixed *self, - const guint8 *bytes[12]) -{ - ALSASeqEvent *parent; - struct snd_seq_event *ev; - - g_return_if_fail(ALSASEQ_IS_EVENT_FIXED(self)); - parent = ALSASEQ_EVENT(self); - seq_event_refer_private(parent, &ev); - - *bytes = ev->data.raw8.d; -} - -/** - * alsaseq_event_fixed_set_byte_data: - * @self: A #ALSASeqEventFixed. - * @bytes: (array fixed-size=12)(transfer none): The array with twelve elements - * for byte data of the event. - * - * Copy the twelve bytes from the given buffer as the data of event. - */ -void alsaseq_event_fixed_set_byte_data(ALSASeqEventFixed *self, - const guint8 bytes[12]) -{ - ALSASeqEvent *parent; - struct snd_seq_event *ev; - - g_return_if_fail(ALSASEQ_IS_EVENT_FIXED(self)); - parent = ALSASEQ_EVENT(self); - seq_event_refer_private(parent, &ev); - - memcpy(ev->data.raw8.d, bytes, sizeof(ev->data.raw8.d)); -} - -/** - * alsaseq_event_fixed_get_quadlet_data: - * @self: A #ALSASeqEventFixed. - * @quadlets: (array fixed-size=3)(out)(transfer none): The array with three - * elements for quadlets as the data of event. - * - * Refer to three quadlet as the data of event. - */ -void alsaseq_event_fixed_get_quadlet_data(ALSASeqEventFixed *self, - const guint32 *quadlets[3]) -{ - ALSASeqEvent *parent; - struct snd_seq_event *ev; - - g_return_if_fail(ALSASEQ_IS_EVENT_FIXED(self)); - parent = ALSASEQ_EVENT(self); - seq_event_refer_private(parent, &ev); - - *quadlets = ev->data.raw32.d; -} - -/** - * alsaseq_event_fixed_set_quadlet_data: - * @self: A #ALSASeqEventFixed. - * @quadlets: (array fixed-size=3)(transfer none): The array with three elements - * for quadlets for the data of event. - * - * Copy three quadlets from the given buffer as the data of event. - */ -void alsaseq_event_fixed_set_quadlet_data(ALSASeqEventFixed *self, - const guint32 quadlets[3]) -{ - ALSASeqEvent *parent; - struct snd_seq_event *ev; - - g_return_if_fail(ALSASEQ_IS_EVENT_FIXED(self)); - parent = ALSASEQ_EVENT(self); - seq_event_refer_private(parent, &ev); - - memcpy(ev->data.raw32.d, quadlets, sizeof(ev->data.raw32.d)); -} diff --git a/src/seq/event-fixed.h b/src/seq/event-fixed.h deleted file mode 100644 index 63809a3..0000000 --- a/src/seq/event-fixed.h +++ /dev/null @@ -1,67 +0,0 @@ -// SPDX-License-Identifier: LGPL-3.0-or-later -#ifndef __ALSA_GOBJECT_ALSASEQ_EVENT_FIXED_H__ -#define __ALSA_GOBJECT_ALSASEQ_EVENT_FIXED_H__ - -#include -#include - -#include -#include -#include -#include -#include -#include - -G_BEGIN_DECLS - -#define ALSASEQ_TYPE_EVENT_FIXED (alsaseq_event_fixed_get_type()) - -#define ALSASEQ_EVENT_FIXED(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj), \ - ALSASEQ_TYPE_EVENT_FIXED, \ - ALSASeqEventFixed)) -#define ALSASEQ_IS_EVENT_FIXED(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj), \ - ALSASEQ_TYPE_EVENT_FIXED)) - -#define ALSASEQ_EVENT_FIXED_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass), \ - ALSASEQ_TYPE_EVENT_FIXED, \ - ALSASeqEventFixedClass)) -#define ALSASEQ_IS_EVENT_FIXED_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass), \ - ALSASEQ_TYPE_EVENT_FIXED)) -#define ALSASEQ_EVENT_FIXED_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS((obj), \ - ALSASEQ_TYPE_EVENT_FIXED, \ - ALSASeqEventFixedClass)) - -typedef struct _ALSASeqEventFixed ALSASeqEventFixed; -typedef struct _ALSASeqEventFixedClass ALSASeqEventFixedClass; - -struct _ALSASeqEventFixed { - ALSASeqEvent parent_instance; -}; - -struct _ALSASeqEventFixedClass { - ALSASeqEventClass parent_class; -}; - -GType alsaseq_event_fixed_get_type() G_GNUC_CONST; - -ALSASeqEventFixed *alsaseq_event_fixed_new(ALSASeqEventType event_type, - GError **error); - -void alsaseq_event_fixed_get_byte_data(ALSASeqEventFixed *self, - const guint8 *bytes[12]); -void alsaseq_event_fixed_set_byte_data(ALSASeqEventFixed *self, - const guint8 bytes[12]); - -void alsaseq_event_fixed_get_quadlet_data(ALSASeqEventFixed *self, - const guint32 *quadlets[3]); -void alsaseq_event_fixed_set_quadlet_data(ALSASeqEventFixed *self, - const guint32 quadlets[3]); - -G_END_DECLS - -#endif diff --git a/src/seq/meson.build b/src/seq/meson.build index 75f3bf2..25f3f73 100644 --- a/src/seq/meson.build +++ b/src/seq/meson.build @@ -18,7 +18,6 @@ sources = files( 'client-pool.c', 'tstamp.c', 'event.c', - 'event-fixed.c', 'event-data-result.c', 'event-data-note.c', 'event-data-ctl.c', @@ -44,7 +43,6 @@ headers = files( 'client-pool.h', 'tstamp.h', 'event.h', - 'event-fixed.h', 'event-data-result.h', 'event-data-note.h', 'event-data-ctl.h', diff --git a/src/seq/user-client.h b/src/seq/user-client.h index 9f65a72..298448e 100644 --- a/src/seq/user-client.h +++ b/src/seq/user-client.h @@ -9,7 +9,6 @@ #include #include #include -#include #include #include #include diff --git a/tests/alsaseq-event-fixed b/tests/alsaseq-event-fixed deleted file mode 100644 index 6d24bc2..0000000 --- a/tests/alsaseq-event-fixed +++ /dev/null @@ -1,33 +0,0 @@ -#!/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.EventFixed() -props = ( - 'result-data', - 'note-data', - 'ctl-data', - 'queue-data', - 'addr-data', - 'connect-data', - 'tstamp-data', -) -methods = ( - 'new', - 'get_byte_data', - 'set_byte_data', - 'get_quadlet_data', - 'set_quadlet_data', -) -signals = () - -if not test(target, props, methods, signals): - exit(ENXIO) - diff --git a/tests/meson.build b/tests/meson.build index 31df014..602e02e 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -36,7 +36,6 @@ tests = { 'alsaseq-port-info', 'alsaseq-client-pool', 'alsaseq-event', - 'alsaseq-event-fixed', 'alsaseq-subscribe-data', 'alsaseq-queue-info', 'alsaseq-queue-status',