Hello community,

here is the log from the commit of package fluidsynth for openSUSE:Factory 
checked in at 2019-04-23 14:33:53
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/fluidsynth (Old)
 and      /work/SRC/openSUSE:Factory/.fluidsynth.new.5536 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "fluidsynth"

Tue Apr 23 14:33:53 2019 rev:44 rq:696464 version:2.0.5

Changes:
--------
--- /work/SRC/openSUSE:Factory/fluidsynth/fluidsynth.changes    2019-02-28 
21:26:50.673864051 +0100
+++ /work/SRC/openSUSE:Factory/.fluidsynth.new.5536/fluidsynth.changes  
2019-04-23 14:33:55.837379204 +0200
@@ -1,0 +2,12 @@
+Fri Apr 19 07:59:57 UTC 2019 - Tom Mbrt <[email protected]>
+
+- Update to 2.0.5
+  * the MIDI player erroneously assumed a default tempo of 125 BPM
+    rather than 120 BPM
+  * improve integration of systemd
+  * fix a buffering bug in fluid_synth_process()
+  * fix a major memory leak when unloading SF3 files
+  * fix multiple NULL dereferences and memory leaks in jack driver
+  * fix a memory leak when creating threads
+
+-------------------------------------------------------------------

Old:
----
  fluidsynth-2.0.4.tar.gz

New:
----
  fluidsynth-2.0.5.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ fluidsynth.spec ++++++
--- /var/tmp/diff_new_pack.i6RGWe/_old  2019-04-23 14:33:56.733379888 +0200
+++ /var/tmp/diff_new_pack.i6RGWe/_new  2019-04-23 14:33:56.733379888 +0200
@@ -24,7 +24,7 @@
 %endif
 
 Name:           fluidsynth
-Version:        2.0.4
+Version:        2.0.5
 Release:        0
 Summary:        A Real-Time Software Synthesizer That Uses Soundfont(tm)
 License:        LGPL-2.1-or-later

++++++ fluidsynth-2.0.4.tar.gz -> fluidsynth-2.0.5.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fluidsynth-2.0.4/CMakeLists.txt 
new/fluidsynth-2.0.5/CMakeLists.txt
--- old/fluidsynth-2.0.4/CMakeLists.txt 2019-02-22 10:15:18.000000000 +0100
+++ new/fluidsynth-2.0.5/CMakeLists.txt 2019-04-18 19:43:39.000000000 +0200
@@ -29,7 +29,7 @@
 # FluidSynth package version
 set ( FLUIDSYNTH_VERSION_MAJOR 2 )
 set ( FLUIDSYNTH_VERSION_MINOR 0 )
-set ( FLUIDSYNTH_VERSION_MICRO 4 )
+set ( FLUIDSYNTH_VERSION_MICRO 5 )
 set ( VERSION 
"${FLUIDSYNTH_VERSION_MAJOR}.${FLUIDSYNTH_VERSION_MINOR}.${FLUIDSYNTH_VERSION_MICRO}"
 )
 set ( FLUIDSYNTH_VERSION "\"${VERSION}\"" )
 
@@ -44,7 +44,7 @@
 # This is not exactly the same algorithm as the libtool one, but the results 
are the same.
 set ( LIB_VERSION_CURRENT 2 )
 set ( LIB_VERSION_AGE 1 )
-set ( LIB_VERSION_REVISION 1 )
+set ( LIB_VERSION_REVISION 2 )
 set ( LIB_VERSION_INFO
       "${LIB_VERSION_CURRENT}.${LIB_VERSION_AGE}.${LIB_VERSION_REVISION}" )
 
@@ -80,6 +80,10 @@
     option ( enable-alsa "compile ALSA support (if it is available)" on )
 endif ( CMAKE_SYSTEM MATCHES "Linux|FreeBSD|DragonFly" )
 
+if ( CMAKE_SYSTEM MATCHES "Linux" )
+    option ( enable-systemd "compile systemd support (if it is available)" on )
+endif ( CMAKE_SYSTEM MATCHES "Linux" )
+
 if ( CMAKE_SYSTEM MATCHES "Darwin" )
     option ( enable-coreaudio "compile CoreAudio support (if it is available)" 
on )
     option ( enable-coremidi "compile CoreMIDI support (if it is available)" 
on )
@@ -521,6 +525,14 @@
     remove_definitions( -DHAVE_LASH )
     endif ( enable-lash )
 
+    unset ( SYSTEMD_SUPPORT CACHE )
+    if ( enable-systemd )
+        pkg_check_modules ( SYSTEMD libsystemd )
+        set ( SYSTEMD_SUPPORT ${SYSTEMD_FOUND} )
+    else ( enable-systemd )
+        unset_pkg_config ( SYSTEMD )
+    endif ( enable-systemd )
+
     unset ( DBUS_SUPPORT CACHE )
     if ( enable-dbus )
     pkg_check_modules ( DBUS dbus-1>=1.0.0 )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fluidsynth-2.0.4/cmake_admin/report.cmake 
new/fluidsynth-2.0.5/cmake_admin/report.cmake
--- old/fluidsynth-2.0.4/cmake_admin/report.cmake       2019-02-22 
10:15:18.000000000 +0100
+++ new/fluidsynth-2.0.5/cmake_admin/report.cmake       2019-04-18 
19:43:39.000000000 +0200
@@ -98,6 +98,12 @@
   message ( "LASH support:          no" )
 endif ( LASH_SUPPORT )
 
+if ( SYSTEMD_SUPPORT )
+  message ( "systemd support:       yes" )
+else ( SYSTEMD_SUPPORT )
+  message ( "systemd support:       no" )
+endif ( SYSTEMD_SUPPORT )
+
 if ( DART_SUPPORT )
   message ( "OS/2 DART support:     yes" )
 else ( DART_SUPPORT )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fluidsynth-2.0.4/doc/Doxyfile 
new/fluidsynth-2.0.5/doc/Doxyfile
--- old/fluidsynth-2.0.4/doc/Doxyfile   2019-02-22 10:15:18.000000000 +0100
+++ new/fluidsynth-2.0.5/doc/Doxyfile   2019-04-18 19:43:39.000000000 +0200
@@ -5,7 +5,7 @@
 #---------------------------------------------------------------------------
 DOXYFILE_ENCODING = UTF-8
 PROJECT_NAME = libfluidsynth
-PROJECT_NUMBER = 2.0.4
+PROJECT_NUMBER = 2.0.5
 OUTPUT_DIRECTORY = api
 CREATE_SUBDIRS = NO
 OUTPUT_LANGUAGE = English
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fluidsynth-2.0.4/doc/fluidsynth-v20-devdoc.txt 
new/fluidsynth-2.0.5/doc/fluidsynth-v20-devdoc.txt
--- old/fluidsynth-2.0.4/doc/fluidsynth-v20-devdoc.txt  2019-02-22 
10:15:18.000000000 +0100
+++ new/fluidsynth-2.0.5/doc/fluidsynth-v20-devdoc.txt  2019-04-18 
19:43:39.000000000 +0200
@@ -8,8 +8,8 @@
 \author David Henningsson
 \author Tom Moebert
 \author Copyright &copy; 2003-2019 Peter Hanappe, Conrad Berhörster, Antoine 
Schmitt, Pedro López-Cabanillas, Josh Green, David Henningsson, Tom Moebert
-\version Revision 2.0.4
-\date 2019-02-09
+\version Revision 2.0.5
+\date 2019-04-17
 
 All the source code examples in this document are in the public domain; you 
can use them as you please. This document is licensed under the Creative 
Commons Attribution-Share Alike 3.0 Unported License. To view a copy of this 
license, visit http://creativecommons.org/licenses/by-sa/3.0/ . The FluidSynth 
library is distributed under the GNU Lesser General Public License. A copy of 
the GNU Lesser General Public License is contained in the FluidSynth package; 
if not, visit http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt or write to 
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 
02110-1301 USA.
 
@@ -21,6 +21,7 @@
 
 - \ref Disclaimer
 - \ref Introduction
+- \ref NewIn2_0_5
 - \ref NewIn2_0_3
 - \ref NewIn2_0_2
 - \ref NewIn2_0_0
@@ -42,7 +43,7 @@
 
 \section Disclaimer
 
-This documentation, in its current version, is incomplete. As always, the 
source code is the final reference.
+This documentation may be partly incomplete. As always, the source code is the 
final reference.
 
 SoundFont(R) is a registered trademark of E-mu Systems, Inc.
 
@@ -62,6 +63,11 @@
 
 - FluidSynth is open source, in active development. For more details, take a 
look at http://www.fluidsynth.org
 
+\section NewIn2_0_5 Whats new in 2.0.5?
+
+- fluid_synth_process() omitted audio samples when called with arbitrary 
sample counts that were not a multiple of fluid_synth_get_internal_bufsize()
+- fluid_synth_sfunload() was not releasing sample buffers of SoundFont3 files 
if <a 
href="fluidsettings.xml#synth.dynamic-sample-loading">"synth.dynamic-sample-loading"</a>
 was set to FALSE
+
 \section NewIn2_0_3 Whats new in 2.0.3?
 
 - fix incorrect behaviour of fluid_sample_set_sound_data()
@@ -141,7 +147,7 @@
 - remove deprecated fluid_synth_select_tuning(), use 
fluid_synth_activate_tuning(synth, chan, bank, prog, FALSE) instead
 - remove deprecated fluid_synth_reset_tuning(), use 
fluid_synth_deactivate_tuning(synth, chan, FALSE) instead
 - remove deprecated FLUID_HINT_INTEGER
-- remove deprecated fluid_synth_set_gen2() as there doesnt seem to be a use 
case for absolute generator values
+- remove deprecated fluid_synth_set_gen2() as there doesn't seem to be a use 
case for absolute generator values
 - remove deprecated "synth.parallel-render" setting
 - remove obsolete "audio.[out|in]put-channels" settings
 - remove unimplemented "synth.dump" setting
@@ -162,7 +168,7 @@
 
 Before you can use the synthesizer, you have to create a settings object. The 
settings objects is used by many components of the FluidSynth library. It gives 
a unified API to set the parameters of the audio drivers, the midi drivers, the 
synthesizer, and so forth. A number of default settings are defined by the 
current implementation.
 
-All settings have a name that follows the "dotted-name" notation. For example, 
"synth.polyphony" refers to the number of voices (polyphony) preallocated by 
the synthesizer. The settings also have a type. There are currently three 
types: strings, numbers (double floats), and integers. You can change the 
values of a setting using the fluid_settings_setstr(), fluid_settings_setnum(), 
and fluid_settings_setint() functions. For example: 
+All settings have a name that follows the "dotted-name" notation. For example, 
"synth.polyphony" refers to the number of voices (polyphony) allocated by the 
synthesizer. The settings also have a type. There are currently three types: 
strings, numbers (double floats), and integers. You can change the values of a 
setting using the fluid_settings_setstr(), fluid_settings_setnum(), and 
fluid_settings_setint() functions. For example: 
 
 \code
 #include <fluidsynth.h>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fluidsynth-2.0.4/fluidsynth.service.in 
new/fluidsynth-2.0.5/fluidsynth.service.in
--- old/fluidsynth-2.0.4/fluidsynth.service.in  2019-02-22 10:15:18.000000000 
+0100
+++ new/fluidsynth-2.0.5/fluidsynth.service.in  2019-04-18 19:43:39.000000000 
+0200
@@ -4,6 +4,8 @@
 After=sound.target
 
 [Service]
+Type=notify
+NotifyAccess=main
 EnvironmentFile=@FLUID_DAEMON_ENV_FILE@
 EnvironmentFile=-%h/.config/fluidsynth
 ExecStart=@CMAKE_INSTALL_PREFIX@/@BIN_INSTALL_DIR@/fluidsynth -is $OTHER_OPTS 
$SOUND_FONT
Binary files old/fluidsynth-2.0.4/sf2/VintageDreamsWaves-v2.sf3 and 
new/fluidsynth-2.0.5/sf2/VintageDreamsWaves-v2.sf3 differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fluidsynth-2.0.4/src/CMakeLists.txt 
new/fluidsynth-2.0.5/src/CMakeLists.txt
--- old/fluidsynth-2.0.4/src/CMakeLists.txt     2019-02-22 10:15:18.000000000 
+0100
+++ new/fluidsynth-2.0.5/src/CMakeLists.txt     2019-04-18 19:43:39.000000000 
+0200
@@ -95,6 +95,10 @@
   include_directories ( ${LASH_INCLUDE_DIRS})
 endif ( LASH_SUPPORT )
 
+if ( SYSTEMD_SUPPORT )
+  include_directories ( ${SYSTEMD_INCLUDE_DIRS})
+endif ( SYSTEMD_SUPPORT )
+
 if ( DART_SUPPORT )
   set ( fluid_dart_SOURCES drivers/fluid_dart.c )
   include_directories ( ${DART_INCLUDE_DIRS} )
@@ -341,6 +345,7 @@
 
 target_link_libraries ( fluidsynth
     libfluidsynth
+    ${SYSTEMD_LIBRARIES}
     ${FLUID_LIBS}
 )
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fluidsynth-2.0.4/src/bindings/fluid_cmd.c 
new/fluidsynth-2.0.5/src/bindings/fluid_cmd.c
--- old/fluidsynth-2.0.4/src/bindings/fluid_cmd.c       2019-02-22 
10:15:18.000000000 +0100
+++ new/fluidsynth-2.0.5/src/bindings/fluid_cmd.c       2019-04-18 
19:43:39.000000000 +0200
@@ -102,7 +102,7 @@
     },
     {
         "pitch_bend_range", "event", fluid_handle_pitch_bend_range,
-        "pitch_bend chan range      Sets bend pitch range"
+        "pitch_bend_range chn range Sets pitch bend range for the given midi 
channel"
     },
     {
         "cc", "event", fluid_handle_cc,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fluidsynth-2.0.4/src/config.cmake 
new/fluidsynth-2.0.5/src/config.cmake
--- old/fluidsynth-2.0.4/src/config.cmake       2019-02-22 10:15:18.000000000 
+0100
+++ new/fluidsynth-2.0.5/src/config.cmake       2019-04-18 19:43:39.000000000 
+0200
@@ -49,6 +49,9 @@
 /* whether or not we are supporting lash */
 #cmakedefine HAVE_LASH @HAVE_LASH@
 
+/* Define if systemd support is enabled */
+#cmakedefine SYSTEMD_SUPPORT @SYSTEMD_SUPPORT@
+
 /* Define to 1 if you have the `MidiShare' library (-lMidiShare). */
 #cmakedefine HAVE_LIBMIDISHARE @HAVE_LIBMIDISHARE@
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fluidsynth-2.0.4/src/drivers/fluid_alsa.c 
new/fluidsynth-2.0.5/src/drivers/fluid_alsa.c
--- old/fluidsynth-2.0.4/src/drivers/fluid_alsa.c       2019-02-22 
10:15:18.000000000 +0100
+++ new/fluidsynth-2.0.5/src/drivers/fluid_alsa.c       2019-04-18 
19:43:39.000000000 +0200
@@ -355,6 +355,7 @@
     if(dev->thread)
     {
         fluid_thread_join(dev->thread);
+        delete_fluid_thread(dev->thread);
     }
 
     if(dev->pcm)
@@ -757,6 +758,7 @@
     if(dev->thread)
     {
         fluid_thread_join(dev->thread);
+        delete_fluid_thread(dev->thread);
     }
 
     if(dev->rawmidi_in)
@@ -1210,6 +1212,7 @@
     if(dev->thread)
     {
         fluid_thread_join(dev->thread);
+        delete_fluid_thread(dev->thread);
     }
 
     if(dev->seq_handle)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fluidsynth-2.0.4/src/drivers/fluid_jack.c 
new/fluidsynth-2.0.5/src/drivers/fluid_jack.c
--- old/fluidsynth-2.0.4/src/drivers/fluid_jack.c       2019-02-22 
10:15:18.000000000 +0100
+++ new/fluidsynth-2.0.5/src/drivers/fluid_jack.c       2019-04-18 
19:43:39.000000000 +0200
@@ -115,11 +115,13 @@
  * Connect all midi input ports to all terminal midi output ports
  */
 void
-fluid_jack_midi_autoconnect(jack_client_t *client, fluid_jack_midi_driver_t 
*midi_driver) {
+fluid_jack_midi_autoconnect(jack_client_t *client, fluid_jack_midi_driver_t 
*midi_driver)
+{
     int i, j;
-    const char ** midi_source_ports;
+    const char **midi_source_ports;
 
     midi_source_ports = jack_get_ports(client, NULL, JACK_DEFAULT_MIDI_TYPE, 
JackPortIsOutput | JackPortIsTerminal);
+
     if(midi_source_ports != NULL)
     {
         for(j = 0; midi_source_ports[j] != NULL; j++)
@@ -130,6 +132,7 @@
                 jack_connect(client, midi_source_ports[j], 
jack_port_name(midi_driver->midi_port[i]));
             }
         }
+
         jack_free(midi_source_ports);
     }
 
@@ -199,7 +202,7 @@
 
     if(!client_ref)
     {
-        FLUID_LOG(FLUID_ERR, "Out of memory");
+        FLUID_LOG(FLUID_PANIC, "Out of memory");
         goto error_recovery;
     }
 
@@ -338,7 +341,7 @@
 
         if((dev->midi_port = FLUID_ARRAY(jack_port_t *, ports)) == NULL)
         {
-            FLUID_LOG(FLUID_ERR, "Out of memory");
+            FLUID_LOG(FLUID_PANIC, "Out of memory");
             return FLUID_FAILED;
         }
 
@@ -375,7 +378,7 @@
 
         if(dev->output_ports == NULL)
         {
-            FLUID_LOG(FLUID_PANIC, "Jack server not running?");
+            FLUID_LOG(FLUID_PANIC, "Out of memory");
             return FLUID_FAILED;
         }
 
@@ -388,6 +391,11 @@
         dev->output_ports[1]
             = jack_port_register(client, "right", JACK_DEFAULT_AUDIO_TYPE, 
JackPortIsOutput, 0);
 
+        if(dev->output_ports[0] == NULL || dev->output_ports[1] == NULL)
+        {
+            FLUID_LOG(FLUID_ERR, "Failed to create Jack audio port");
+            goto error_recovery;
+        }
     }
     else
     {
@@ -406,7 +414,7 @@
         if(dev->output_bufs == NULL)
         {
             FLUID_LOG(FLUID_PANIC, "Out of memory");
-            return FLUID_FAILED;
+            goto error_recovery;
         }
 
         FLUID_MEMSET(dev->output_ports, 0, 2 * dev->num_output_ports * 
sizeof(jack_port_t *));
@@ -414,12 +422,22 @@
         for(i = 0; i < dev->num_output_ports; i++)
         {
             sprintf(name, "l_%02d", i);
-            dev->output_ports[2 * i]
-                = jack_port_register(client, name, JACK_DEFAULT_AUDIO_TYPE, 
JackPortIsOutput, 0);
+
+            if((dev->output_ports[2 * i]
+                    = jack_port_register(client, name, 
JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0)) == NULL)
+            {
+                FLUID_LOG(FLUID_ERR, "Failed to create Jack audio port '%s'", 
name);
+                goto error_recovery;
+            }
 
             sprintf(name, "r_%02d", i);
-            dev->output_ports[2 * i + 1]
-                = jack_port_register(client, name, JACK_DEFAULT_AUDIO_TYPE, 
JackPortIsOutput, 0);
+
+            if((dev->output_ports[2 * i + 1]
+                    = jack_port_register(client, name, 
JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0)) == NULL)
+            {
+                FLUID_LOG(FLUID_ERR, "Failed to create Jack audio port '%s'", 
name);
+                goto error_recovery;
+            }
         }
 
         fluid_settings_getint(settings, "synth.effects-channels", 
&dev->num_fx_ports);
@@ -431,7 +449,7 @@
         if(dev->fx_ports == NULL)
         {
             FLUID_LOG(FLUID_PANIC, "Out of memory");
-            return FLUID_FAILED;
+            goto error_recovery;
         }
 
         dev->fx_bufs = FLUID_ARRAY(float *, 2 * dev->num_fx_ports);
@@ -439,7 +457,7 @@
         if(dev->fx_bufs == NULL)
         {
             FLUID_LOG(FLUID_PANIC, "Out of memory");
-            return FLUID_FAILED;
+            goto error_recovery;
         }
 
         FLUID_MEMSET(dev->fx_ports, 0, 2 * dev->num_fx_ports * 
sizeof(jack_port_t *));
@@ -447,12 +465,22 @@
         for(i = 0; i < dev->num_fx_ports; i++)
         {
             sprintf(name, "fx_l_%02d", i);
-            dev->fx_ports[2 * i]
-                = jack_port_register(client, name, JACK_DEFAULT_AUDIO_TYPE, 
JackPortIsOutput, 0);
+
+            if((dev->fx_ports[2 * i]
+                    = jack_port_register(client, name, 
JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0)) == NULL)
+            {
+                FLUID_LOG(FLUID_ERR, "Failed to create Jack fx audio port 
'%s'", name);
+                goto error_recovery;
+            }
 
             sprintf(name, "fx_r_%02d", i);
-            dev->fx_ports[2 * i + 1]
-                = jack_port_register(client, name, JACK_DEFAULT_AUDIO_TYPE, 
JackPortIsOutput, 0);
+
+            if((dev->fx_ports[2 * i + 1]
+                    = jack_port_register(client, name, 
JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0)) == NULL)
+            {
+                FLUID_LOG(FLUID_ERR, "Failed to create Jack fx audio port 
'%s'", name);
+                goto error_recovery;
+            }
         }
     }
 
@@ -477,6 +505,18 @@
     }
 
     return FLUID_OK;
+
+error_recovery:
+
+    FLUID_FREE(dev->output_ports);
+    dev->output_ports = NULL;
+    FLUID_FREE(dev->fx_ports);
+    dev->fx_ports = NULL;
+    FLUID_FREE(dev->output_bufs);
+    dev->output_bufs = NULL;
+    FLUID_FREE(dev->fx_bufs);
+    dev->fx_bufs = NULL;
+    return FLUID_FAILED;
 }
 
 static void
@@ -539,7 +579,7 @@
 
     if(dev == NULL)
     {
-        FLUID_LOG(FLUID_ERR, "Out of memory");
+        FLUID_LOG(FLUID_PANIC, "Out of memory");
         return NULL;
     }
 
@@ -688,6 +728,7 @@
     }
 
     audio_driver = fluid_atomic_pointer_get(&client->audio_driver);
+
     if(audio_driver == NULL)
     {
         // shutting down
@@ -765,6 +806,7 @@
 fluid_jack_port_registration(jack_port_id_t port, int is_registering, void 
*arg)
 {
     fluid_jack_client_t *client_ref = (fluid_jack_client_t *)arg;
+
     if(client_ref->midi_driver != NULL)
     {
         client_ref->midi_driver->autoconnect_is_outdated = 
client_ref->midi_driver->autoconnect_inputs && is_registering != 0;
@@ -793,7 +835,7 @@
 
     if(dev == NULL)
     {
-        FLUID_LOG(FLUID_ERR, "Out of memory");
+        FLUID_LOG(FLUID_PANIC, "Out of memory");
         return NULL;
     }
 
@@ -807,9 +849,8 @@
 
     if(dev->parser == NULL)
     {
-        FLUID_LOG(FLUID_ERR, "Out of memory");
-        FLUID_FREE(dev);
-        return NULL;
+        FLUID_LOG(FLUID_PANIC, "Out of memory");
+        goto error_recovery;
     }
 
     fluid_settings_getint(settings, "midi.autoconnect", 
&dev->autoconnect_inputs);
@@ -819,11 +860,15 @@
 
     if(!dev->client_ref)
     {
-        FLUID_FREE(dev);
-        return NULL;
+        FLUID_LOG(FLUID_PANIC, "Out of memory");
+        goto error_recovery;
     }
 
     return (fluid_midi_driver_t *)dev;
+    
+error_recovery:
+    delete_fluid_jack_midi_driver((fluid_midi_driver_t *)dev);
+    return NULL;
 }
 
 void
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fluidsynth-2.0.4/src/drivers/fluid_oss.c 
new/fluidsynth-2.0.5/src/drivers/fluid_oss.c
--- old/fluidsynth-2.0.4/src/drivers/fluid_oss.c        2019-02-22 
10:15:18.000000000 +0100
+++ new/fluidsynth-2.0.5/src/drivers/fluid_oss.c        2019-04-18 
19:43:39.000000000 +0200
@@ -448,6 +448,7 @@
     if(dev->thread)
     {
         fluid_thread_join(dev->thread);
+        delete_fluid_thread(dev->thread);
     }
 
     if(dev->dspfd >= 0)
@@ -705,6 +706,7 @@
     if(dev->thread)
     {
         fluid_thread_join(dev->thread);
+        delete_fluid_thread(dev->thread);
     }
 
     if(dev->fd >= 0)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fluidsynth-2.0.4/src/drivers/fluid_pulse.c 
new/fluidsynth-2.0.5/src/drivers/fluid_pulse.c
--- old/fluidsynth-2.0.4/src/drivers/fluid_pulse.c      2019-02-22 
10:15:18.000000000 +0100
+++ new/fluidsynth-2.0.5/src/drivers/fluid_pulse.c      2019-04-18 
19:43:39.000000000 +0200
@@ -221,6 +221,7 @@
     if(dev->thread)
     {
         fluid_thread_join(dev->thread);
+        delete_fluid_thread(dev->thread);
     }
 
     if(dev->pa_handle)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fluidsynth-2.0.4/src/fluidsynth.c 
new/fluidsynth-2.0.5/src/fluidsynth.c
--- old/fluidsynth-2.0.4/src/fluidsynth.c       2019-02-22 10:15:18.000000000 
+0100
+++ new/fluidsynth-2.0.5/src/fluidsynth.c       2019-04-18 19:43:39.000000000 
+0200
@@ -31,6 +31,9 @@
 
 #include "fluid_lash.h"
 
+#ifdef SYSTEMD_SUPPORT
+#include <systemd/sd-daemon.h>
+#endif
 
 void print_usage(void);
 void print_help(fluid_settings_t *settings);
@@ -892,6 +895,12 @@
             fprintf(stderr, "Failed to create the server.\n"
                     "Continuing without it.\n");
         }
+#ifdef SYSTEMD_SUPPORT
+        else
+        {
+            sd_notify(0, "READY=1");
+        }
+#endif
     }
 
 #endif
@@ -954,10 +963,13 @@
             fluid_server_join(server);
         }
 
+#ifdef SYSTEMD_SUPPORT
+        sd_notify(0, "STOPPING=1");
+#endif
         delete_fluid_server(server);
     }
 
-#endif
+#endif /* NETWORK_SUPPORT */
 
     if(cmd_handler != NULL)
     {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fluidsynth-2.0.4/src/midi/fluid_midi.c 
new/fluidsynth-2.0.5/src/midi/fluid_midi.c
--- old/fluidsynth-2.0.4/src/midi/fluid_midi.c  2019-02-22 10:15:18.000000000 
+0100
+++ new/fluidsynth-2.0.5/src/midi/fluid_midi.c  2019-04-18 19:43:39.000000000 
+0200
@@ -99,13 +99,7 @@
 
     do
     {
-        if(!fluid_file_test(filename, G_FILE_TEST_IS_REGULAR))
-        {
-            return retcode;
-        }
-        
-        // file seems to exist and is a regular file or a symlink to such
-        if((fp = FLUID_FOPEN(filename, "rb")) == NULL)
+        if((fp = fluid_file_open(filename, NULL)) == NULL)
         {
             return retcode;
         }
@@ -1676,7 +1670,7 @@
     player->currentfile = NULL;
     player->division = 0;
     player->send_program_change = 1;
-    player->miditempo = 480000;
+    player->miditempo = 500000;
     player->deltatime = 4.0;
     player->cur_msec = 0;
     player->cur_ticks = 0;
@@ -1760,7 +1754,7 @@
     player->ntracks = 0;
     player->division = 0;
     player->send_program_change = 1;
-    player->miditempo = 480000;
+    player->miditempo = 500000;
     player->deltatime = 4.0;
     return 0;
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fluidsynth-2.0.4/src/sfloader/fluid_defsfont.c 
new/fluidsynth-2.0.5/src/sfloader/fluid_defsfont.c
--- old/fluidsynth-2.0.4/src/sfloader/fluid_defsfont.c  2019-02-22 
10:15:18.000000000 +0100
+++ new/fluidsynth-2.0.5/src/sfloader/fluid_defsfont.c  2019-04-18 
19:43:39.000000000 +0200
@@ -246,7 +246,18 @@
 
     for(list = defsfont->sample; list; list = fluid_list_next(list))
     {
-        delete_fluid_sample((fluid_sample_t *) fluid_list_get(list));
+        sample = (fluid_sample_t *) fluid_list_get(list);
+
+        /* If the sample data pointer is different to the sampledata chunk of
+         * the soundfont, then the sample has been loaded individually (SF3)
+         * and needs to be unloaded explicitly. This is safe even if using
+         * dynamic sample loading, as the sample_unload mechanism sets
+         * sample->data to NULL after unload. */
+        if ((sample->data != NULL) && (sample->data != defsfont->sampledata))
+        {
+            fluid_samplecache_unload(sample->data);
+        }
+        delete_fluid_sample(sample);
     }
 
     if(defsfont->sample)
@@ -425,7 +436,7 @@
 
     if(sfdata == NULL)
     {
-        FLUID_LOG(FLUID_ERR, "Couldn't load soundfont file");
+        /* error message already printed */
         return FLUID_FAILED;
     }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fluidsynth-2.0.4/src/sfloader/fluid_sffile.c 
new/fluidsynth-2.0.5/src/sfloader/fluid_sffile.c
--- old/fluidsynth-2.0.4/src/sfloader/fluid_sffile.c    2019-02-22 
10:15:18.000000000 +0100
+++ new/fluidsynth-2.0.5/src/sfloader/fluid_sffile.c    2019-04-18 
19:43:39.000000000 +0200
@@ -340,13 +340,7 @@
 
     do
     {
-        if(!fluid_file_test(filename, G_FILE_TEST_IS_REGULAR))
-        {
-            return retcode;
-        }
-        
-        // file seems to exist and is a regular file or a symlink to such
-        if((fp = FLUID_FOPEN(filename, "rb")) == NULL)
+        if((fp = fluid_file_open(filename, NULL)) == NULL)
         {
             return retcode;
         }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fluidsynth-2.0.4/src/sfloader/fluid_sfont.c 
new/fluidsynth-2.0.5/src/sfloader/fluid_sfont.c
--- old/fluidsynth-2.0.4/src/sfloader/fluid_sfont.c     2019-02-22 
10:15:18.000000000 +0100
+++ new/fluidsynth-2.0.5/src/sfloader/fluid_sfont.c     2019-04-18 
19:43:39.000000000 +0200
@@ -24,26 +24,14 @@
 
 void *default_fopen(const char *path)
 {
-    FILE* handle;
+    const char* msg;
+    FILE* handle = fluid_file_open(path, &msg);
     
-    if(!fluid_file_test(path, G_FILE_TEST_EXISTS))
+    if(handle == NULL)
     {
-        FLUID_LOG(FLUID_ERR, "fluid_sfloader_load(): Unable to load 
non-existent file. ('%s')", path);
-        return NULL;
+        FLUID_LOG(FLUID_ERR, "fluid_sfloader_load(): Failed to open '%s': %s", 
path, msg);
     }
-    
-    if(!fluid_file_test(path, G_FILE_TEST_IS_REGULAR))
-    {
-        FLUID_LOG(FLUID_ERR, "fluid_sfloader_load(): Refusing to load 
non-regular file! ('%s')", path);
-        return NULL;
-    }
-    
-    if((handle = FLUID_FOPEN(path, "rb")) == NULL)
-    {
-        FLUID_LOG(FLUID_ERR, "fluid_sfloader_load(): Specified file does not 
exists or insufficient permissions to open it! ('%s')", path);
-        return NULL;
-    }
-    
+
     return handle;
 }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fluidsynth-2.0.4/src/synth/fluid_synth.c 
new/fluidsynth-2.0.5/src/synth/fluid_synth.c
--- old/fluidsynth-2.0.4/src/synth/fluid_synth.c        2019-02-22 
10:15:18.000000000 +0100
+++ new/fluidsynth-2.0.5/src/synth/fluid_synth.c        2019-04-18 
19:43:39.000000000 +0200
@@ -1237,7 +1237,7 @@
     {
         /* channel is poly and legato CC is Off) */
         /* removes the note from the monophonic list */
-        if(key == fluid_channel_last_note(channel))
+        if(channel->n_notes && key == fluid_channel_last_note(channel))
         {
             fluid_channel_clear_monolist(channel);
         }
@@ -3633,12 +3633,19 @@
 fluid_synth_process(fluid_synth_t *synth, int len, int nfx, float *fx[],
                     int nout, float *out[])
 {
+    return fluid_synth_process_LOCAL(synth, len, nfx, fx, nout, out, 
fluid_synth_render_blocks);
+}
+
+int
+fluid_synth_process_LOCAL(fluid_synth_t *synth, int len, int nfx, float *fx[],
+                    int nout, float *out[], int 
(*block_render_func)(fluid_synth_t *, int))
+{
     fluid_real_t *left_in, *fx_left_in;
     fluid_real_t *right_in, *fx_right_in;
     int nfxchan, nfxunits, naudchan;
 
     double time = fluid_utime();
-    int i, f, num, count;
+    int i, f, num, count, buffered_blocks;
 
     float cpu_load;
 
@@ -3662,9 +3669,10 @@
     count = 0;
     num = synth->cur;
 
-    if(synth->cur < FLUID_BUFSIZE)
+    buffered_blocks = (synth->cur + FLUID_BUFSIZE - 1) / FLUID_BUFSIZE;
+    if(synth->cur < buffered_blocks * FLUID_BUFSIZE)
     {
-        int available = FLUID_BUFSIZE - synth->cur;
+        int available = (buffered_blocks * FLUID_BUFSIZE) - synth->cur;
         num = (available > len) ? len : available;
 
         if(nout != 0)
@@ -3706,7 +3714,7 @@
     while(count < len)
     {
         int blocksleft = (len - count + FLUID_BUFSIZE - 1) / FLUID_BUFSIZE;
-        int blockcount = fluid_synth_render_blocks(synth, blocksleft);
+        int blockcount = block_render_func(synth, blocksleft);
 
         num = (blockcount * FLUID_BUFSIZE > len - count) ? len - count : 
blockcount * FLUID_BUFSIZE;
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fluidsynth-2.0.4/src/synth/fluid_synth.h 
new/fluidsynth-2.0.5/src/synth/fluid_synth.h
--- old/fluidsynth-2.0.4/src/synth/fluid_synth.h        2019-02-22 
10:15:18.000000000 +0100
+++ new/fluidsynth-2.0.5/src/synth/fluid_synth.h        2019-04-18 
19:43:39.000000000 +0200
@@ -212,6 +212,9 @@
 int fluid_synth_set_gen2(fluid_synth_t *synth, int chan,
                          int param, float value,
                          int absolute, int normalized);
+int
+fluid_synth_process_LOCAL(fluid_synth_t *synth, int len, int nfx, float *fx[],
+                    int nout, float *out[], int 
(*block_render_func)(fluid_synth_t *, int));
 /*
  * misc
  */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fluidsynth-2.0.4/src/utils/fluid_sys.c 
new/fluidsynth-2.0.5/src/utils/fluid_sys.c
--- old/fluidsynth-2.0.4/src/utils/fluid_sys.c  2019-02-22 10:15:18.000000000 
+0100
+++ new/fluidsynth-2.0.5/src/utils/fluid_sys.c  2019-04-18 19:43:39.000000000 
+0200
@@ -945,7 +945,7 @@
 new_fluid_thread(const char *name, fluid_thread_func_t func, void *data, int 
prio_level, int detach)
 {
     GThread *thread;
-    fluid_thread_info_t *info;
+    fluid_thread_info_t *info = NULL;
     GError *err = NULL;
 
     g_return_val_if_fail(func != NULL, NULL);
@@ -982,25 +982,21 @@
 #endif
     }
 
-#if NEW_GLIB_THREAD_API
     else
     {
+#if NEW_GLIB_THREAD_API
         thread = g_thread_try_new(name, (GThreadFunc)func, data, &err);
-    }
-
 #else
-    else
-    {
         thread = g_thread_create((GThreadFunc)func, data, detach == FALSE, 
&err);
-    }
-
 #endif
+    }
 
     if(!thread)
     {
         FLUID_LOG(FLUID_ERR, "Failed to create the thread: %s",
                   fluid_gerror_message(err));
         g_clear_error(&err);
+        FLUID_FREE(info);
         return NULL;
     }
 
@@ -1614,3 +1610,36 @@
 }
 
 #endif // NETWORK_SUPPORT
+
+FILE* fluid_file_open(const char* path, const char** errMsg)
+{
+    static const char ErrExist[] = "File does not exist.";
+    static const char ErrRegular[] = "File is not regular, refusing to open 
it.";
+    static const char ErrNull[] = "File does not exists or insufficient 
permissions to open it.";
+    
+    FILE* handle = NULL;
+    
+    if(!g_file_test(path, G_FILE_TEST_EXISTS))
+    {
+        if(errMsg != NULL)
+        {
+            *errMsg = ErrExist;
+        }
+    }
+    else if(!g_file_test(path, G_FILE_TEST_IS_REGULAR))
+    {
+        if(errMsg != NULL)
+        {
+            *errMsg = ErrRegular;
+        }
+    }
+    else if((handle = FLUID_FOPEN(path, "rb")) == NULL)
+    {
+        if(errMsg != NULL)
+        {
+            *errMsg = ErrNull;
+        }
+    }
+    
+    return handle;
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fluidsynth-2.0.4/src/utils/fluid_sys.h 
new/fluidsynth-2.0.5/src/utils/fluid_sys.h
--- old/fluidsynth-2.0.4/src/utils/fluid_sys.h  2019-02-22 10:15:18.000000000 
+0100
+++ new/fluidsynth-2.0.5/src/utils/fluid_sys.h  2019-04-18 19:43:39.000000000 
+0200
@@ -19,7 +19,7 @@
  */
 
 
-/**
+/*
  * @file fluid_sys.h
  *
  * This header contains a bunch of (mostly) system and machine
@@ -485,7 +485,7 @@
 typedef GStatBuf fluid_stat_buf_t;
 #endif
 
-#define fluid_file_test g_file_test
+FILE* fluid_file_open(const char* filename, const char** errMsg);
 
 /* Profiling */
 #if WITH_PROFILING
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fluidsynth-2.0.4/src/utils/fluidsynth_priv.h 
new/fluidsynth-2.0.5/src/utils/fluidsynth_priv.h
--- old/fluidsynth-2.0.4/src/utils/fluidsynth_priv.h    2019-02-22 
10:15:18.000000000 +0100
+++ new/fluidsynth-2.0.5/src/utils/fluidsynth_priv.h    2019-04-18 
19:43:39.000000000 +0200
@@ -18,7 +18,7 @@
  * 02110-1301, USA
  */
 
-/**
+/*
  * @file fluidsynth_priv.h
  * 
  * lightweight part of fluid_sys.h, containing forward declarations of 
fluidsynth's private types and private macros
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fluidsynth-2.0.4/test/CMakeLists.txt 
new/fluidsynth-2.0.5/test/CMakeLists.txt
--- old/fluidsynth-2.0.4/test/CMakeLists.txt    2019-02-22 10:15:18.000000000 
+0100
+++ new/fluidsynth-2.0.5/test/CMakeLists.txt    2019-04-18 19:43:39.000000000 
+0200
@@ -10,12 +10,13 @@
 ADD_FLUID_TEST(test_sample_cache)
 ADD_FLUID_TEST(test_sfont_loading)
 ADD_FLUID_TEST(test_sample_rate_change)
-ADD_FLUID_TEST(test_preset_sample_loading)
+# ADD_FLUID_TEST(test_preset_sample_loading)
 ADD_FLUID_TEST(test_pointer_alignment)
 ADD_FLUID_TEST(test_seqbind_unregister)
 ADD_FLUID_TEST(test_synth_chorus_reverb)
 ADD_FLUID_TEST(test_snprintf)
+ADD_FLUID_TEST(test_synth_process)
 
-if ( LIBSNDFILE_HASVORBIS )
-    ADD_FLUID_TEST(test_sf3_sfont_loading)
-endif ( LIBSNDFILE_HASVORBIS )
+# if ( LIBSNDFILE_HASVORBIS )
+#     ADD_FLUID_TEST(test_sf3_sfont_loading)
+# endif ( LIBSNDFILE_HASVORBIS )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fluidsynth-2.0.4/test/test.h 
new/fluidsynth-2.0.5/test/test.h
--- old/fluidsynth-2.0.4/test/test.h    2019-02-22 10:15:18.000000000 +0100
+++ new/fluidsynth-2.0.5/test/test.h    2019-04-18 19:43:39.000000000 +0200
@@ -4,7 +4,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-#define TEST_ASSERT(COND) do { if (!(COND)) { fprintf(stderr, __FILE__ ":%d 
assertion (%s) failed\n", __LINE__, #COND); exit(-1); } } while (0)
+#define TEST_ASSERT(COND) do { if (!(COND)) { fprintf(stderr, __FILE__ ":%d 
assertion (%s) failed\n", __LINE__, #COND); abort(); } } while (0)
 
 /* macro to test whether a fluidsynth function succeeded or not */
 #define TEST_SUCCESS(FLUID_FUNCT) TEST_ASSERT((FLUID_FUNCT) != FLUID_FAILED)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fluidsynth-2.0.4/test/test_synth_process.c 
new/fluidsynth-2.0.5/test/test_synth_process.c
--- old/fluidsynth-2.0.4/test/test_synth_process.c      1970-01-01 
01:00:00.000000000 +0100
+++ new/fluidsynth-2.0.5/test/test_synth_process.c      2019-04-18 
19:43:39.000000000 +0200
@@ -0,0 +1,87 @@
+
+#include "test.h"
+#include "fluidsynth.h"
+#include "fluidsynth_priv.h"
+#include "fluid_synth.h"
+#include <string.h>
+
+// static const int CHANNELS=16;
+enum { SAMPLES=1024 };
+
+int render_one_mock(fluid_synth_t *synth, int blocks)
+{
+    static int smpl;
+    
+    fluid_real_t *left_in, *fx_left_in;
+    fluid_real_t *right_in, *fx_right_in;
+
+    int i, j;
+
+    int nfxchan = fluid_synth_count_effects_channels(synth),
+        nfxunits = fluid_synth_count_effects_groups(synth),
+        naudchan = fluid_synth_count_audio_channels(synth);
+
+    fluid_rvoice_mixer_get_bufs(synth->eventhandler->mixer, &left_in, 
&right_in);
+    fluid_rvoice_mixer_get_fx_bufs(synth->eventhandler->mixer, &fx_left_in, 
&fx_right_in);
+
+    for(i = 0; i < naudchan; i++)
+    {
+        for(j = 0; j < blocks * FLUID_BUFSIZE; j++)
+        {
+            int idx = i * FLUID_MIXER_MAX_BUFFERS_DEFAULT * FLUID_BUFSIZE + j;
+
+            right_in[idx] = left_in[idx] = (float)smpl++;
+        }
+    }
+
+    return blocks;
+}
+
+int render_and_check(fluid_synth_t* synth, int number_of_samples, int offset)
+{
+    int i;
+    float left[SAMPLES], right[SAMPLES];
+    float *dry[1 * 2];
+    dry[0] = left;
+    dry[1] = right;
+    memset(left, 0, sizeof(left));
+    memset(right, 0, sizeof(right));
+    
+    TEST_SUCCESS(fluid_synth_process_LOCAL(synth, number_of_samples, 0, NULL, 
2, dry, render_one_mock));
+    
+    for(i=0; i<number_of_samples; i++)
+    {
+        TEST_ASSERT(left[i]==i+offset);
+        TEST_ASSERT(right[i]==i+offset);
+    }
+    
+    return i+offset;
+}
+
+// this test should make sure that sample rate changed are handled correctly
+int main(void)
+{
+    int off=0;
+    fluid_synth_t *synth;
+    fluid_settings_t *settings = new_fluid_settings();
+    TEST_ASSERT(settings != NULL);
+
+//     TEST_SUCCESS(fluid_settings_setint(settings, "synth.audio-channels", 
CHANNELS));
+//     TEST_SUCCESS(fluid_settings_setint(settings, "synth.audio-groups", 
CHANNELS));
+
+    synth = new_fluid_synth(settings);
+    TEST_ASSERT(synth != NULL);
+
+    off = render_and_check(synth, 100, off);
+    off = render_and_check(synth, 200, off);
+    off = render_and_check(synth, 300, off);
+    off = render_and_check(synth, 1000, off);
+    off = render_and_check(synth, 900, off);
+    off = render_and_check(synth, 800, off);
+    
+
+    delete_fluid_synth(synth);
+    delete_fluid_settings(settings);
+
+    return EXIT_SUCCESS;
+}


Reply via email to