]> git.alsa-project.org Git - alsa-gobject.git/commitdiff
timer: enums: rename to ALSATimer.RealTimeEventType
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Wed, 22 Jun 2022 03:05:26 +0000 (12:05 +0900)
committerTakashi Sakamoto <o-takashi@sakamocchi.jp>
Wed, 22 Jun 2022 03:05:26 +0000 (12:05 +0900)
The set of events is used only for ALSATimer.RealTimeEvent.

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

index 71af177ea1050c05a3f485b3e92e4bf2f018f6e4..5fe472f014f8ef00b363ca928a07edfe59c2ec0a 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.TstampEventType.RESOLUTION,
-          ALSATimer.TstampEventType.TICK,
-          ALSATimer.TstampEventType.START,
-          ALSATimer.TstampEventType.STOP,
-          ALSATimer.TstampEventType.CONTINUE,
-          ALSATimer.TstampEventType.PAUSE,
-          ALSATimer.TstampEventType.SUSPEND,
-          ALSATimer.TstampEventType.RESUME)
+events = (ALSATimer.RealTimeEventType.RESOLUTION,
+          ALSATimer.RealTimeEventType.TICK,
+          ALSATimer.RealTimeEventType.START,
+          ALSATimer.RealTimeEventType.STOP,
+          ALSATimer.RealTimeEventType.CONTINUE,
+          ALSATimer.RealTimeEventType.PAUSE,
+          ALSATimer.RealTimeEventType.SUSPEND,
+          ALSATimer.RealTimeEventType.RESUME)
 params.set_event_filter(events)
 _, params = instance.set_params(params)
 
index 80be895c743d7e89512f63a637d4d5b3ffee4bf6..83c6da2661760ba95a87fb198bc48436c708acae 100644 (file)
@@ -73,43 +73,43 @@ typedef enum /*< flags >*/
 } ALSATimerInstanceParamFlag;
 
 /**
- * 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.
+ * ALSATimerRealTimeEventType:
+ * @ALSATIMER_REAL_TIME_EVENT_TYPE_RESOLUTION:  The event for timer resolution.
+ * @ALSATIMER_REAL_TIME_EVENT_TYPE_TICK:        The event for timer tick.
+ * @ALSATIMER_REAL_TIME_EVENT_TYPE_START:       The event for timer start.
+ * @ALSATIMER_REAL_TIME_EVENT_TYPE_STOP:        The event for timer stop.
+ * @ALSATIMER_REAL_TIME_EVENT_TYPE_CONTINUE:    The event for timer continue.
+ * @ALSATIMER_REAL_TIME_EVENT_TYPE_PAUSE:       The event for timer pause.
+ * @ALSATIMER_REAL_TIME_EVENT_TYPE_EARLY:       The event before timer start.
+ * @ALSATIMER_REAL_TIME_EVENT_TYPE_SUSPEND:     The event for timer suspend.
+ * @ALSATIMER_REAL_TIME_EVENT_TYPE_RESUME:      The event for timer resume.
+ * @ALSATIMER_REAL_TIME_EVENT_TYPE_MSTART:      The event for master timer start.
+ * @ALSATIMER_REAL_TIME_EVENT_TYPE_MSTOP:       The event for master timer stop.
+ * @ALSATIMER_REAL_TIME_EVENT_TYPE_MCONTINUE:   The event for master timer continue.
+ * @ALSATIMER_REAL_TIME_EVENT_TYPE_MPAUSE:      The event for master timer pause.
+ * @ALSATIMER_REAL_TIME_EVENT_TYPE_MSUSPEND:    The event for master timer suspend.
+ * @ALSATIMER_REAL_TIME_EVENT_TYPE_MRESUME:     The event for master timer resume.
  *
- * A set of enumerations for the type of timestamp event.
+ * A set of enumerations for the type of real time event.
  */
 typedef enum
 {
-    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;
+    ALSATIMER_REAL_TIME_EVENT_TYPE_RESOLUTION = SNDRV_TIMER_EVENT_RESOLUTION,
+    ALSATIMER_REAL_TIME_EVENT_TYPE_TICK       = SNDRV_TIMER_EVENT_TICK,
+    ALSATIMER_REAL_TIME_EVENT_TYPE_START      = SNDRV_TIMER_EVENT_START,
+    ALSATIMER_REAL_TIME_EVENT_TYPE_STOP       = SNDRV_TIMER_EVENT_STOP,
+    ALSATIMER_REAL_TIME_EVENT_TYPE_CONTINUE   = SNDRV_TIMER_EVENT_CONTINUE,
+    ALSATIMER_REAL_TIME_EVENT_TYPE_PAUSE      = SNDRV_TIMER_EVENT_PAUSE,
+    ALSATIMER_REAL_TIME_EVENT_TYPE_EARLY      = SNDRV_TIMER_EVENT_EARLY,
+    ALSATIMER_REAL_TIME_EVENT_TYPE_SUSPEND    = SNDRV_TIMER_EVENT_SUSPEND,
+    ALSATIMER_REAL_TIME_EVENT_TYPE_RESUME     = SNDRV_TIMER_EVENT_RESUME,
+    ALSATIMER_REAL_TIME_EVENT_TYPE_MSTART     = SNDRV_TIMER_EVENT_MSTART,
+    ALSATIMER_REAL_TIME_EVENT_TYPE_MSTOP      = SNDRV_TIMER_EVENT_MSTOP,
+    ALSATIMER_REAL_TIME_EVENT_TYPE_MCONTINUE  = SNDRV_TIMER_EVENT_MCONTINUE,
+    ALSATIMER_REAL_TIME_EVENT_TYPE_MPAUSE     = SNDRV_TIMER_EVENT_MPAUSE,
+    ALSATIMER_REAL_TIME_EVENT_TYPE_MSUSPEND   = SNDRV_TIMER_EVENT_MSUSPEND,
+    ALSATIMER_REAL_TIME_EVENT_TYPE_MRESUME    = SNDRV_TIMER_EVENT_MRESUME,
+} ALSATimerRealTimeEventType;
 
 /**
  * ALSATimerEventType
index 39a46d822c7ed63cede884ae6c89c01496cd9904..ed5a1a6f5aa6806b8650f8a0f5785192ad0ec910 100644 (file)
@@ -66,7 +66,7 @@ ALSA_GOBJECT_0_3_0 {
     "alsatimer_user_instance_continue";
     "alsatimer_user_instance_choose_event_type";
 
-    "alsatimer_tstamp_event_type_get_type";
+    "alsatimer_real_time_event_type_get_type";
     "alsatimer_event_type_get_type";
 
     "alsatimer_tick_time_event_get_type";
index c6fbe7c7b2adc5c7f8ab783e6e2ef9f3581e2947..22480b02c5474ce2ba1c6944b7fda015ffaa4d4c 100644 (file)
@@ -141,17 +141,17 @@ 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@TstampEventType].
+ *           [enum@RealTimeEventType].
  * @entry_count: The number of elements in the above array.
  * @error: A [struct@GLib.Error] at failure.
  *
- * Set the list of [enum@TstampEventType] to filter events. This parameter is effective only for
- * target instance with [enum@EventType:TIMESTAMP].
+ * Set the list of [enum@RealTimeEventType] to filter events. This parameter is effective only for
+ * target instance with [enum@EventType].TIMESTAMP.
  *
  * Returns: %TRUE when the overall operation finishes successfully, else %FALSE.
  */
 gboolean alsatimer_instance_params_set_event_filter(ALSATimerInstanceParams *self,
-                                            const ALSATimerTstampEventType *entries,
+                                            const ALSATimerRealTimeEventType *entries,
                                             gsize entry_count, GError **error)
 {
     ALSATimerInstanceParamsPrivate *priv;
@@ -190,21 +190,21 @@ 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@TstampEventType].
+ *           [enum@RealTimeEventType].
  * @entry_count: The number of elements in the above array.
  * @error: A [struct@GLib.Error] at failure.
  *
- * Get the list of [enum@TstampEventType] to filter events. This parameter is effective only for
- * target instance with [enum@EventType:TIMESTAMP].
+ * Get the list of [enum@RealTimeEventType] to filter events. This parameter is effective only for
+ * target instance with [enum@EventType].REAL_TIME.
  *
  * Returns: %TRUE when the overall operation finishes successfully, else %FALSE.
  */
 gboolean alsatimer_instance_params_get_event_filter(ALSATimerInstanceParams *self,
-                                            ALSATimerTstampEventType **entries,
+                                            ALSATimerRealTimeEventType **entries,
                                             gsize *entry_count, GError **error)
 {
     ALSATimerInstanceParamsPrivate *priv;
-    ALSATimerTstampEventType *list;
+    ALSATimerRealTimeEventType *list;
     unsigned int filter;
     unsigned int count;
     unsigned int index;
@@ -232,7 +232,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] = (ALSATimerTstampEventType)i;
+            list[index] = (ALSATimerRealTimeEventType)i;
             if (++index >= count)
                 break;
         }
index 7ed58149a216d873ee23ca6bbae24345195942d5..e91348801a876bd4e2d0542fb34505bce54bff99 100644 (file)
@@ -18,11 +18,11 @@ struct _ALSATimerInstanceParamsClass {
 ALSATimerInstanceParams *alsatimer_instance_params_new();
 
 gboolean alsatimer_instance_params_set_event_filter(ALSATimerInstanceParams *self,
-                                            const ALSATimerTstampEventType *entries,
+                                            const ALSATimerRealTimeEventType *entries,
                                             gsize entry_count, GError **error);
 
 gboolean alsatimer_instance_params_get_event_filter(ALSATimerInstanceParams *self,
-                                            ALSATimerTstampEventType **entries,
+                                            ALSATimerRealTimeEventType **entries,
                                             gsize *entry_count, GError **error);
 
 G_END_DECLS
index c66cf589a0add1199a7e8488a1696243365f1924..fecdea89501680c2484712e9c921111c690cedf3 100644 (file)
@@ -27,21 +27,21 @@ G_DEFINE_BOXED_TYPE(ALSATimerRealTimeEvent, alsatimer_real_time_event, timer_rea
 /**
  * alsatimer_real_time_event_get_event:
  * @self: A [struct@RealTimeEvent].
- * @event: (out): The type of tstamp event, one of [enum@TstampEventType].
+ * @event: (out): The type of real time event, one of [enum@RealTimeEventType].
  *
- * Get the kind of event for the timestamp event.
+ * Get the kind of event for the real time event.
  */
 void alsatimer_real_time_event_get_event(const ALSATimerRealTimeEvent *self,
-                                         ALSATimerTstampEventType *event)
+                                         ALSATimerRealTimeEventType *event)
 {
-    *event = (ALSATimerTstampEventType)self->event;
+    *event = (ALSATimerRealTimeEventType)self->event;
 }
 
 /**
  * alsatimer_real_time_event_get_time:
  * @self: A [struct@RealTimeEvent].
  * @real_time: (array fixed-size=2) (inout): The array with two elements for the seconds and
- *             nanoseconds part of timestamp when the instance queues the timestamp event.
+ *             nanoseconds part of timestamp when the real time event occurs.
  *
  * Get the seconds and nanoseconds part for the real time event.
  */
@@ -57,7 +57,7 @@ void alsatimer_real_time_event_get_time(const ALSATimerRealTimeEvent *self,
  * @self: A [struct@RealTimeEvent].
  * @val: (out): The value depending on the type of timestamp event.
  *
- * Get the value depending on the type of timestamp event.
+ * Get the value depending on the type of real time event.
  */
 void alsatimer_real_time_event_get_val(const ALSATimerRealTimeEvent *self, guint *val)
 {
index 9165dd6f8b91cc6e826513565f26f551a701b04f..7b8cc42f7f839c3d4bd09a7ae7d5aa7661759410 100644 (file)
@@ -13,7 +13,7 @@ typedef struct snd_timer_tread ALSATimerRealTimeEvent;
 GType alsatimer_real_time_event_get_type() G_GNUC_CONST;
 
 void alsatimer_real_time_event_get_event(const ALSATimerRealTimeEvent *self,
-                                         ALSATimerTstampEventType *event);
+                                         ALSATimerRealTimeEventType *event);
 
 void alsatimer_real_time_event_get_time(const ALSATimerRealTimeEvent *self,
                                         gint64 *const real_time[2]);
index 487ad87afbbcb2864477d2d4e73df4c6cb549b2b..e60532bf3955d6ff292bf68b18f965b32b3e4193 100644 (file)
@@ -35,7 +35,7 @@ instance_param_flags = (
     'EARLY_EVENT',
 )
 
-tstamp_event_types = (
+real_time_event_types = (
     'RESOLUTION',
     'TICK',
     'START',
@@ -71,7 +71,7 @@ types = {
     ALSATimer.SpecificGlobalDevice: specific_global_devices,
     ALSATimer.DeviceInfoFlag:       device_info_flags,
     ALSATimer.InstanceParamFlag:    instance_param_flags,
-    ALSATimer.TstampEventType:      tstamp_event_types,
+    ALSATimer.RealTimeEventType:    real_time_event_types,
     ALSATimer.EventType:            event_types,
     ALSATimer.UserInstanceError:    user_instance_error_types,
 }