]> git.alsa-project.org Git - alsa-gobject.git/commitdiff
timer: enums: rename TstampEventType from EventType
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Sun, 5 Jun 2022 03:39:24 +0000 (12:39 +0900)
committer坂本 貴史 <o-takashi@sakamocchi.jp>
Mon, 6 Jun 2022 02:14:34 +0000 (11:14 +0900)
ALSATimer.EventType is for the type of tstamp event, thus it's not for
tick event.

This commit renames the enumerations with explicit name.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
samples/timer
src/timer/alsatimer-enum-types.h
src/timer/alsatimer.map
src/timer/event-data-tstamp.c
src/timer/event-data-tstamp.h
src/timer/instance-params.c
src/timer/instance-params.h
tests/alsatimer-enums

index 8c50f8a4b2a604a6f7687ef434670da65ad4c8dc..72de65af0af3939614e85691bb4bfa6dd54edcd3 100755 (executable)
@@ -62,14 +62,14 @@ params.set_property('flags', flags)
 ticks = 500 * 1000 * 1000 // resolution  # 500msec
 params.set_property('interval', ticks)
 params.set_property('queue-size', 64)
-events = (ALSATimer.EventType.RESOLUTION,
-          ALSATimer.EventType.TICK,
-          ALSATimer.EventType.START,
-          ALSATimer.EventType.STOP,
-          ALSATimer.EventType.CONTINUE,
-          ALSATimer.EventType.PAUSE,
-          ALSATimer.EventType.SUSPEND,
-          ALSATimer.EventType.RESUME)
+events = (ALSATimer.TstampEventType.RESOLUTION,
+          ALSATimer.TstampEventType.TICK,
+          ALSATimer.TstampEventType.START,
+          ALSATimer.TstampEventType.STOP,
+          ALSATimer.TstampEventType.CONTINUE,
+          ALSATimer.TstampEventType.PAUSE,
+          ALSATimer.TstampEventType.SUSPEND,
+          ALSATimer.TstampEventType.RESUME)
 params.set_event_filter(events)
 _, params = instance.set_params(params)
 
index 8c3a2ecee591bd47afac2edb889955445664fbca..1025e66168cad31602dedf09fd12a1e992e10886 100644 (file)
@@ -73,43 +73,43 @@ typedef enum /*< flags >*/
 } ALSATimerInstanceParamFlag;
 
 /**
- * ALSATimerEventType:
- * @ALSATIMER_EVENT_TYPE_RESOLUTION:    The event for timer resolution.
- * @ALSATIMER_EVENT_TYPE_TICK:          The event for timer tick.
- * @ALSATIMER_EVENT_TYPE_START:         The event for timer start.
- * @ALSATIMER_EVENT_TYPE_STOP:          The event for timer stop.
- * @ALSATIMER_EVENT_TYPE_CONTINUE:      The event for timer continue.
- * @ALSATIMER_EVENT_TYPE_PAUSE:         The event for timer pause.
- * @ALSATIMER_EVENT_TYPE_EARLY:         The event before timer start.
- * @ALSATIMER_EVENT_TYPE_SUSPEND:       The event for timer suspend.
- * @ALSATIMER_EVENT_TYPE_RESUME:        The event for timer resume.
- * @ALSATIMER_EVENT_TYPE_MSTART:        The event for master timer start.
- * @ALSATIMER_EVENT_TYPE_MSTOP:         The event for master timer stop.
- * @ALSATIMER_EVENT_TYPE_MCONTINUE:     The event for master timer continue.
- * @ALSATIMER_EVENT_TYPE_MPAUSE:        The event for master timer pause.
- * @ALSATIMER_EVENT_TYPE_MSUSPEND:      The event for master timer suspend.
- * @ALSATIMER_EVENT_TYPE_MRESUME:       The event for master timer resume.
+ * ALSATimerTstampEventType:
+ * @ALSATIMER_TSTAMP_EVENT_TYPE_RESOLUTION: The event for timer resolution.
+ * @ALSATIMER_TSTAMP_EVENT_TYPE_TICK:       The event for timer tick.
+ * @ALSATIMER_TSTAMP_EVENT_TYPE_START:      The event for timer start.
+ * @ALSATIMER_TSTAMP_EVENT_TYPE_STOP:       The event for timer stop.
+ * @ALSATIMER_TSTAMP_EVENT_TYPE_CONTINUE:   The event for timer continue.
+ * @ALSATIMER_TSTAMP_EVENT_TYPE_PAUSE:      The event for timer pause.
+ * @ALSATIMER_TSTAMP_EVENT_TYPE_EARLY:      The event before timer start.
+ * @ALSATIMER_TSTAMP_EVENT_TYPE_SUSPEND:    The event for timer suspend.
+ * @ALSATIMER_TSTAMP_EVENT_TYPE_RESUME:     The event for timer resume.
+ * @ALSATIMER_TSTAMP_EVENT_TYPE_MSTART:     The event for master timer start.
+ * @ALSATIMER_TSTAMP_EVENT_TYPE_MSTOP:      The event for master timer stop.
+ * @ALSATIMER_TSTAMP_EVENT_TYPE_MCONTINUE:  The event for master timer continue.
+ * @ALSATIMER_TSTAMP_EVENT_TYPE_MPAUSE:     The event for master timer pause.
+ * @ALSATIMER_TSTAMP_EVENT_TYPE_MSUSPEND:   The event for master timer suspend.
+ * @ALSATIMER_TSTAMP_EVENT_TYPE_MRESUME:    The event for master timer resume.
  *
- * A set of enumerations for timer event.
+ * A set of enumerations for the type of timestamp event.
  */
 typedef enum
 {
-    ALSATIMER_EVENT_TYPE_RESOLUTION = SNDRV_TIMER_EVENT_RESOLUTION,
-    ALSATIMER_EVENT_TYPE_TICK       = SNDRV_TIMER_EVENT_TICK,
-    ALSATIMER_EVENT_TYPE_START      = SNDRV_TIMER_EVENT_START,
-    ALSATIMER_EVENT_TYPE_STOP       = SNDRV_TIMER_EVENT_STOP,
-    ALSATIMER_EVENT_TYPE_CONTINUE   = SNDRV_TIMER_EVENT_CONTINUE,
-    ALSATIMER_EVENT_TYPE_PAUSE      = SNDRV_TIMER_EVENT_PAUSE,
-    ALSATIMER_EVENT_TYPE_EARLY      = SNDRV_TIMER_EVENT_EARLY,
-    ALSATIMER_EVENT_TYPE_SUSPEND    = SNDRV_TIMER_EVENT_SUSPEND,
-    ALSATIMER_EVENT_TYPE_RESUME     = SNDRV_TIMER_EVENT_RESUME,
-    ALSATIMER_EVENT_TYPE_MSTART     = SNDRV_TIMER_EVENT_MSTART,
-    ALSATIMER_EVENT_TYPE_MSTOP      = SNDRV_TIMER_EVENT_MSTOP,
-    ALSATIMER_EVENT_TYPE_MCONTINUE  = SNDRV_TIMER_EVENT_MCONTINUE,
-    ALSATIMER_EVENT_TYPE_MPAUSE     = SNDRV_TIMER_EVENT_MPAUSE,
-    ALSATIMER_EVENT_TYPE_MSUSPEND   = SNDRV_TIMER_EVENT_MSUSPEND,
-    ALSATIMER_EVENT_TYPE_MRESUME    = SNDRV_TIMER_EVENT_MRESUME,
-} ALSATimerEventType;
+    ALSATIMER_TSTAMP_EVENT_TYPE_RESOLUTION = SNDRV_TIMER_EVENT_RESOLUTION,
+    ALSATIMER_TSTAMP_EVENT_TYPE_TICK       = SNDRV_TIMER_EVENT_TICK,
+    ALSATIMER_TSTAMP_EVENT_TYPE_START      = SNDRV_TIMER_EVENT_START,
+    ALSATIMER_TSTAMP_EVENT_TYPE_STOP       = SNDRV_TIMER_EVENT_STOP,
+    ALSATIMER_TSTAMP_EVENT_TYPE_CONTINUE   = SNDRV_TIMER_EVENT_CONTINUE,
+    ALSATIMER_TSTAMP_EVENT_TYPE_PAUSE      = SNDRV_TIMER_EVENT_PAUSE,
+    ALSATIMER_TSTAMP_EVENT_TYPE_EARLY      = SNDRV_TIMER_EVENT_EARLY,
+    ALSATIMER_TSTAMP_EVENT_TYPE_SUSPEND    = SNDRV_TIMER_EVENT_SUSPEND,
+    ALSATIMER_TSTAMP_EVENT_TYPE_RESUME     = SNDRV_TIMER_EVENT_RESUME,
+    ALSATIMER_TSTAMP_EVENT_TYPE_MSTART     = SNDRV_TIMER_EVENT_MSTART,
+    ALSATIMER_TSTAMP_EVENT_TYPE_MSTOP      = SNDRV_TIMER_EVENT_MSTOP,
+    ALSATIMER_TSTAMP_EVENT_TYPE_MCONTINUE  = SNDRV_TIMER_EVENT_MCONTINUE,
+    ALSATIMER_TSTAMP_EVENT_TYPE_MPAUSE     = SNDRV_TIMER_EVENT_MPAUSE,
+    ALSATIMER_TSTAMP_EVENT_TYPE_MSUSPEND   = SNDRV_TIMER_EVENT_MSUSPEND,
+    ALSATIMER_TSTAMP_EVENT_TYPE_MRESUME    = SNDRV_TIMER_EVENT_MRESUME,
+} ALSATimerTstampEventType;
 
 /**
  * ALSATimerEventDataType
index 1681feb6fa13d65b6121918a5de7fed99994134e..3814486c277aa587372e3e87e40bc880bf3508d8 100644 (file)
@@ -5,7 +5,6 @@ ALSA_GOBJECT_0_0_0 {
     "alsatimer_specific_global_device_get_type";
     "alsatimer_device_info_flag_get_type";
     "alsatimer_instance_param_flag_get_type";
-    "alsatimer_event_type_get_type";
     "alsatimer_event_data_type_get_type";
 
     "alsatimer_device_id_get_type";
@@ -76,4 +75,6 @@ ALSA_GOBJECT_0_3_0 {
     "alsatimer_user_instance_stop";
     "alsatimer_user_instance_pause";
     "alsatimer_user_instance_continue";
+
+    "alsatimer_tstamp_event_type_get_type";
 } ALSA_GOBJECT_0_2_0;
index 493e3d2b21627fa0759c21a0e115a06da4e29b0c..80ceeaf757374a783bb476b18b1480b5e43d5cd4 100644 (file)
@@ -27,14 +27,14 @@ G_DEFINE_BOXED_TYPE(ALSATimerEventDataTstamp, alsatimer_event_data_tstamp, timer
 /**
  * alsatimer_event_data_tstamp_get_event:
  * @self: A [struct@EventDataTstamp].
- * @event: (out): The type of tstamp event, one of [enum@EventType].
+ * @event: (out): The type of tstamp event, one of [enum@TstampEventType].
  *
  * Get the kind of event for the timestamp event.
  */
 void alsatimer_event_data_tstamp_get_event(const ALSATimerEventDataTstamp *self,
-                                           ALSATimerEventType *event)
+                                           ALSATimerTstampEventType *event)
 {
-    *event = (ALSATimerEventType)self->event;
+    *event = (ALSATimerTstampEventType)self->event;
 }
 
 /**
index fbd1ef90f22d84d427325e38f500d6573bdfa9a7..d004a66b7c04a052b06417629a445adbadea2bc1 100644 (file)
@@ -13,7 +13,7 @@ typedef struct snd_timer_tread ALSATimerEventDataTstamp;
 GType alsatimer_event_data_tstamp_get_type() G_GNUC_CONST;
 
 void alsatimer_event_data_tstamp_get_event(const ALSATimerEventDataTstamp *self,
-                                           ALSATimerEventType *event);
+                                           ALSATimerTstampEventType *event);
 
 void alsatimer_event_data_tstamp_get_tstamp(const ALSATimerEventDataTstamp *self,
                                             gint64 *const tstamp[2]);
index e76ffd1ad7f7a6b0b7d4fd41b00e5465f609036a..5f6cb4b26c35cc42b70862eb072f4629f917084a 100644 (file)
@@ -126,17 +126,18 @@ ALSATimerInstanceParams *alsatimer_instance_params_new()
 /**
  * alsatimer_instance_params_set_event_filter:
  * @self: A [class@InstanceParams].
- * @entries: (array length=entry_count): The array with elements for entries of [enum@EventType].
+ * @entries: (array length=entry_count): The array with elements for entries of
+ *           [enum@TstampEventType].
  * @entry_count: The number of elements in the above array.
  * @error: A [struct@GLib.Error] at failure.
  *
- * Set the list of [enum@EventType] to filter events. This parameter is effective only for target
- * instance with [enum@EventDataType:TIMESTAMP].
+ * Set the list of [enum@TstampEventType] to filter events. This parameter is effective only for
+ * target instance with [enum@EventDataType:TIMESTAMP].
  *
  * Returns: %TRUE when the overall operation finishes successfully, else %FALSE.
  */
 gboolean alsatimer_instance_params_set_event_filter(ALSATimerInstanceParams *self,
-                                            const ALSATimerEventType *entries,
+                                            const ALSATimerTstampEventType *entries,
                                             gsize entry_count, GError **error)
 {
     ALSATimerInstanceParamsPrivate *priv;
@@ -174,21 +175,22 @@ gboolean alsatimer_instance_params_set_event_filter(ALSATimerInstanceParams *sel
 /**
  * alsatimer_instance_params_get_event_filter:
  * @self: A [class@InstanceParams].
- * @entries: (array length=entry_count)(out): The array with elements for entries of [enum@EventType].
+ * @entries: (array length=entry_count)(out): The array with elements for entries of
+ *           [enum@TstampEventType].
  * @entry_count: The number of elements in the above array.
  * @error: A [struct@GLib.Error] at failure.
  *
- * Get the list of ALSATimerEventType to filter events. This parameter is effective only for target
- * instance with [enum@EventDataType:TIMESTAMP].
+ * Get the list of [enum@TstampEventType] to filter events. This parameter is effective only for
+ * target instance with [enum@EventDataType:TIMESTAMP].
  *
  * Returns: %TRUE when the overall operation finishes successfully, else %FALSE.
  */
 gboolean alsatimer_instance_params_get_event_filter(ALSATimerInstanceParams *self,
-                                            ALSATimerEventType **entries,
+                                            ALSATimerTstampEventType **entries,
                                             gsize *entry_count, GError **error)
 {
     ALSATimerInstanceParamsPrivate *priv;
-    ALSATimerEventType *list;
+    ALSATimerTstampEventType *list;
     unsigned int filter;
     unsigned int count;
     unsigned int index;
@@ -216,7 +218,7 @@ gboolean alsatimer_instance_params_get_event_filter(ALSATimerInstanceParams *sel
     index = 0;
     for (i = 0; i < sizeof(filter) * 8; ++i) {
         if ((1u << i) & filter) {
-            list[index] = (ALSATimerEventType)i;
+            list[index] = (ALSATimerTstampEventType)i;
             if (++index >= count)
                 break;
         }
index 5ba060ab54ec6c5705aecbf88b50abd696ce255c..7ed58149a216d873ee23ca6bbae24345195942d5 100644 (file)
@@ -18,11 +18,11 @@ struct _ALSATimerInstanceParamsClass {
 ALSATimerInstanceParams *alsatimer_instance_params_new();
 
 gboolean alsatimer_instance_params_set_event_filter(ALSATimerInstanceParams *self,
-                                            const ALSATimerEventType *entries,
+                                            const ALSATimerTstampEventType *entries,
                                             gsize entry_count, GError **error);
 
 gboolean alsatimer_instance_params_get_event_filter(ALSATimerInstanceParams *self,
-                                            ALSATimerEventType **entries,
+                                            ALSATimerTstampEventType **entries,
                                             gsize *entry_count, GError **error);
 
 G_END_DECLS
index 008a1f824d40f98c388bbd137b44053ddbf032a2..153a41a2421f4b8aa5b40784e20c6108c312c976 100644 (file)
@@ -33,7 +33,7 @@ instance_param_flags = (
     'EARLY_EVENT',
 )
 
-event_types = (
+tstamp_event_types = (
     'RESOLUTION',
     'TICK',
     'START',
@@ -69,7 +69,7 @@ types = {
     ALSATimer.SpecificGlobalDevice: specific_global_devices,
     ALSATimer.DeviceInfoFlag:       device_info_flags,
     ALSATimer.InstanceParamFlag:    instance_param_flags,
-    ALSATimer.EventType:            event_types,
+    ALSATimer.TstampEventType:      tstamp_event_types,
     ALSATimer.EventDataType:        event_data_types,
     ALSATimer.UserInstanceError:    user_instance_error_types,
 }