[alsa-devel] alsa-gobject Add shared library to operate ALSA Timer character device
GitHub pull_request - opened
github at alsa-project.org
Sun Feb 9 03:11:46 CET 2020
alsa-project/alsa-gobject pull request #6 was opened from takaswie:
This request is to add a new library, libalsatimer, to operate ALSA Timer
character device.
In design of ALSA Timer core, one character device is added to Linux system.
Usually a special file, '/dev/snd/timer' is used for the character device.
Userspace applications can enumerate actual timer device to operate the
character device.
For enumerations of the timer devices, the library includes a global
functions, 'alsatimer_get_device_id_list()'. The timer devices are
identified by 'ALSATimerDeviceId' which is a GObject boxed object to
handle 'struct snd_timer_id'. The other global functions are available
to the timer device, as a wrapper of some ioctl commands below:
* alsatimer_get_device_info() = SNDRV_TIMER_IOCTL_GINFO
* alsatimer_get_device_status() = SNDRV_TIMER_IOCTL_GPARAMS
* alsatimer_set_device_params() = SNDRV_TIMER_IOCTL_GSTATUS
Userspace applications can allocate timer instances and attach them to
the timer device to receive timer events. The library includes
'ALSATimerUserInstance' which is an GObject-derived object to maintain
file descriptor of ALSA Timer character device. Usually, the series of
below calls are expected to use in the order to start emission of timer
events:
* alsatimer_user_instance_new()
* alsatimer_user_instance_open()
* alsatimer_user_instance_attach()
* alsatimer_user_instance_set_params()
* alsatimer_user_instance_start()
* alsatimer_user_instance_stop()
Against the attachment to timer device, there's a way to associate
the instance to the another instance as slave. This is achieved by a
call of 'alsatimer_user_instance_attach_as_slave()'. The
'ALSATimerDeviceId' is the lack of properties relevant to slave
association since the information relevant to slave association in
kernel space is not available for userspace application at all and
the properties are just used to transfer the information from
userspace by one way.
ALSA Timer core supports two types of events, which is switched by
'tread operation'. To handle these two, the library has
'ALSATimerEventData' which is an GObject-derived abstract class.
There are two specialized classes from it; 'ALSATimerEventDataTick'
and 'ALSATimerEventDataTimestamp'. The former is just for tick event
and the latter is for events with its type and timestamp. The selection
is done by a call of attach function with the type of event data.
Request URL : https://github.com/alsa-project/alsa-gobject/pull/6
Patch URL : https://github.com/alsa-project/alsa-gobject/pull/6.patch
Repository URL: https://github.com/alsa-project/alsa-gobject
More information about the Alsa-devel
mailing list