From 16533f81de9d1628ef434850675f22aa719b4597 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 8 Jul 2024 16:15:45 +0200 Subject: [PATCH] arecordmidi2: Start queue at starting the stream The queue should be started at the very same time of the start of the stream itself in the interactive mode. Otherwise it'll get bogus long waits until the start of the clip. Move the code to start the queue in start_bar(), so that it's always tied with the start sequence. Fixes: 1205dd5f6c14 ("arecordmidi2: Add passive mode and interactive mode") Signed-off-by: Takashi Iwai --- seq/aplaymidi2/arecordmidi2.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/seq/aplaymidi2/arecordmidi2.c b/seq/aplaymidi2/arecordmidi2.c index cad5851..c4a8259 100644 --- a/seq/aplaymidi2/arecordmidi2.c +++ b/seq/aplaymidi2/arecordmidi2.c @@ -355,6 +355,13 @@ static void write_file_header(FILE *file) /* write start bar */ static void start_bar(FILE *file) { + int err; + + /* start the queue */ + err = snd_seq_start_queue(seq, queue, NULL); + check_snd("start queue", err); + snd_seq_drain_output(seq); + write_start_clip(file); write_tempo(file); write_time_sig(file); @@ -489,10 +496,6 @@ int main(int argc, char *argv[]) start = 1; } - err = snd_seq_start_queue(seq, queue, NULL); - check_snd("start queue", err); - snd_seq_drain_output(seq); - err = snd_seq_nonblock(seq, 1); check_snd("set nonblock mode", err);