Skip to content

Commit 329ffe1

Browse files
committed
ALSA: seq: Allow suppressing UMP conversions
A sequencer client like seq_dummy rather doesn't want to convert UMP events but receives / sends as is. Add a new event filter flag to suppress the automatic UMP conversion and applies accordingly. Reviewed-by: Jaroslav Kysela <perex@perex.cz> Link: https://lore.kernel.org/r/20230523075358.9672-32-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent e9e0281 commit 329ffe1

3 files changed

Lines changed: 19 additions & 8 deletions

File tree

include/uapi/sound/asequencer.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,7 @@ typedef int __bitwise snd_seq_client_type_t;
347347
#define SNDRV_SEQ_FILTER_BROADCAST (1U<<0) /* accept broadcast messages */
348348
#define SNDRV_SEQ_FILTER_MULTICAST (1U<<1) /* accept multicast messages */
349349
#define SNDRV_SEQ_FILTER_BOUNCE (1U<<2) /* accept bounce event in error */
350+
#define SNDRV_SEQ_FILTER_NO_CONVERT (1U<<30) /* don't convert UMP events */
350351
#define SNDRV_SEQ_FILTER_USE_EVENT (1U<<31) /* use event filter */
351352

352353
struct snd_seq_client_info {

sound/core/seq/seq_clientmgr.c

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -671,14 +671,16 @@ static int snd_seq_deliver_single_event(struct snd_seq_client *client,
671671
dest_port->time_real);
672672

673673
#if IS_ENABLED(CONFIG_SND_SEQ_UMP)
674-
if (snd_seq_ev_is_ump(event)) {
675-
result = snd_seq_deliver_from_ump(client, dest, dest_port,
676-
event, atomic, hop);
677-
goto __skip;
678-
} else if (snd_seq_client_is_ump(dest)) {
679-
result = snd_seq_deliver_to_ump(client, dest, dest_port,
680-
event, atomic, hop);
681-
goto __skip;
674+
if (!(dest->filter & SNDRV_SEQ_FILTER_NO_CONVERT)) {
675+
if (snd_seq_ev_is_ump(event)) {
676+
result = snd_seq_deliver_from_ump(client, dest, dest_port,
677+
event, atomic, hop);
678+
goto __skip;
679+
} else if (snd_seq_client_is_ump(dest)) {
680+
result = snd_seq_deliver_to_ump(client, dest, dest_port,
681+
event, atomic, hop);
682+
goto __skip;
683+
}
682684
}
683685
#endif /* CONFIG_SND_SEQ_UMP */
684686

sound/core/seq/seq_dummy.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ static int __init
152152
register_client(void)
153153
{
154154
struct snd_seq_dummy_port *rec1, *rec2;
155+
struct snd_seq_client *client;
155156
int i;
156157

157158
if (ports < 1) {
@@ -165,6 +166,13 @@ register_client(void)
165166
if (my_client < 0)
166167
return my_client;
167168

169+
/* don't convert events but just pass-through */
170+
client = snd_seq_kernel_client_get(my_client);
171+
if (!client)
172+
return -EINVAL;
173+
client->filter = SNDRV_SEQ_FILTER_NO_CONVERT;
174+
snd_seq_kernel_client_put(client);
175+
168176
/* create ports */
169177
for (i = 0; i < ports; i++) {
170178
rec1 = create_port(i, 0);

0 commit comments

Comments
 (0)