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>
This commit is contained in:
parent
e9e02819a9
commit
329ffe11a0
3 changed files with 19 additions and 8 deletions
|
@ -347,6 +347,7 @@ typedef int __bitwise snd_seq_client_type_t;
|
||||||
#define SNDRV_SEQ_FILTER_BROADCAST (1U<<0) /* accept broadcast messages */
|
#define SNDRV_SEQ_FILTER_BROADCAST (1U<<0) /* accept broadcast messages */
|
||||||
#define SNDRV_SEQ_FILTER_MULTICAST (1U<<1) /* accept multicast messages */
|
#define SNDRV_SEQ_FILTER_MULTICAST (1U<<1) /* accept multicast messages */
|
||||||
#define SNDRV_SEQ_FILTER_BOUNCE (1U<<2) /* accept bounce event in error */
|
#define SNDRV_SEQ_FILTER_BOUNCE (1U<<2) /* accept bounce event in error */
|
||||||
|
#define SNDRV_SEQ_FILTER_NO_CONVERT (1U<<30) /* don't convert UMP events */
|
||||||
#define SNDRV_SEQ_FILTER_USE_EVENT (1U<<31) /* use event filter */
|
#define SNDRV_SEQ_FILTER_USE_EVENT (1U<<31) /* use event filter */
|
||||||
|
|
||||||
struct snd_seq_client_info {
|
struct snd_seq_client_info {
|
||||||
|
|
|
@ -671,6 +671,7 @@ static int snd_seq_deliver_single_event(struct snd_seq_client *client,
|
||||||
dest_port->time_real);
|
dest_port->time_real);
|
||||||
|
|
||||||
#if IS_ENABLED(CONFIG_SND_SEQ_UMP)
|
#if IS_ENABLED(CONFIG_SND_SEQ_UMP)
|
||||||
|
if (!(dest->filter & SNDRV_SEQ_FILTER_NO_CONVERT)) {
|
||||||
if (snd_seq_ev_is_ump(event)) {
|
if (snd_seq_ev_is_ump(event)) {
|
||||||
result = snd_seq_deliver_from_ump(client, dest, dest_port,
|
result = snd_seq_deliver_from_ump(client, dest, dest_port,
|
||||||
event, atomic, hop);
|
event, atomic, hop);
|
||||||
|
@ -680,6 +681,7 @@ static int snd_seq_deliver_single_event(struct snd_seq_client *client,
|
||||||
event, atomic, hop);
|
event, atomic, hop);
|
||||||
goto __skip;
|
goto __skip;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif /* CONFIG_SND_SEQ_UMP */
|
#endif /* CONFIG_SND_SEQ_UMP */
|
||||||
|
|
||||||
result = __snd_seq_deliver_single_event(dest, dest_port, event,
|
result = __snd_seq_deliver_single_event(dest, dest_port, event,
|
||||||
|
|
|
@ -152,6 +152,7 @@ static int __init
|
||||||
register_client(void)
|
register_client(void)
|
||||||
{
|
{
|
||||||
struct snd_seq_dummy_port *rec1, *rec2;
|
struct snd_seq_dummy_port *rec1, *rec2;
|
||||||
|
struct snd_seq_client *client;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (ports < 1) {
|
if (ports < 1) {
|
||||||
|
@ -165,6 +166,13 @@ register_client(void)
|
||||||
if (my_client < 0)
|
if (my_client < 0)
|
||||||
return my_client;
|
return my_client;
|
||||||
|
|
||||||
|
/* don't convert events but just pass-through */
|
||||||
|
client = snd_seq_kernel_client_get(my_client);
|
||||||
|
if (!client)
|
||||||
|
return -EINVAL;
|
||||||
|
client->filter = SNDRV_SEQ_FILTER_NO_CONVERT;
|
||||||
|
snd_seq_kernel_client_put(client);
|
||||||
|
|
||||||
/* create ports */
|
/* create ports */
|
||||||
for (i = 0; i < ports; i++) {
|
for (i = 0; i < ports; i++) {
|
||||||
rec1 = create_port(i, 0);
|
rec1 = create_port(i, 0);
|
||||||
|
|
Loading…
Add table
Reference in a new issue