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

@ -255,6 +255,44 @@ int snd_seq_set_client_event_filter(snd_seq_t *seq, int event_type)
return snd_seq_set_client_info(seq, &info);
}
/**
* \brief set client MIDI protocol version
* \param seq sequencer handle
* \param midi_version MIDI protocol version to set
* \return 0 on success or negative error code
*
* \sa snd_seq_set_client_info()
*/
int snd_seq_set_client_midi_version(snd_seq_t *seq, int midi_version)
{
snd_seq_client_info_t info;
int err;
if ((err = snd_seq_get_client_info(seq, &info)) < 0)
return err;
snd_seq_client_info_set_midi_version(&info, midi_version);
return snd_seq_set_client_info(seq, &info);
}
/**
* \brief enable/disable client's automatic conversion of UMP/legacy events
* \param seq sequencer handle
* \param enable 0 or 1 to disable/enable the conversion
* \return 0 on success or negative error code
*
* \sa snd_seq_set_client_info()
*/
int snd_seq_set_client_ump_conversion(snd_seq_t *seq, int enable)
{
snd_seq_client_info_t info;
int err;
if ((err = snd_seq_get_client_info(seq, &info)) < 0)
return err;
snd_seq_client_info_set_ump_conversion(&info, enable);
return snd_seq_set_client_info(seq, &info);
}
/**
* \brief change the output pool size of the given client
* \param seq sequencer handle