From 33f0c98f413ed265e6de97032cfceb157014aa67 Mon Sep 17 00:00:00 2001
From: mobinmob <mobinmob@disroot.org>
Date: Sat, 29 Jun 2019 22:40:19 +0300
Subject: [PATCH 01/13] fluidsynth: update to 2.0.5

---
 common/shlibs               | 2 +-
 srcpkgs/fluidsynth/template | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/common/shlibs b/common/shlibs
index 2f146bbfa9d..262d9aba37b 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -965,7 +965,7 @@ libfftw3l_omp.so.3 libfftw-3.3.5_1
 libfftw3f_threads.so.3 libfftw-3.3_1
 libfftw3f.so.3 libfftw-3.3_1
 libfftw3f_omp.so.3 libfftw-3.3.5_1
-libfluidsynth.so.1 libfluidsynth-1.1.5_1
+libfluidsynth.so.2 libfluidsynth-2.0.5_1
 liblo.so.7 liblo-0.26_1
 libvamp-sdk.so.2 libvamp-plugin-sdk-2.2_1
 librubberband.so.2 librubberband-1.6.0_1
diff --git a/srcpkgs/fluidsynth/template b/srcpkgs/fluidsynth/template
index 4c68145fa50..cdccf00cd19 100644
--- a/srcpkgs/fluidsynth/template
+++ b/srcpkgs/fluidsynth/template
@@ -1,7 +1,7 @@
 # Template file for 'fluidsynth'
 pkgname=fluidsynth
-version=1.1.11
-revision=2
+version=2.0.5
+revision=1
 build_style=cmake
 configure_args="-DLIB_SUFFIX=
  -DDEFAULT_SOUNDFONT:STRING=/usr/share/soundfonts/default.sf2"
@@ -12,7 +12,7 @@ maintainer="Juan RP <xtraeme@voidlinux.org>"
 license="LGPL-2.1-or-later"
 homepage="http://www.fluidsynth.org/"
 distfiles="https://github.com/FluidSynth/fluidsynth/archive/v${version}.tar.gz"
-checksum=da8878ff374d12392eecf87e96bad8711b8e76a154c25a571dd8614d1af80de8
+checksum=69b244512883491e7e66b4d0151c61a0d6d867d4d2828c732563be0f78abcc51
 
 libfluidsynth_package() {
 	short_desc+=" - runtime library"

From 6652f51e0db02781291d2a4511d66ee9cbbf00fe Mon Sep 17 00:00:00 2001
From: mobinmob <mobinmob@disroot.org>
Date: Sun, 30 Jun 2019 15:52:38 +0300
Subject: [PATCH 02/13] Carla: bump revision due to libfluidsynth soname change

---
 srcpkgs/Carla/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/Carla/template b/srcpkgs/Carla/template
index d4d36a4923d..d651d804a85 100644
--- a/srcpkgs/Carla/template
+++ b/srcpkgs/Carla/template
@@ -1,7 +1,7 @@
 # Template file for 'Carla'
 pkgname=Carla
 version=2.0.0
-revision=2
+revision=3
 archs="x86_64* i686* aarch64* arm*"
 build_style=gnu-makefile
 make_build_args="DEFAULT_QT=5"

From a1b2bc35dc9d4cf1be1953a52bdc88d2b2d76d24 Mon Sep 17 00:00:00 2001
From: mobinmob <mobinmob@disroot.org>
Date: Sun, 30 Jun 2019 15:53:31 +0300
Subject: [PATCH 03/13] SLADE: bump revision due to libfluidsynth soname change

---
 srcpkgs/SLADE/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/SLADE/template b/srcpkgs/SLADE/template
index 0015cd93633..3731833f89e 100644
--- a/srcpkgs/SLADE/template
+++ b/srcpkgs/SLADE/template
@@ -1,7 +1,7 @@
 # Template file for 'SLADE'
 pkgname=SLADE
 version=3.1.5
-revision=1
+revision=2
 build_style=cmake
 hostmakedepends="pkg-config p7zip"
 makedepends="SFML-devel fluidsynth-devel freeimage-devel ftgl-devel glew-devel

From 73918a7e671b094580912032eeb26c178be8d103 Mon Sep 17 00:00:00 2001
From: mobinmob <mobinmob@disroot.org>
Date: Sun, 30 Jun 2019 15:53:51 +0300
Subject: [PATCH 04/13] audacious-plugins: bump revision due to libfluidsynth
 soname change

---
 srcpkgs/audacious-plugins/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/audacious-plugins/template b/srcpkgs/audacious-plugins/template
index 36ed6252c4b..b09974a39c8 100644
--- a/srcpkgs/audacious-plugins/template
+++ b/srcpkgs/audacious-plugins/template
@@ -1,7 +1,7 @@
 # Template file for 'audacious-plugins'
 pkgname=audacious-plugins
 version=3.10.1
-revision=2
+revision=3
 build_style=gnu-configure
 hostmakedepends="pkg-config"
 makedepends="audacious-devel alsa-lib-devel pulseaudio-devel jack-devel

From cc659f9299e91d651be1ae44501764eb4e21affe Mon Sep 17 00:00:00 2001
From: mobinmob <mobinmob@disroot.org>
Date: Sun, 30 Jun 2019 15:54:08 +0300
Subject: [PATCH 05/13] calf: bump revision due to libfluidsynth soname change

---
 srcpkgs/calf/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/calf/template b/srcpkgs/calf/template
index b1fd625c032..6c9e904453e 100644
--- a/srcpkgs/calf/template
+++ b/srcpkgs/calf/template
@@ -1,7 +1,7 @@
 # Template file for 'calf'
 pkgname=calf
 version=0.90.2
-revision=2
+revision=3
 build_style=gnu-configure
 configure_args="--enable-experimental"
 hostmakedepends="automake libtool pkg-config"

From 5511aa8f692737442c073b851eda923a57a25d9b Mon Sep 17 00:00:00 2001
From: mobinmob <mobinmob@disroot.org>
Date: Sun, 30 Jun 2019 16:47:47 +0300
Subject: [PATCH 06/13] lmms: bump revision due to libfluidsynth soname change

---
 srcpkgs/lmms/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/lmms/template b/srcpkgs/lmms/template
index e4fa1c03b1e..45a21b0b9a6 100644
--- a/srcpkgs/lmms/template
+++ b/srcpkgs/lmms/template
@@ -1,7 +1,7 @@
 # Template file for 'lmms'
 pkgname=lmms
 version=1.2.0
-revision=1
+revision=2
 archs="~armv6*"
 build_style=cmake
 configure_args="-DWANT_QT5=ON -DWANT_WEAKJACK=OFF"

From be77fc35636d864fe3a2a7e07398e4e00848a718 Mon Sep 17 00:00:00 2001
From: mobinmob <mobinmob@disroot.org>
Date: Sun, 30 Jun 2019 17:22:19 +0300
Subject: [PATCH 07/13] prboom-plus: bump revision due to libfluidsynth soname
 change

---
 srcpkgs/prboom-plus/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/prboom-plus/template b/srcpkgs/prboom-plus/template
index a4bff1ae3ce..aa5fddca44e 100644
--- a/srcpkgs/prboom-plus/template
+++ b/srcpkgs/prboom-plus/template
@@ -1,7 +1,7 @@
 # Template file for 'prboom-plus'
 pkgname=prboom-plus
 version=2.5.1.4
-revision=2
+revision=3
 build_style=gnu-configure
 configure_args="--disable-cpu-opt --disable-dogs"
 hostmakedepends="pcre-devel fluidsynth-devel libmad-devel SDL_mixer-devel SDL_net-devel

From 8d06ab2e692fa9ffafcc0850f9c99e6356b4c4a4 Mon Sep 17 00:00:00 2001
From: mobinmob <mobinmob@disroot.org>
Date: Sun, 30 Jun 2019 17:22:34 +0300
Subject: [PATCH 08/13] qsynth: bump revision due to libfluidsynth soname
 change

---
 srcpkgs/qsynth/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/qsynth/template b/srcpkgs/qsynth/template
index fff57e4ca69..509e5029624 100644
--- a/srcpkgs/qsynth/template
+++ b/srcpkgs/qsynth/template
@@ -1,7 +1,7 @@
 # Template file for 'qsynth'
 pkgname=qsynth
 version=0.5.6
-revision=1
+revision=2
 build_style=gnu-configure
 hostmakedepends="pkg-config qt5-tools"
 makedepends="qt5-x11extras-devel jack-devel fluidsynth-devel"

From 33d12b3344061e0fd64b4f0b33f8bae04ff41244 Mon Sep 17 00:00:00 2001
From: mobinmob <mobinmob@disroot.org>
Date: Sun, 30 Jun 2019 17:25:35 +0300
Subject: [PATCH 09/13] residualvm: bump revision due to libfluidsynth soname
 change

---
 srcpkgs/residualvm/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/residualvm/template b/srcpkgs/residualvm/template
index 556a3d48750..583d2a489ec 100644
--- a/srcpkgs/residualvm/template
+++ b/srcpkgs/residualvm/template
@@ -1,7 +1,7 @@
 # Template file for 'residualvm'
 pkgname=residualvm
 version=0.3.1
-revision=2
+revision=3
 build_style=configure
 configure_args="--prefix=/usr --enable-all-engines --enable-release
  --enable-flac --enable-faad --enable-fluidsynth $(vopt_enable sndio)"

From 899d84254d603b9b4bf481d1de1fd87c28d08394 Mon Sep 17 00:00:00 2001
From: mobinmob <mobinmob@disroot.org>
Date: Sun, 30 Jun 2019 18:16:33 +0300
Subject: [PATCH 10/13] scummvm: bump revision due to libfluidsynth soname
 change

---
 srcpkgs/scummvm/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/scummvm/template b/srcpkgs/scummvm/template
index 52a03c694eb..935cd15f395 100644
--- a/srcpkgs/scummvm/template
+++ b/srcpkgs/scummvm/template
@@ -1,7 +1,7 @@
 # Template file for 'scummvm'
 pkgname=scummvm
 version=2.0.0
-revision=1
+revision=2
 build_style=configure
 configure_args="--prefix=/usr --enable-plugins --enable-all-engines"
 hostmakedepends="pkg-config nasm"

From 49313c78b2aeaa9255046dfc76af7dd4b38b84a8 Mon Sep 17 00:00:00 2001
From: mobinmob <mobinmob@disroot.org>
Date: Fri, 19 Jul 2019 18:57:09 +0300
Subject: [PATCH 11/13] gst-plugins-bad1: bump revision due to fluidsynth
 soname change

---
 srcpkgs/gst-plugins-bad1/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/gst-plugins-bad1/template b/srcpkgs/gst-plugins-bad1/template
index 99ef419a9e8..a590d42786f 100644
--- a/srcpkgs/gst-plugins-bad1/template
+++ b/srcpkgs/gst-plugins-bad1/template
@@ -1,7 +1,7 @@
 # Template file for 'gst-plugins-bad1'
 pkgname=gst-plugins-bad1
 version=1.16.0
-revision=4
+revision=5
 wrksrc="${pkgname/1/}-${version}"
 build_helper="gir"
 build_style=meson

From 4a8e7fcc7306534bf0c4c780ba443a253e048236 Mon Sep 17 00:00:00 2001
From: mobinmob <mobinmob@disroot.org>
Date: Fri, 19 Jul 2019 21:58:25 +0300
Subject: [PATCH 12/13] csound: bump revision due to fluidsynth soname change

---
 srcpkgs/csound/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/csound/template b/srcpkgs/csound/template
index b0f8833e286..516b3cead7b 100644
--- a/srcpkgs/csound/template
+++ b/srcpkgs/csound/template
@@ -1,7 +1,7 @@
 # Template file for 'csound'
 pkgname=csound
 version=6.13.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="
  -DLUA_MODULE_INSTALL_DIR=${XBPS_CROSS_BASE}/usr/lib/lua/5.1

From ffaaee48b749eeaa37c23de2e051e0652353e165 Mon Sep 17 00:00:00 2001
From: mobinmob <mobinmob@disroot.org>
Date: Fri, 19 Jul 2019 22:57:02 +0300
Subject: [PATCH 13/13] tuxguitar: patch to work with fluidsynth2+

---
 .../patches/001-tuxguitar-fluidsynth2.patch   | 123 ++++++++++++++++++
 srcpkgs/tuxguitar/template                    |   2 +-
 2 files changed, 124 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/tuxguitar/patches/001-tuxguitar-fluidsynth2.patch

diff --git a/srcpkgs/tuxguitar/patches/001-tuxguitar-fluidsynth2.patch b/srcpkgs/tuxguitar/patches/001-tuxguitar-fluidsynth2.patch
new file mode 100644
index 00000000000..72b969cd32b
--- /dev/null
+++ b/srcpkgs/tuxguitar/patches/001-tuxguitar-fluidsynth2.patch
@@ -0,0 +1,123 @@
+Index: tuxguitar-code/TuxGuitar-fluidsynth/jni/GNUmakefile
+===================================================================
+--- TuxGuitar-fluidsynth/jni/GNUmakefile	(revision 1799)
++++ TuxGuitar-fluidsynth/jni/GNUmakefile	(revision 1800)
+@@ -1,5 +1,5 @@
+ RM?=rm -f
+-CFLAGS?=-I$(shell gcj -print-file-name=include/) -fPIC
++CFLAGS?=-I../../build-scripts/native-modules/common-include -fPIC
+ LDFLAGS?=
+ LDLIBS?=-lfluidsynth
+ LDPATH?=-L/usr/lib
+Index: tuxguitar-code/TuxGuitar-fluidsynth/jni/org_herac_tuxguitar_player_impl_midiport_fluidsynth_MidiSynth.c
+===================================================================
+--- TuxGuitar-fluidsynth/jni/org_herac_tuxguitar_player_impl_midiport_fluidsynth_MidiSynth.c	(revision 1799)
++++ TuxGuitar-fluidsynth/jni/org_herac_tuxguitar_player_impl_midiport_fluidsynth_MidiSynth.c	(revision 1800)
+@@ -4,6 +4,9 @@
+ #include <fluidsynth.h>
+ #include "org_herac_tuxguitar_player_impl_midiport_fluidsynth_MidiSynth.h"
+ 
++#define FLUID_VERSION_GEN(major, minor, micro) ((major << 16) | (minor << 8) | (micro)) 
++#define FLUID_VERSION FLUID_VERSION_GEN(FLUIDSYNTH_VERSION_MAJOR, FLUIDSYNTH_VERSION_MINOR, FLUIDSYNTH_VERSION_MICRO) 
++
+ typedef struct{
+ 	fluid_settings_t* settings;
+ 	fluid_synth_t* synth;
+@@ -217,7 +220,7 @@
+ 			double value = 0;
+ 			const jbyte *jkey = (*env)->GetStringUTFChars(env, key, NULL);
+ 			
+-			fluid_settings_getnum(handle->settings,(char *)jkey, &value );
++			fluid_settings_getnum(handle->settings, (char *)jkey, &value);
+ 			
+ 			(*env)->ReleaseStringUTFChars(env, key, jkey);
+ 			(*env)->CallVoidMethod( env, ref , mid , (jdouble)value );
+@@ -236,7 +239,7 @@
+ 			int value = 0;
+ 			const jbyte *jkey = (*env)->GetStringUTFChars(env, key, NULL);
+ 			
+-			fluid_settings_getint(handle->settings,(char *)jkey, &value );
++			fluid_settings_getint(handle->settings, (char *)jkey, &value);
+ 			
+ 			(*env)->ReleaseStringUTFChars(env, key, jkey);
+ 			(*env)->CallVoidMethod( env, ref , mid , (jint)value );
+@@ -256,7 +259,8 @@
+ 			char *value = NULL;
+ 			const jbyte *jkey = (*env)->GetStringUTFChars(env, key, NULL);
+ 			
+-			fluid_settings_getstr(handle->settings,(char *)jkey, &value );
++			fluid_settings_dupstr(handle->settings, (char *)jkey, &value);
++			
+ 			jvalue = (*env)->NewStringUTF(env, value);
+ 			
+ 			(*env)->ReleaseStringUTFChars(env, key, jkey);
+@@ -273,11 +277,16 @@
+ 		jclass cl = (*env)->GetObjectClass(env, ref);
+ 		jmethodID mid = (*env)->GetMethodID(env, cl, "setValue", "(D)V");
+ 		if (mid != 0){
++			double value = 0;
+ 			const jbyte *jkey = (*env)->GetStringUTFChars(env, key, NULL);
+-			double value = fluid_settings_getnum_default(handle->settings,(char *)jkey);
+-			
++
++#if FLUID_VERSION >= FLUID_VERSION_GEN(2,0,0)
++			fluid_settings_getnum_default(handle->settings, (char *)jkey, &value);
++#else
++			value = fluid_settings_getnum_default(handle->settings, (char *)jkey);
++#endif
+ 			(*env)->ReleaseStringUTFChars(env, key, jkey);
+-			(*env)->CallVoidMethod( env, ref , mid , (jdouble)value );
++			(*env)->CallVoidMethod( env, ref , mid , (jdouble) value );
+ 		}
+ 	}
+ }
+@@ -290,9 +299,14 @@
+ 		jclass cl = (*env)->GetObjectClass(env, ref);
+ 		jmethodID mid = (*env)->GetMethodID(env, cl, "setValue", "(I)V");
+ 		if (mid != 0){
++			int value = 0;
+ 			const jbyte *jkey = (*env)->GetStringUTFChars(env, key, NULL);
+-			int value = fluid_settings_getint_default(handle->settings,(char *)jkey);
+ 			
++#if FLUID_VERSION >= FLUID_VERSION_GEN(2,0,0)
++			fluid_settings_getint_default(handle->settings, (char *)jkey, &value);
++#else
++			value = fluid_settings_getint_default(handle->settings, (char *)jkey);
++#endif
+ 			(*env)->ReleaseStringUTFChars(env, key, jkey);
+ 			(*env)->CallVoidMethod( env, ref , mid , (jint)value );
+ 		}
+@@ -307,8 +321,14 @@
+ 		jclass cl = (*env)->GetObjectClass(env, ref);
+ 		jmethodID mid = (*env)->GetMethodID(env, cl, "setValue", "(Ljava/lang/String;)V");
+ 		if (mid != 0){
++			char *value = NULL;
+ 			const jbyte *jkey = (*env)->GetStringUTFChars(env, key, NULL);
+-			char *value = fluid_settings_getstr_default(handle->settings,(char *)jkey);
++			
++#if FLUID_VERSION >= FLUID_VERSION_GEN(2,0,0)
++			fluid_settings_getstr_default(handle->settings,(char *)jkey, &value);
++#else
++			value = fluid_settings_getstr_default(handle->settings,(char *)jkey);
++#endif
+ 			jstring jvalue = (*env)->NewStringUTF(env, value);
+ 			
+ 			(*env)->ReleaseStringUTFChars(env, key, jkey);
+@@ -331,7 +351,7 @@
+ 			double maximum = 0;
+ 			const jbyte *jkey = (*env)->GetStringUTFChars(env, key, NULL);
+ 			
+-			fluid_settings_getnum_range(handle->settings,(char *)jkey, &minimum , &maximum );
++			fluid_settings_getnum_range(handle->settings,(char *)jkey, &minimum , &maximum);
+ 			
+ 			(*env)->ReleaseStringUTFChars(env, key, jkey);
+ 			(*env)->CallVoidMethod( env, minimumRef , midMin , (jdouble)minimum );
+@@ -354,7 +374,7 @@
+ 			int maximum = 0;
+ 			const jbyte *jkey = (*env)->GetStringUTFChars(env, key, NULL);
+ 			
+-			fluid_settings_getint_range(handle->settings,(char *)jkey, &minimum , &maximum );
++			fluid_settings_getint_range(handle->settings,(char *)jkey, &minimum , &maximum);
+ 			
+ 			(*env)->ReleaseStringUTFChars(env, key, jkey);
+ 			(*env)->CallVoidMethod( env, minimumRef , midMin , (jint)minimum );
diff --git a/srcpkgs/tuxguitar/template b/srcpkgs/tuxguitar/template
index 27ba7a7b28a..5df6328b455 100644
--- a/srcpkgs/tuxguitar/template
+++ b/srcpkgs/tuxguitar/template
@@ -1,7 +1,7 @@
 # Template file for 'tuxguitar'
 pkgname=tuxguitar
 version=1.5.2
-revision=1
+revision=2
 wrksrc="${pkgname}-${version}-src"
 hostmakedepends="apache-maven"
 makedepends="alsa-lib-devel fluidsynth-devel jack-devel"
