Questions about event implementation in ALSA Sequencer

Takashi Sakamoto o-takashi at sakamocchi.jp
Tue Feb 18 04:11:02 CET 2020


Hi,

I'm working for alsa-gobject[1] so that it supports API for ALSA Sequencer.
At present I've mostly done it just with direct dispatch support[2] (thus
transmission via queue is for my later work). Then I have some questions
about the design of event in ALSA Sequencer. I'd like to ask for some advices
(mainly Iwai-san, perhaps).

1. use case of SNDRV_SEQ_EVENT_LENGTH_VARUSR in 'struct snd_seq_event'

In my understanding, the flag is used for a case that sender transmits the
value of pointer itself and its length to the receiver in the shape of
'struct snd_seq_ev_ext'. I assume that two use cases. If the sender and
receiver are in the same process, the event is a request for the receiver to
operate data in the same VMA. If the sender and receiver are in different
processes, the event is a request for pointer-based calculation between the
peer.

If the above understanding is correct, it's hard to represent this type of
event for g-i interface because g-i is the object-based framework. Any raw
pointer without explicit type is hard to be exposed to g-i applications as
long as I know, and it's going to be unsupported, perhaps.


2. event data type corresponding to event type

Some event types are expected to specific data type; e.g. SNDRV_SEQ_EVENT_NOTE
is for 'struct snd_seq_ev_note' and SNDRV_SEQ_EVENT_CONTROLLER is for
'struct snd_seq_ev_ctrl'. However there're some types for any data type; e.g.
SNDRV_SEQ_EVENT_ECHO or SNDRV_SEQ_EVENT_USR0. For the kind of types, the
event structure has no information about which data type should be used and
user applications voluntarily decide the data type. Therefore the sender
and receiver should share a kind of protocol in advance.

This means that userspace applications require API to select data type
independent of event type itself.


3. quote event and specific event types.

Two event types are reserved for 'struct snd_seq_ev_quote'; i.e.
SNDRV_SEQ_EVENT_KERNEL_ERROR and SNDRV_SEQ_EVENT_KERNEL_QUOTE(obsoleted?).
However, the quote structure is exposed to userspace itself. Furthermore,
as of v5.5 kernel, there's no in-kernel code to check the quote data
from/to user client.

Is it better to produce API so that userspace application can transfer
the quote event?

[1] https://github.com/alsa-project/alsa-gobject
[2] https://github.com/takaswie/alsa-gobject/tree/topic/seq

Regards


Takashi Sakamoto


More information about the Alsa-devel mailing list