File: bug-715461-soundfont_paths.patch

package info (click to toggle)
libsdl2-mixer 2.0.1%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 2,332 kB
  • ctags: 1,907
  • sloc: ansic: 17,190; sh: 9,593; cpp: 241; makefile: 164
file content (49 lines) | stat: -rw-r--r-- 1,270 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
Description: no sf2 sound fonts loaded by default
 Introduced in 1.2.12-6 (Thu, 11 Jul 2013 12:17:15 +0100)
Author: Fabian Greffrath <fabian@greffrath.com>
Last-Update: 2014-10-24
Bug-Debian: http://bugs.debian.org/715461
--- a/mixer.c
+++ b/mixer.c
@@ -149,6 +149,11 @@
 {
     int result = 0;
 
+#ifdef MIX_INIT_SOUNDFONT_PATHS
+    if (!soundfont_paths)
+        soundfont_paths = SDL_strdup(MIX_INIT_SOUNDFONT_PATHS);
+#endif
+
     if (flags & MIX_INIT_FLUIDSYNTH) {
 #ifdef USE_FLUIDSYNTH_MIDI
         if ((initialized & MIX_INIT_FLUIDSYNTH) || Mix_InitFluidSynth() == 0) {
--- a/music.c
+++ b/music.c
@@ -1579,6 +1579,7 @@
 {
     char *context, *path, *paths;
     const char* cpaths = Mix_GetSoundFonts();
+    int soundfonts_found = 0;
 
     if (!cpaths) {
         Mix_SetError("No SoundFonts have been requested");
@@ -1598,12 +1599,16 @@
     for (path = strtok_r(paths, ":;", &context); path; path = strtok_r(NULL, ":;", &context)) {
 #endif
         if (!function(path, data)) {
-            SDL_free(paths);
-            return 0;
+            continue;
+        } else {
+            soundfonts_found++;
         }
     }
 
     SDL_free(paths);
-    return 1;
+    if (soundfonts_found > 0)
+        return 1;
+    else
+        return 0;
 }
 #endif