alsa-gobject: add library to operate ALSA Sequencer character device without queue feature
GitHub pull_request - edited
github at alsa-project.org
Fri Apr 3 15:03:59 CEST 2020
alsa-project/alsa-gobject pull request #10 was edited from takaswie:
This request is to add a new library, libalsaseq, to operate ALSA Sequencer
character device.
In design of ALSA Sequencer, one character device is added to Linux system.
Usually a special file, '/dev/snd/seq', is used for the character device.
Userspace applications can operate ALSA Sequencer via the character device.
The library supports functionalities of ALSA Sequencer but without
queue-related ones.
The library includes some GObject-derived object. ALSASeq.UserClient
maintains file descriptor of ALSA Sequencer character device, thus it's
the center of user operation. The other objects represent data structures
in UAPI of ALSA Sequencer.
* ALSASeqSystemInfo - struct snd_seq_system_info
* ALSASeqClientInfo - struct snd_seq_client_info
* ALSASeqClientPool - struct snd_seq_client_pool
* ALSASeqPortInfo - struct snd_seq_port_info
* ALSASeqSubscribeData - struct snd_seq_port_subscribe
The library includes some GObject boxed object just to represent data
structures. ALSASeq.Addr is a thin wrapper to struct snd_seq_addr, and
ALSASeq.Tstamp is a thin wrapper to struct snd_seq_timestamp.
For operations without instances of ALSASeq.UserClient, the library
has some global APIs.
ALSA Sequencer has some macros. They're represented as GObject
enumerations and flags.
* ALSASeq.ClientType - one of NO_CLIENT, USER_CLIENT, KERNEL_CLIENT
* ALSASeq.FilterAttrFlag - SNDRV_SEQ_FILTER_XXX
* ALSASeq.PortCapFlag - SNDRV_PORT_CAP_XXX
* ALSASeq.PortAttrFlag - NDRV_SEQ_PORT_TYPE_XXX
* ALSASeq.EventType - SNDRV_SEQ_EVENT_XXX
* ALSASeq.EventTimestampMode - SNDRV_SEQ_TIME_STAMP_XXX
* ALSASeq.EventTimeMode - SNDRV_SEQ_TIME_MODE_XXX
* ALSASeq.EventLengthMode - SNDRV_SEQ_EVENT_LENGTH_XXX
* ALSASeq.EventPriorityMode - SNDRV_SEQ_PRIORITY_XXX
* ALSASeq.PortSubscribeFlag - SNDRV_SEQ_PORT_SUBS_XXX
* ALSASeq.QuerySubscribeType - SNDRV_SEQ_QUERY_SUBS_XXX
Some specific values for addressing are also represented by GObject
enumerations and flags.
* ALSASeq.SpecificAddress - SNDRV_SEQ_ADDRESS_XXX
* ALSASeq.SpecificClientId - SNDRV_SEQ_CLIENT_XXX
* ALSASeq.SpecificPortId - SNDRV_SEQ_PORT_SYSTEM_XXX
* ALSASeq.SpecificQueueId - SNDRV_SEQ_QUEUE_XXX
ALSA Sequencer has many types of event. The library has an GObject
abstract object, ALSASeq.Event. Two objects are derived from it:
* ALSASeq.EventFixed
* ALSASeq.EventVariable
The former has some ways to access to the data of event. The data is
represented by GObject boxed object if it's complicated structure:
* ALSASeq.EventDataConnect - struct snd_seq_connect
* ALSASeq.EventDataNote - struct snd_seq_ev_note
* ALSASeq.EventDataCtl - struct snd_seq_ev_ctrl
* ALSASeq.EventDataResult - struct snd_seq_result
* ALSASeq.EventDataQueue - struct snd_seq_ev_queue_control
The latter is for events to have variable length of data blob.
ALSASeq.UserClient has 'schedule_event' API to schedule arbitrary
event. It also has 'handle-event' GObject signal for applications
to handle asynchronous event as an instance of ALSASeq.EventFixed or
ALSASeq.EventVariable. To handle the GObject signal, applications
should get GSource from the instance and process GMainContext,
typically by call of GMainLoop.
The library doesn't have support for below structures since they're useless
practically:
* struct snd_seq_event_bounce
* struct snd_seq_running_info
In my later work, queue functions will be added.
Request URL : https://github.com/alsa-project/alsa-gobject/pull/10
Patch URL : https://github.com/alsa-project/alsa-gobject/pull/10.patch
Repository URL: https://github.com/alsa-project/alsa-gobject
More information about the Alsa-devel
mailing list