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

@ -225,6 +225,7 @@ typedef union snd_seq_timestamp {
#define SND_SEQ_PRIORITY_HIGH (1<<4) /**< event should be processed before others */
#define SND_SEQ_PRIORITY_MASK (1<<4) /**< mask for priority bits */
#define SND_SEQ_EVENT_UMP (1<<5) /**< UMP packet event */
/** Note event */
typedef struct snd_seq_ev_note {
@ -291,6 +292,19 @@ typedef struct snd_seq_ev_queue_control {
} param; /**< data value union */
} snd_seq_ev_queue_control_t;
/** Sequencer event data */
typedef union snd_seq_event_data {
snd_seq_ev_note_t note; /**< note information */
snd_seq_ev_ctrl_t control; /**< MIDI control information */
snd_seq_ev_raw8_t raw8; /**< raw8 data */
snd_seq_ev_raw32_t raw32; /**< raw32 data */
snd_seq_ev_ext_t ext; /**< external data */
snd_seq_ev_queue_control_t queue; /**< queue control */
snd_seq_timestamp_t time; /**< timestamp */
snd_seq_addr_t addr; /**< address */
snd_seq_connect_t connect; /**< connect information */
snd_seq_result_t result; /**< operation result code */
} snd_seq_event_data_t;
/** Sequencer event */
typedef struct snd_seq_event {
@ -304,20 +318,24 @@ typedef struct snd_seq_event {
snd_seq_addr_t source; /**< source address */
snd_seq_addr_t dest; /**< destination address */
union {
snd_seq_ev_note_t note; /**< note information */
snd_seq_ev_ctrl_t control; /**< MIDI control information */
snd_seq_ev_raw8_t raw8; /**< raw8 data */
snd_seq_ev_raw32_t raw32; /**< raw32 data */
snd_seq_ev_ext_t ext; /**< external data */
snd_seq_ev_queue_control_t queue; /**< queue control */
snd_seq_timestamp_t time; /**< timestamp */
snd_seq_addr_t addr; /**< address */
snd_seq_connect_t connect; /**< connect information */
snd_seq_result_t result; /**< operation result code */
} data; /**< event data... */
snd_seq_event_data_t data; /**< event data... */
} snd_seq_event_t;
/** UMP sequencer event; compatible with legacy sequencer event */
typedef struct snd_seq_ump_event {
snd_seq_event_type_t type; /**< event type */
unsigned char flags; /**< event flags */
unsigned char tag; /**< tag */
unsigned char queue; /**< schedule queue */
snd_seq_timestamp_t time; /**< schedule time */
snd_seq_addr_t source; /**< source address */
snd_seq_addr_t dest; /**< destination address */
union {
snd_seq_event_data_t data; /**< (shared) legacy data */
unsigned int ump[4]; /**< UMP data bytes */
};
} snd_seq_ump_event_t;
/** \} */