Package: release.debian.org
Severity: normal
User: release.debian....@packages.debian.org
Usertags: unblock
X-Debbugs-Cc: fluidsy...@packages.debian.org, fluidsy...@packages.debian.org
Control: affects -1 + src:fluidsynth

Please unblock package fluidsynth

[ Reason ]
This revision fixes a regression that was introduced upstream between
the 2.3.0 and 2.3.1 releases and has been fixed in the 2.3.2 release.

[ Impact ]
The regression introduced a multi-second gap between looping MIDI
tracks. Since fluidsynth is the default renderer for MIDI music in
SDL2, this will affect *a lot* of games in Debian.

[ Tests ]
n/a

[ Risks ]
None, I'd say. The fix has been backported from the upstream GIT
repository and is in the 2.3.2 version, which has already been
released. The output of `git show -w c0e2ef` on the commit in question
has three lines of code changes, the rest is indentation:

--- a/src/midi/fluid_midi.c
+++ b/src/midi/fluid_midi.c
@@ -2179,6 +2179,8 @@ fluid_player_callback(void *data, unsigned int msec)
             fluid_atomic_int_set(&player->seek_ticks, -1); /* clear seek_ticks 
*/
         }
         
+        if(fluid_list_next(player->currentfile) == NULL && player->loop == 0)
+        {
             /* Once we've run out of MIDI events, keep playing until no voices 
are active */
             if(status == FLUID_PLAYER_DONE && 
fluid_synth_get_active_voice_count(player->synth) > 0)
             {
@@ -2207,6 +2209,7 @@ fluid_player_callback(void *data, unsigned int msec)
             {
                 status = FLUID_PLAYER_PLAYING;
             }
+        }
 
         /* Once there's no reason to keep playing, we're actually done */
         if(status == FLUID_PLAYER_DONE)


[ Checklist ]
  [X] all changes are documented in the d/changelog
  [X] I reviewed all changes and I approve them
  [X] attach debdiff against the package in testing

[ Other info ]
n/a

unblock fluidsynth/2.3.1-2
diff -Nru fluidsynth-2.3.1/debian/changelog fluidsynth-2.3.1/debian/changelog
--- fluidsynth-2.3.1/debian/changelog   2022-12-30 16:10:11.000000000 +0100
+++ fluidsynth-2.3.1/debian/changelog   2023-04-18 07:48:30.000000000 +0200
@@ -1,3 +1,11 @@
+fluidsynth (2.3.1-2) unstable; urgency=medium
+
+  * Team upload.
+  * Apply patch from upstream to fix seamless looping between MIDI
+    files.
+
+ -- Fabian Greffrath <fab...@debian.org>  Tue, 18 Apr 2023 07:48:30 +0200
+
 fluidsynth (2.3.1-1) unstable; urgency=medium
 
   * New upstream version 2.3.1
diff -Nru 
fluidsynth-2.3.1/debian/patches/0046-Fix-seamless-looping-between-MIDI-files.patch
 
fluidsynth-2.3.1/debian/patches/0046-Fix-seamless-looping-between-MIDI-files.patch
--- 
fluidsynth-2.3.1/debian/patches/0046-Fix-seamless-looping-between-MIDI-files.patch
  1970-01-01 01:00:00.000000000 +0100
+++ 
fluidsynth-2.3.1/debian/patches/0046-Fix-seamless-looping-between-MIDI-files.patch
  2023-04-18 07:47:25.000000000 +0200
@@ -0,0 +1,76 @@
+From c0e2ef4243b83f29620b2078fc0f1198bafd7d90 Mon Sep 17 00:00:00 2001
+From: derselbst <tom.m...@googlemail.com>
+Date: Sun, 2 Apr 2023 17:31:24 +0200
+Subject: [PATCH 46/49] Fix seamless looping between MIDI files
+
+Fixes #1227
+---
+ src/midi/fluid_midi.c | 45 +++++++++++++++++++++++--------------------
+ 1 file changed, 24 insertions(+), 21 deletions(-)
+
+diff --git a/src/midi/fluid_midi.c b/src/midi/fluid_midi.c
+index 0676c452..b72c3914 100644
+--- a/src/midi/fluid_midi.c
++++ b/src/midi/fluid_midi.c
+@@ -2178,34 +2178,37 @@ fluid_player_callback(void *data, unsigned int msec)
+             player->start_msec = msec;      /* should be the (synth)-time of 
the last tempo change */
+             fluid_atomic_int_set(&player->seek_ticks, -1); /* clear 
seek_ticks */
+         }
+-
+-        /* Once we've run out of MIDI events, keep playing until no voices 
are active */
+-        if(status == FLUID_PLAYER_DONE && 
fluid_synth_get_active_voice_count(player->synth) > 0)
++        
++        if(fluid_list_next(player->currentfile) == NULL && player->loop == 0)
+         {
+-            /* The first time we notice we've run out of MIDI events but 
there are still active voices, disable all hold pedals */
+-            if(!player->end_pedals_disabled)
++            /* Once we've run out of MIDI events, keep playing until no 
voices are active */
++            if(status == FLUID_PLAYER_DONE && 
fluid_synth_get_active_voice_count(player->synth) > 0)
+             {
+-                for(i = 0; i < synth->midi_channels; i++)
++                /* The first time we notice we've run out of MIDI events but 
there are still active voices, disable all hold pedals */
++                if(!player->end_pedals_disabled)
+                 {
+-                    fluid_synth_cc(player->synth, i, SUSTAIN_SWITCH, 0);
+-                    fluid_synth_cc(player->synth, i, SOSTENUTO_SWITCH, 0);
++                    for(i = 0; i < synth->midi_channels; i++)
++                    {
++                        fluid_synth_cc(player->synth, i, SUSTAIN_SWITCH, 0);
++                        fluid_synth_cc(player->synth, i, SOSTENUTO_SWITCH, 0);
++                    }
++
++                    player->end_pedals_disabled = 1;
+                 }
+ 
+-                player->end_pedals_disabled = 1;
++                status = FLUID_PLAYER_PLAYING;
+             }
+ 
+-            status = FLUID_PLAYER_PLAYING;
+-        }
+-
+-        /* Once no voices are active, if end_msec hasn't been scheduled, 
schedule it so we wait for reverb, etc to finish */
+-        if(status == FLUID_PLAYER_DONE && player->end_msec < 0)
+-        {
+-            player->end_msec = msec + FLUID_PLAYER_STOP_GRACE_MS;
+-        }
+-        /* If end_msec has been scheduled and is in the future, keep playing 
*/
+-        if (player->end_msec >= 0 && msec < (unsigned int) player->end_msec)
+-        {
+-          status = FLUID_PLAYER_PLAYING;
++            /* Once no voices are active, if end_msec hasn't been scheduled, 
schedule it so we wait for reverb, etc to finish */
++            if(status == FLUID_PLAYER_DONE && player->end_msec < 0)
++            {
++                player->end_msec = msec + FLUID_PLAYER_STOP_GRACE_MS;
++            }
++            /* If end_msec has been scheduled and is in the future, keep 
playing */
++            if (player->end_msec >= 0 && msec < (unsigned int) 
player->end_msec)
++            {
++                status = FLUID_PLAYER_PLAYING;
++            }
+         }
+ 
+         /* Once there's no reason to keep playing, we're actually done */
+-- 
+2.39.2
+
diff -Nru fluidsynth-2.3.1/debian/patches/series 
fluidsynth-2.3.1/debian/patches/series
--- fluidsynth-2.3.1/debian/patches/series      1970-01-01 01:00:00.000000000 
+0100
+++ fluidsynth-2.3.1/debian/patches/series      2023-04-18 07:47:25.000000000 
+0200
@@ -0,0 +1 @@
+0046-Fix-seamless-looping-between-MIDI-files.patch

Reply via email to