From: Takashi Iwai <tiwai@suse.de>
To: alsa-devel@alsa-project.org
Subject: [PATCH alsa-lib 3/3] seq: Add UMP 1.1 features
Date: Mon, 12 Jun 2023 10:19:48 +0200 [thread overview]
Message-ID: <20230612081948.18346-4-tiwai@suse.de> (raw)
In-Reply-To: <20230612081948.18346-1-tiwai@suse.de>
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
--
2.35.3
prev parent reply other threads:[~2023-06-12 8:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-12 8:19 [PATCH alsa-lib 0/3] ALSA-lib updates for UMP 1.1 Takashi Iwai
2023-06-12 8:19 ` [PATCH alsa-lib 1/3] uapi: Update rawmidi API to 2.0.4 Takashi Iwai
2023-06-12 8:19 ` [PATCH alsa-lib 2/3] ump: Add UMP 1.1 features Takashi Iwai
2023-06-12 8:19 ` Takashi Iwai [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230612081948.18346-4-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox