Add APIs for groupless message filtering.
Signed-off-by: Takashi Iwai tiwai@suse.de --- include/seq.h | 3 +++ include/sound/uapi/asequencer.h | 5 ++++- src/Versions.in | 2 ++ src/seq/seq.c | 32 ++++++++++++++++++++++++++++++++ 4 files changed, 41 insertions(+), 1 deletion(-)
diff --git a/include/seq.h b/include/seq.h index 7faf4367df3d..68934037cb88 100644 --- a/include/seq.h +++ b/include/seq.h @@ -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); diff --git a/include/sound/uapi/asequencer.h b/include/sound/uapi/asequencer.h index 3653a3f33778..b913f31daa2d 100644 --- a/include/sound/uapi/asequencer.h +++ b/include/sound/uapi/asequencer.h @@ -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 */ };
diff --git a/src/Versions.in b/src/Versions.in index 0c2837305039..c8ac1c8277a3 100644 --- a/src/Versions.in +++ b/src/Versions.in @@ -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; diff --git a/src/seq/seq.c b/src/seq/seq.c index 65ccaaed5896..9d3a18d3ea99 100644 --- a/src/seq/seq.c +++ b/src/seq/seq.c @@ -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