From 058584a8bc143fdd78f872c3977a8149222697a7 Mon Sep 17 00:00:00 2001 From: Takashi Sakamoto Date: Wed, 1 Apr 2020 18:13:28 +0900 Subject: [PATCH] seq: event_fixed: add a property for ctl data of event Signed-off-by: Takashi Sakamoto --- src/seq/event-fixed.c | 15 +++++++++++++++ src/seq/event-fixed.h | 1 + tests/alsaseq-event-fixed | 1 + 3 files changed, 17 insertions(+) diff --git a/src/seq/event-fixed.c b/src/seq/event-fixed.c index 38d3f78..e1ff591 100644 --- a/src/seq/event-fixed.c +++ b/src/seq/event-fixed.c @@ -9,6 +9,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_CTL_DATA, SEQ_EVENT_FIXED_PROP_COUNT, }; static GParamSpec *seq_event_fixed_props[SEQ_EVENT_FIXED_PROP_COUNT] = { NULL, }; @@ -35,6 +36,13 @@ static void seq_event_fixed_set_property(GObject *obj, guint id, 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; + } default: G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, id, spec); break; @@ -82,6 +90,13 @@ static void alsaseq_event_fixed_class_init(ALSASeqEventFixedClass *klass) 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); + 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 e2488a1..6e33f00 100644 --- a/src/seq/event-fixed.h +++ b/src/seq/event-fixed.h @@ -8,6 +8,7 @@ #include #include #include +#include G_BEGIN_DECLS diff --git a/tests/alsaseq-event-fixed b/tests/alsaseq-event-fixed index 48b03a2..dd27667 100644 --- a/tests/alsaseq-event-fixed +++ b/tests/alsaseq-event-fixed @@ -13,6 +13,7 @@ target = ALSASeq.EventFixed() props = ( 'result-data', 'note-data', + 'ctl-data', ) methods = ( 'new', -- 2.47.3