seq: Add UMP support

This patch adds the basic support of UMP on ALSA sequencer API.
An extended event type, snd_seq_ump_event_t, is defined.  It's
compatible with the existing type, snd_seq_event_t, but it has a
larger payload of 16 bytes instead of 12 bytes, for holding the full
128bit UMP packet.

The new snd_seq_ump_event_t must have the bit SND_SEQ_EVENT_UMP in the
event flags.

A few new API functions have been added such as
snd_seq_ump_event_output() and snd_seq_ump_event_input() for
reading/writing this new event object.

The support of UMP in the sequencer client is switched by the function
snd_seq_client_set_midi_version().  It can switch from the default
legacy MIDI to UMP MIDI 1.0 or 2.0 on the fly.

The automatic event conversion among UMP and legacy clients can be
suppressed via snd_seq_client_set_ump_conversion().

The inquiry of the associated UMP Endpoints and UMP Blocks can be done
via snd_seq_get_ump_endpoint_info() and snd_seq_get_ump_block_info().

Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Takashi Iwai 2022-11-17 15:49:44 +01:00
parent c40dc19a57
commit 2aefb5c41c
9 changed files with 604 additions and 51 deletions

View file

@ -284,6 +284,28 @@ extern "C" {
(ev)->data.queue.queue = (q),\
(ev)->data.queue.param.time.tick = (ttime))
/**
* \brief set the event UMP flag
* \param ev event record
*/
static inline void snd_seq_ev_set_ump(snd_seq_ump_event_t *ev)
{
ev->flags |= SND_SEQ_EVENT_UMP;
ev->type = 0; /* unused for UMP */
}
/**
* \brief set the event UMP flag and fill UMP raw bytes
* \param ev event record
* \param data UMP packet data
* \param bytes UMP packet size in bytes
*/
static inline void snd_seq_ev_set_ump_data(snd_seq_ump_event_t *ev, void *data, size_t bytes)
{
snd_seq_ev_set_ump(ev);
memcpy(ev->ump, data, bytes);
}
/* set and send a queue control event */
int snd_seq_control_queue(snd_seq_t *seq, int q, int type, int value, snd_seq_event_t *ev);
@ -343,6 +365,8 @@ int snd_seq_disconnect_to(snd_seq_t *seq, int my_port, int dest_client, int dest
*/
int snd_seq_set_client_name(snd_seq_t *seq, const char *name);
int snd_seq_set_client_event_filter(snd_seq_t *seq, int event_type);
int snd_seq_set_client_midi_version(snd_seq_t *seq, int midi_version);
int snd_seq_set_client_ump_conversion(snd_seq_t *seq, int enable);
int snd_seq_set_client_pool_output(snd_seq_t *seq, size_t size);
int snd_seq_set_client_pool_output_room(snd_seq_t *seq, size_t size);
int snd_seq_set_client_pool_input(snd_seq_t *seq, size_t size);