From: Takashi Sakamoto Date: Tue, 14 Jun 2022 10:23:21 +0000 (+0900) Subject: seq: enums: obsolete ALSASeqSubscribeFlag enumerations X-Git-Tag: v0.3.0~90 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=f711160948d02cb48fc05ca64d6172a70298a713;p=alsa-gobject.git seq: enums: obsolete ALSASeqSubscribeFlag enumerations ALSASeq.SubscribeFlag is defined but it's more convenient to add the flags as properties in ALSASeq.SubscribeData. Signed-off-by: Takashi Sakamoto --- diff --git a/src/seq/alsaseq-enum-types.h b/src/seq/alsaseq-enum-types.h index d4ee35a..9d00c17 100644 --- a/src/seq/alsaseq-enum-types.h +++ b/src/seq/alsaseq-enum-types.h @@ -312,22 +312,6 @@ typedef enum { ALSASEQ_SPECIFIC_QUEUE_ID_DIRECT = SNDRV_SEQ_QUEUE_DIRECT, } ALSASeqSpecificQueueId; -/** - * ALSASeqPortSubscribeFlag: - * @ALSASEQ_PORT_SUBSCRIBE_FLAG_EXCLUSIVE: The subscription can be changed by originator. - * @ALSASEQ_PORT_SUBSCRIBE_FLAG_TSTAMP: Any event for this subscription has time stamp. - * @ALSASEQ_PORT_SUBSCRIBE_FLAG_TIME_REAL: The time stamp on the event from the port has real time, - * else tick time. - * - * A set of flags for subscription conditions. - */ -typedef enum /*< flags >*/ -{ - ALSASEQ_PORT_SUBSCRIBE_FLAG_EXCLUSIVE = SNDRV_SEQ_PORT_SUBS_EXCLUSIVE, - ALSASEQ_PORT_SUBSCRIBE_FLAG_TSTAMP = SNDRV_SEQ_PORT_SUBS_TIMESTAMP, - ALSASEQ_PORT_SUBSCRIBE_FLAG_TIME_REAL = SNDRV_SEQ_PORT_SUBS_TIME_REAL, -} ALSASeqPortSubscribeFlag; - /** * ALSASeqQuerySubscribeType * @ALSASEQ_QUERY_SUBSCRIBE_TYPE_READ: To query subscribers to read from the port. diff --git a/src/seq/alsaseq.map b/src/seq/alsaseq.map index ffb1efe..66292aa 100644 --- a/src/seq/alsaseq.map +++ b/src/seq/alsaseq.map @@ -13,7 +13,6 @@ ALSA_GOBJECT_0_0_0 { "alsaseq_event_length_mode_get_type"; "alsaseq_event_priority_mode_get_type"; "alsaseq_specific_queue_id_get_type"; - "alsaseq_port_subscribe_flag_get_type"; "alsaseq_query_subscribe_type_get_type"; "alsaseq_queue_timer_type_get_type"; "alsaseq_remove_filter_flag_get_type"; diff --git a/src/seq/subscribe-data.c b/src/seq/subscribe-data.c index d1dea0e..9eccd00 100644 --- a/src/seq/subscribe-data.c +++ b/src/seq/subscribe-data.c @@ -19,7 +19,9 @@ G_DEFINE_TYPE_WITH_PRIVATE(ALSASeqSubscribeData, alsaseq_subscribe_data, G_TYPE_ enum seq_subscribe_data_prop_type { SEQ_SUBSCRIBE_DATA_PROP_SENDER = 1, SEQ_SUBSCRIBE_DATA_PROP_DEST, - SEQ_SUBSCRIBE_DATA_PROP_FLAG, + SEQ_SUBSCRIBE_DATA_PROP_IS_EXCLUSIVE, + SEQ_SUBSCRIBE_DATA_PROP_HAS_TSTAMP, + SEQ_SUBSCRIBE_DATA_PROP_TSTAMP_MODE, SEQ_SUBSCRIBE_DATA_PROP_QUEUE_ID, SEQ_SUBSCRIBE_DATA_PROP_COUNT, }; @@ -45,8 +47,20 @@ static void seq_subscribe_data_set_property(GObject *obj, guint id, priv->data.dest = *addr; break; } - case SEQ_SUBSCRIBE_DATA_PROP_FLAG: - priv->data.flags = (unsigned int)g_value_get_flags(val); + case SEQ_SUBSCRIBE_DATA_PROP_IS_EXCLUSIVE: + priv->data.flags &= ~SNDRV_SEQ_PORT_SUBS_EXCLUSIVE; + if (g_value_get_boolean(val)) + priv->data.flags |= SNDRV_SEQ_PORT_SUBS_EXCLUSIVE; + break; + case SEQ_SUBSCRIBE_DATA_PROP_HAS_TSTAMP: + priv->data.flags &= ~SNDRV_SEQ_PORT_SUBS_TIMESTAMP; + if (g_value_get_boolean(val)) + priv->data.flags |= SNDRV_SEQ_PORT_SUBS_TIMESTAMP; + break; + case SEQ_SUBSCRIBE_DATA_PROP_TSTAMP_MODE: + priv->data.flags &= ~SNDRV_SEQ_PORT_SUBS_TIME_REAL; + if (g_value_get_enum(val) == ALSASEQ_EVENT_TSTAMP_MODE_REAL) + priv->data.flags |= SNDRV_SEQ_PORT_SUBS_TIME_REAL; break; case SEQ_SUBSCRIBE_DATA_PROP_QUEUE_ID: priv->data.queue = g_value_get_uchar(val); @@ -71,9 +85,24 @@ static void seq_subscribe_data_get_property(GObject *obj, guint id, GValue *val, case SEQ_SUBSCRIBE_DATA_PROP_DEST: g_value_set_static_boxed(val, &priv->data.dest); break; - case SEQ_SUBSCRIBE_DATA_PROP_FLAG: - g_value_set_flags(val, (ALSASeqPortSubscribeFlag)priv->data.flags); + case SEQ_SUBSCRIBE_DATA_PROP_IS_EXCLUSIVE: + g_value_set_boolean(val, (priv->data.flags & SNDRV_SEQ_PORT_SUBS_EXCLUSIVE) > 0); + break; + case SEQ_SUBSCRIBE_DATA_PROP_HAS_TSTAMP: + g_value_set_boolean(val, (priv->data.flags & SNDRV_SEQ_PORT_SUBS_TIMESTAMP) > 0); break; + case SEQ_SUBSCRIBE_DATA_PROP_TSTAMP_MODE: + { + ALSASeqEventTstampMode mode; + + if (priv->data.flags & SNDRV_SEQ_PORT_SUBS_TIME_REAL) + mode = ALSASEQ_EVENT_TSTAMP_MODE_REAL; + else + mode = ALSASEQ_EVENT_TSTAMP_MODE_TICK; + + g_value_set_enum(val, mode); + break; + } case SEQ_SUBSCRIBE_DATA_PROP_QUEUE_ID: g_value_set_uchar(val, priv->data.queue); break; @@ -90,31 +119,85 @@ static void alsaseq_subscribe_data_class_init(ALSASeqSubscribeDataClass *klass) gobject_class->set_property = seq_subscribe_data_set_property; gobject_class->get_property = seq_subscribe_data_get_property; + /** + * ALSASeqSubscribeData:sender: + * + * The address of sender. + * + * Since: 0.3. + */ seq_subscribe_data_props[SEQ_SUBSCRIBE_DATA_PROP_SENDER] = g_param_spec_boxed("sender", "sender", "The address of sender.", ALSASEQ_TYPE_ADDR, G_PARAM_READWRITE); + /** + * ALSASeqSubscribeData:dest: + * + * The address of destination. + * + * Since: 0.3. + */ seq_subscribe_data_props[SEQ_SUBSCRIBE_DATA_PROP_DEST] = g_param_spec_boxed("dest", "dest", "The address of destination.", ALSASEQ_TYPE_ADDR, G_PARAM_READWRITE); - seq_subscribe_data_props[SEQ_SUBSCRIBE_DATA_PROP_FLAG] = - g_param_spec_flags("flag", "flag", - "The attributee flag, a set of " - "ALSASeqPortSubscribeFlag.", - ALSASEQ_TYPE_PORT_SUBSCRIBE_FLAG, - 0, - G_PARAM_READWRITE); - + /** + * ALSASeqSubscribeData:is-exclusive: + * + * Whether the subscription can be changed by originator only, + * + * Since: 0.3. + */ + seq_subscribe_data_props[SEQ_SUBSCRIBE_DATA_PROP_IS_EXCLUSIVE] = + g_param_spec_boolean("is-exclusive", "is-exclusive", + "Whether the subscription can be changed by originator only", + FALSE, + G_PARAM_READWRITE); + + /** + * ALSASeqSubscribeData:has-tstamp: + * + * Any event for the subscription has time stamp, + * + * Since: 0.3. + */ + seq_subscribe_data_props[SEQ_SUBSCRIBE_DATA_PROP_HAS_TSTAMP] = + g_param_spec_boolean("has-tstamp", "has-tstamp", + "Any event for the subscription has time stamp", + FALSE, + G_PARAM_READWRITE); + + /** + * ALSASeqSubscribeData:tstamp-mode: + * + * The type of time stamp. This is effective when the has-tstamp property enabled. + * + * Since: 0.3. + */ + seq_subscribe_data_props[SEQ_SUBSCRIBE_DATA_PROP_TSTAMP_MODE] = + g_param_spec_enum("tstamp-mode", "tstamp-mode", + "The type of time stamp. This is effective when the has-tstamp property" + "enabled.", + ALSASEQ_TYPE_EVENT_TSTAMP_MODE, + ALSASEQ_EVENT_TSTAMP_MODE_TICK, + G_PARAM_READWRITE); + + /** + * ALSASeqSubscribeData:queue-id: + * + * The numeric ID of queue to deliver. One of ALSASeqSpecificQueueId is available as well as + * any numeric value. + * + * Since: 0.3. + */ seq_subscribe_data_props[SEQ_SUBSCRIBE_DATA_PROP_QUEUE_ID] = g_param_spec_uchar("queue-id", "queue-id", - "The numerical ID of queue to deliver. One of " - "ALSASeqSpecificQueueId is available as well as " - "any numerical value.", + "The numeric ID of queue to deliver. One of ALSASeqSpecificQueueId is " + "available as well as any numeric value.", 0, G_MAXUINT8, 0, G_PARAM_READWRITE); diff --git a/tests/alsaseq-enums b/tests/alsaseq-enums index 7569394..5be53fa 100644 --- a/tests/alsaseq-enums +++ b/tests/alsaseq-enums @@ -144,12 +144,6 @@ specific_queue_id_types = ( 'DIRECT', ) -port_subscribe_flags = ( - 'EXCLUSIVE', - 'TSTAMP', - 'TIME_REAL', -) - query_subscribe_types = ( 'READ', 'WRITE', @@ -184,7 +178,6 @@ types = { ALSASeq.EventLengthMode: event_length_mode_types, ALSASeq.EventPriorityMode: event_priority_mode_types, ALSASeq.SpecificQueueId: specific_queue_id_types, - ALSASeq.PortSubscribeFlag: port_subscribe_flags, ALSASeq.QuerySubscribeType: query_subscribe_types, ALSASeq.QueueTimerType: queue_timer_types, ALSASeq.RemoveFilterFlag: remove_filter_flags, diff --git a/tests/alsaseq-subscribe-data b/tests/alsaseq-subscribe-data index 043e8a1..9d4cca2 100644 --- a/tests/alsaseq-subscribe-data +++ b/tests/alsaseq-subscribe-data @@ -13,7 +13,9 @@ target = ALSASeq.SubscribeData() props = ( 'sender', 'dest', - 'flag', + 'is-exclusive', + 'has-tstamp', + 'tstamp-mode', 'queue-id', ) methods = (