instance.open(0)
# Choose tstamp type of data for event and register event handler.
-instance.choose_event_data_type(ALSATimer.EventDataType.TSTAMP)
+instance.choose_event_type(ALSATimer.EventType.TSTAMP)
def handle_tstamp_event(instance, event):
tstamp = event.get_tstamp([0, 0])
print('\nEvent at', tstamp)
} ALSATimerTstampEventType;
/**
- * ALSATimerEventDataType
- * @ALSATIMER_EVENT_DATA_TYPE_TICK: The data for tick event.
- * @ALSATIMER_EVENT_DATA_TYPE_TSTAMP: The data for timestamp event.
+ * ALSATimerEventType
+ * @ALSATIMER_EVENT_TYPE_TICK: The data for tick event.
+ * @ALSATIMER_EVENT_TYPE_TSTAMP: The data for timestamp event.
*
- * A set of enumerations for the type of event data.
+ * A set of enumerations for the type of event.
*/
typedef enum {
- ALSATIMER_EVENT_DATA_TYPE_TICK,
- ALSATIMER_EVENT_DATA_TYPE_TSTAMP,
-} ALSATimerEventDataType;
+ ALSATIMER_EVENT_TYPE_TICK,
+ ALSATIMER_EVENT_TYPE_TSTAMP,
+} ALSATimerEventType;
/**
* ALSATimerUserInstanceError:
"alsatimer_specific_global_device_get_type";
"alsatimer_device_info_flag_get_type";
"alsatimer_instance_param_flag_get_type";
- "alsatimer_event_data_type_get_type";
"alsatimer_device_id_get_type";
"alsatimer_device_id_new";
"alsatimer_user_instance_open";
"alsatimer_user_instance_get_protocol_version";
- "alsatimer_user_instance_choose_event_data_type";
"alsatimer_user_instance_attach";
"alsatimer_user_instance_attach_as_slave";
"alsatimer_user_instance_get_info";
"alsatimer_user_instance_stop";
"alsatimer_user_instance_pause";
"alsatimer_user_instance_continue";
+ "alsatimer_user_instance_choose_event_type";
"alsatimer_tstamp_event_type_get_type";
+ "alsatimer_event_type_get_type";
} ALSA_GOBJECT_0_2_0;
* @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@EventDataType:TIMESTAMP].
+ * target instance with [enum@EventType:TIMESTAMP].
*
* Returns: %TRUE when the overall operation finishes successfully, else %FALSE.
*/
* @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@EventDataType:TIMESTAMP].
+ * target instance with [enum@EventType:TIMESTAMP].
*
* Returns: %TRUE when the overall operation finishes successfully, else %FALSE.
*/
*/
typedef struct {
int fd;
- ALSATimerEventDataType event_data_type;
+ ALSATimerEventType event_type;
guint16 proto_ver_triplet[3];
} ALSATimerUserInstancePrivate;
G_DEFINE_TYPE_WITH_PRIVATE(ALSATimerUserInstance, alsatimer_user_instance, G_TYPE_OBJECT)
}
/**
- * alsatimer_user_instance_choose_event_data_type:
+ * alsatimer_user_instance_choose_event_type:
* @self: A [class@UserInstance].
- * @event_data_type: The type of event data, one of [enum@EventDataType].
+ * @event_type: The type of event data, one of [enum@EventType].
* @error: A [struct@GLib.Error]. Error is generated with domain of `ALSATimer.UserInstanceError`.
*
* Choose the type of event data to receive.
*
* The call of function is successful just before the instance is not attached yet.
- * [enum@EventDataType:TICK] is used as a default if the function is not called for
- * [enum@EventDataType:TSTAMP] explicitly.
+ * [enum@EventType:TICK] is used as a default if the function is not called for
+ * [enum@EventType:TSTAMP] explicitly.
*
* The call of function executes `ioctl(2)` system call with `SNDRV_TIMER_IOCTL_TREAD` command
* for ALSA timer character device.
*
* Returns: %TRUE when the overall operation finishes successfully, else %FALSE.
*/
-gboolean alsatimer_user_instance_choose_event_data_type(ALSATimerUserInstance *self,
- ALSATimerEventDataType event_data_type,
+gboolean alsatimer_user_instance_choose_event_type(ALSATimerUserInstance *self,
+ ALSATimerEventType event_type,
GError **error)
{
ALSATimerUserInstancePrivate *priv;
g_return_val_if_fail(error == NULL || *error == NULL, FALSE);
- tread = (int)event_data_type;
+ tread = (int)event_type;
if (ioctl(priv->fd, SNDRV_TIMER_IOCTL_TREAD, &tread) < 0) {
if (errno == EBUSY)
generate_local_error(error, ALSATIMER_USER_INSTANCE_ERROR_ATTACHED);
return FALSE;
}
- priv->event_data_type = event_data_type;
+ priv->event_type = event_type;
return TRUE;
}
return G_SOURCE_REMOVE;
}
- switch (priv->event_data_type) {
- case ALSATIMER_EVENT_DATA_TYPE_TICK:
+ switch (priv->event_type) {
+ case ALSATIMER_EVENT_TYPE_TICK:
dispatch_tick_events(self, src->buf, (size_t)len);
break;
- case ALSATIMER_EVENT_DATA_TYPE_TSTAMP:
+ case ALSATIMER_EVENT_TYPE_TSTAMP:
dispatch_tstamp_events(self, src->buf, (size_t)len);
break;
default:
const guint16 *proto_ver_triplet[3],
GError **error);
-gboolean alsatimer_user_instance_choose_event_data_type(ALSATimerUserInstance *self,
- ALSATimerEventDataType event_data_type,
+gboolean alsatimer_user_instance_choose_event_type(ALSATimerUserInstance *self,
+ ALSATimerEventType event_type,
GError **error);
gboolean alsatimer_user_instance_attach(ALSATimerUserInstance *self, ALSATimerDeviceId *device_id,
'MRESUME',
)
-event_data_types = (
+event_types = (
'TICK',
'TSTAMP',
)
ALSATimer.DeviceInfoFlag: device_info_flags,
ALSATimer.InstanceParamFlag: instance_param_flags,
ALSATimer.TstampEventType: tstamp_event_types,
- ALSATimer.EventDataType: event_data_types,
+ ALSATimer.EventType: event_types,
ALSATimer.UserInstanceError: user_instance_error_types,
}
'new',
'open',
'get_protocol_version',
- 'choose_event_data_type',
+ 'choose_event_type',
'attach',
'attach_as_slave',
'get_info',