From: Takashi Sakamoto Date: Wed, 1 Apr 2020 09:13:28 +0000 (+0900) Subject: seq: event_fixed: add a property for note data of event X-Git-Tag: v0.1.0~267 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=1d50f84b78286a42565e852a9d80c4ccb806deb0;p=alsa-gobject.git seq: event_fixed: add a property for note data of event Signed-off-by: Takashi Sakamoto --- diff --git a/src/seq/event-fixed.c b/src/seq/event-fixed.c index 2a1271a..38d3f78 100644 --- a/src/seq/event-fixed.c +++ b/src/seq/event-fixed.c @@ -8,6 +8,7 @@ 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_COUNT, }; static GParamSpec *seq_event_fixed_props[SEQ_EVENT_FIXED_PROP_COUNT] = { NULL, }; @@ -27,6 +28,13 @@ static void seq_event_fixed_set_property(GObject *obj, guint id, 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; + } default: G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, id, spec); break; @@ -44,6 +52,9 @@ static void seq_event_fixed_get_property(GObject *obj, guint id, GValue *val, 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; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, id, spec); break; @@ -64,6 +75,13 @@ static void alsaseq_event_fixed_class_init(ALSASeqEventFixedClass *klass) 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); + g_object_class_install_properties(gobject_class, SEQ_EVENT_FIXED_PROP_COUNT, seq_event_fixed_props); diff --git a/src/seq/event-fixed.h b/src/seq/event-fixed.h index ce54c31..e2488a1 100644 --- a/src/seq/event-fixed.h +++ b/src/seq/event-fixed.h @@ -7,6 +7,7 @@ #include #include +#include G_BEGIN_DECLS diff --git a/tests/alsaseq-event-fixed b/tests/alsaseq-event-fixed index c42e19e..48b03a2 100644 --- a/tests/alsaseq-event-fixed +++ b/tests/alsaseq-event-fixed @@ -12,6 +12,7 @@ from gi.repository import ALSASeq target = ALSASeq.EventFixed() props = ( 'result-data', + 'note-data', ) methods = ( 'new',