instance.open(0)
# Choose tstamp type of data for event and register event handler.
-instance.choose_event_type(ALSATimer.EventType.TSTAMP)
+instance.choose_event_type(ALSATimer.EventType.REAL_TIME)
def handle_real_time_event(instance, event):
real_time = event.get_time([0, 0])
print('\nEvent at', real_time)
/**
* ALSATimerEventType
- * @ALSATIMER_EVENT_TYPE_TICK: The data for tick event.
- * @ALSATIMER_EVENT_TYPE_TSTAMP: The data for timestamp event.
+ * @ALSATIMER_EVENT_TYPE_TICK_TIME: Event for tick time.
+ * @ALSATIMER_EVENT_TYPE_REAL_TIME: Event for real time.
*
* A set of enumerations for the type of event.
*/
typedef enum {
- ALSATIMER_EVENT_TYPE_TICK,
- ALSATIMER_EVENT_TYPE_TSTAMP,
+ ALSATIMER_EVENT_TYPE_TICK_TIME,
+ ALSATIMER_EVENT_TYPE_REAL_TIME,
} ALSATimerEventType;
/**
* @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.
*
- * Get the seconds and nanoseconds part for the timestamp event.
+ * Get the seconds and nanoseconds part for the real time event.
*/
void alsatimer_real_time_event_get_time(const ALSATimerRealTimeEvent *self,
gint64 *const real_time[2])
* @self: A [class@UserInstance].
* @event: (transfer none): The instance of [struct@TickTimeEvent].
*
- * Emitted when tick event occurs.
+ * Emitted when event occurs to notify tick time.
*/
timer_user_instance_sigs[TIMER_USER_INSTANCE_SIG_HANDLE_TICK_TIME_EVENT] =
g_signal_new("handle-tick-time-event",
* @self: A [class@UserInstance].
* @event: (transfer none): The instance of [struct@RealTimeEvent].
*
- * Emitted when timestamp event occurs.
+ * Emitted when event occurs to notify real time.
*/
timer_user_instance_sigs[TIMER_USER_INSTANCE_SIG_HANDLE_REAL_TIME_EVENT] =
g_signal_new("handle-real-time-event",
*
* Choose the type of event data to receive.
*
- * The call of function is successful just before the instance is not attached yet.
- * [enum@EventType:TICK] is used as a default if the function is not called for
- * [enum@EventType:TSTAMP] explicitly.
+ * The call of function is successful just before call of [method@UserInstance.attach].
+ * [enum@EventType].TICK_TIME is used as a default if the function is not called for
+ * [enum@EventType].REAL_TIME explicitly. When the former is configured, event for tick time is
+ * available for [signal@UserInstance::handle_tick_time_event]. When the latter is configured,
+ * event for real time is available for [signal@UserInstance::handle_real_time_event].
*
* The call of function executes `ioctl(2)` system call with `SNDRV_TIMER_IOCTL_TREAD` command
* for ALSA timer character device.
}
switch (priv->event_type) {
- case ALSATIMER_EVENT_TYPE_TICK:
+ case ALSATIMER_EVENT_TYPE_TICK_TIME:
dispatch_tick_time_events(self, src->buf, (size_t)len);
break;
- case ALSATIMER_EVENT_TYPE_TSTAMP:
+ case ALSATIMER_EVENT_TYPE_REAL_TIME:
dispatch_real_time_events(self, src->buf, (size_t)len);
break;
default: