]> git.alsa-project.org Git - alsa-lib.git/commitdiff
seq: Fix wrong FB direction at snd_seq_create_ump_block()
authorTakashi Iwai <tiwai@suse.de>
Tue, 9 Jul 2024 05:23:23 +0000 (07:23 +0200)
committerTakashi Iwai <tiwai@suse.de>
Tue, 9 Jul 2024 05:23:23 +0000 (07:23 +0200)
snd_seq_create_ump_block() receives a snd_ump_block_info_t data at the
creation of a FB and updates its associated sequencer port, but it
handled the port direction incorrectly.  The UMP / port direction
means the connectivity, but the current code translated other way
round.  The correct translation should be that input = receiver, i.e.
a writable port for applications, and output = source, a readable port
for applications.

This patch corrects the translation, and add more comments to the
direction definition.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
include/seq.h
src/seq/seqmid.c

index 3bad5dd9762c73d92a3a8d4da5822da91344dedb..4f03df4382889d48c273a6d8af5a0355f9b6e605 100644 (file)
@@ -250,8 +250,8 @@ typedef struct _snd_seq_port_info snd_seq_port_info_t;
 
 /** port direction */
 #define SND_SEQ_PORT_DIR_UNKNOWN       0       /**< Unknown */
-#define SND_SEQ_PORT_DIR_INPUT         1       /**< Input only */
-#define SND_SEQ_PORT_DIR_OUTPUT                2       /**< Output only */
+#define SND_SEQ_PORT_DIR_INPUT         1       /**< Input only; sink, receiver */
+#define SND_SEQ_PORT_DIR_OUTPUT                2       /**< Output only; source, transmitter */
 #define SND_SEQ_PORT_DIR_BIDIRECTION   3       /**< Input/output bidirectional */
 
 /* port type */
index d7eac6cafa0ed9bb5ff1c2f772d98c504f32b045..08c62d5c24b8ab98d5704d6b04522ef9ea252a5e 100644 (file)
@@ -645,16 +645,16 @@ static void update_group_ports(snd_seq_t *seq, snd_ump_endpoint_info_t *ep)
                            i >= bp->first_group + bp->num_groups)
                                continue;
                        switch (bp->direction) {
-                       case SNDRV_UMP_DIR_INPUT:
-                               caps |= SNDRV_SEQ_PORT_CAP_READ |
-                                       SNDRV_SEQ_PORT_CAP_SYNC_READ |
-                                       SNDRV_SEQ_PORT_CAP_SUBS_READ;
-                               break;
-                       case SNDRV_UMP_DIR_OUTPUT:
+                       case SNDRV_UMP_DIR_INPUT: /* sink, receiver */
                                caps |= SNDRV_SEQ_PORT_CAP_WRITE |
                                        SNDRV_SEQ_PORT_CAP_SYNC_WRITE |
                                        SNDRV_SEQ_PORT_CAP_SUBS_WRITE;
                                break;
+                       case SNDRV_UMP_DIR_OUTPUT: /* source, transmitter */
+                               caps |= SNDRV_SEQ_PORT_CAP_READ |
+                                       SNDRV_SEQ_PORT_CAP_SYNC_READ |
+                                       SNDRV_SEQ_PORT_CAP_SUBS_READ;
+                               break;
                        case SNDRV_UMP_DIR_BIDIRECTION:
                                caps |= SNDRV_SEQ_PORT_CAP_READ |
                                        SNDRV_SEQ_PORT_CAP_SYNC_READ |