seq: Add UMP 1.1 features

Add APIs for groupless message filtering.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Takashi Iwai 2023-03-27 10:43:50 +02:00
parent 80e20a1052
commit 77247f51c4
4 changed files with 41 additions and 1 deletions

View file

@ -159,6 +159,7 @@ int snd_seq_client_info_get_event_lost(const snd_seq_client_info_t *info);
int snd_seq_client_info_get_midi_version(const snd_seq_client_info_t *info);
int snd_seq_client_info_get_ump_group_enabled(const snd_seq_client_info_t *info,
int group);
int snd_seq_client_info_get_ump_groupless_enabled(const snd_seq_client_info_t *info);
int snd_seq_client_info_get_ump_conversion(const snd_seq_client_info_t *info);
void snd_seq_client_info_set_client(snd_seq_client_info_t *info, int client);
void snd_seq_client_info_set_name(snd_seq_client_info_t *info, const char *name);
@ -168,6 +169,8 @@ void snd_seq_client_info_set_event_filter(snd_seq_client_info_t *info, unsigned
void snd_seq_client_info_set_midi_version(snd_seq_client_info_t *info, int midi_version);
void snd_seq_client_info_set_ump_group_enabled(snd_seq_client_info_t *info,
int group, int enable);
void snd_seq_client_info_set_ump_groupless_enabled(snd_seq_client_info_t *info,
int enable);
void snd_seq_client_info_set_ump_conversion(snd_seq_client_info_t *info, int enable);
void snd_seq_client_info_event_filter_clear(snd_seq_client_info_t *info);

View file

@ -378,7 +378,10 @@ struct snd_seq_client_info {
int card; /* RO: card number[kernel] */
int pid; /* RO: pid[user] */
unsigned int midi_version; /* MIDI version */
unsigned int group_filter; /* UMP group filter bitmap */
unsigned int group_filter; /* UMP group filter bitmap
* (bit 0 = groupless messages,
* bit 1-16 = messages for groups 1-16)
*/
char reserved[48]; /* for future use */
};

View file

@ -159,9 +159,11 @@ ALSA_1.2.10 {
@SYMBOL_PREFIX@snd_seq_ump_*;
@SYMBOL_PREFIX@snd_seq_client_info_get_midi_version;
@SYMBOL_PREFIX@snd_seq_seq_client_info_get_ump_group_enabled;
@SYMBOL_PREFIX@snd_seq_client_info_get_ump_groupless_enabled;
@SYMBOL_PREFIX@snd_seq_seq_client_get_ump_conversion;
@SYMBOL_PREFIX@snd_seq_client_info_set_midi_version;
@SYMBOL_PREFIX@snd_seq_seq_client_info_set_ump_group_enabled;
@SYMBOL_PREFIX@snd_seq_client_info_set_ump_groupless_enabled;
@SYMBOL_PREFIX@snd_seq_seq_client_set_ump_conversion;
@SYMBOL_PREFIX@snd_seq_get_ump_endpoint_info;
@SYMBOL_PREFIX@snd_seq_get_ump_block_info;

View file

@ -1763,6 +1763,21 @@ int snd_seq_client_info_get_ump_group_enabled(const snd_seq_client_info_t *info,
return !(info->group_filter & (1U << group));
}
#define UMP_GROUPLESS_FILTER (1U << 0)
/**
* \brief Get the UMP groupless message handling status
* \param info client_info container
* \return 1 if UMP groupless messages is processed, 0 if filtered/disabled
*
* \sa snd_seq_get_client_info()
*/
int snd_seq_client_info_get_ump_groupless_enabled(const snd_seq_client_info_t *info)
{
assert(info);
return !(info->group_filter & UMP_GROUPLESS_FILTER);
}
/**
* \brief Get the automatic conversion mode for UMP
* \param info client_info container
@ -1850,6 +1865,23 @@ void snd_seq_client_info_set_ump_group_enabled(snd_seq_client_info_t *info,
info->group_filter |= (1U << group);
}
/**
* \brief Enable/disable the UMP groupless message handling
* \param info client_info container
* \param enable enable the UMP groupless messages
*
* \sa snd_seq_set_client_info(), snd_seq_client_info_get_ump_groupless_enabled()
*/
void snd_seq_client_info_set_ump_groupless_enabled(snd_seq_client_info_t *info,
int enable)
{
assert(info);
if (enable)
info->group_filter &= ~UMP_GROUPLESS_FILTER;
else
info->group_filter |= UMP_GROUPLESS_FILTER;
}
/**
* \brief Set the automatic conversion mode for UMP
* \param info client_info container