Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FluidSynth] Provide support for FluidSynth 2.x #26

Closed
Wohlstand opened this issue Jan 10, 2019 · 3 comments
Closed

[FluidSynth] Provide support for FluidSynth 2.x #26

Wohlstand opened this issue Jan 10, 2019 · 3 comments
Assignees

Comments

@Wohlstand
Copy link
Member

FluidSynth 1 and 2 are not compatible:

/home/stephane/extsvn/SDL-Mixer-X.git/trunk/src/codecs/music_fluidsynth.c: In function 'FLUIDSYNTH_Load':
/home/stephane/extsvn/SDL-Mixer-X.git/trunk/src/codecs/music_fluidsynth.c:69:21: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
     fluidsynth.FUNC = FUNC;
                     ^
/home/stephane/extsvn/SDL-Mixer-X.git/trunk/src/codecs/music_fluidsynth.c:81:9: note: in expansion of macro 'FUNCTION_LOADER'
         FUNCTION_LOADER(delete_fluid_player, int (*)(fluid_player_t*))
         ^~~~~~~~~~~~~~~
/home/stephane/extsvn/SDL-Mixer-X.git/trunk/src/codecs/music_fluidsynth.c:69:21: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
     fluidsynth.FUNC = FUNC;
                     ^
/home/stephane/extsvn/SDL-Mixer-X.git/trunk/src/codecs/music_fluidsynth.c:83:9: note: in expansion of macro 'FUNCTION_LOADER'
         FUNCTION_LOADER(delete_fluid_synth, int (*)(fluid_synth_t*))

It's need to provide the dual support of both FS 1 and 2 with accurate identification of each FluidSynth version.

@Wohlstand Wohlstand self-assigned this Jan 10, 2019
@Wohlstand
Copy link
Member Author

A little patch given by StefG:

~/extsvn/SDL-Mixer-X.git/trunk/src/codecs $svn diff
Index: music_fluidsynth.c
===================================================================
--- music_fluidsynth.c   (révision 242)
+++ music_fluidsynth.c   (copie de travail)
@@ -32,14 +32,19 @@
 
 #include <fluidsynth.h>
 
+#if FLUIDSYNTH_VERSION_MAJOR >= 2
+   #define DELETE_RETURNTYPE void
+#else
+   #define DELETE_RETURNTYPE int
+#endif
 
 typedef struct {
     int loaded;
     void *handle;
 
-    int (*delete_fluid_player)(fluid_player_t*);
+    DELETE_RETURNTYPE (*delete_fluid_player)(fluid_player_t*);
     void (*delete_fluid_settings)(fluid_settings_t*);
-    int (*delete_fluid_synth)(fluid_synth_t*);
+    DELETE_RETURNTYPE (*delete_fluid_synth)(fluid_synth_t*);
     int (*fluid_player_add)(fluid_player_t*, const char*);
     int (*fluid_player_add_mem)(fluid_player_t*, const void*, size_t);
     int (*fluid_player_get_status)(fluid_player_t*);
@@ -78,9 +83,9 @@
             return -1;
         }
 #endif
-        FUNCTION_LOADER(delete_fluid_player, int (*)(fluid_player_t*))
+        FUNCTION_LOADER(delete_fluid_player, DELETE_RETURNTYPE (*)(fluid_player_t*))
         FUNCTION_LOADER(delete_fluid_settings, void (*)(fluid_settings_t*))
-        FUNCTION_LOADER(delete_fluid_synth, int (*)(fluid_synth_t*))
+        FUNCTION_LOADER(delete_fluid_synth, DELETE_RETURNTYPE (*)(fluid_synth_t*))
         FUNCTION_LOADER(fluid_player_add, int (*)(fluid_player_t*, const char*))
         FUNCTION_LOADER(fluid_player_add_mem, int (*)(fluid_player_t*, const void*, size_t))
         FUNCTION_LOADER(fluid_player_get_status, int (*)(fluid_player_t*))

@Wohlstand
Copy link
Member Author

Patch has been applied!
Need a test from the side...

@Wohlstand Wohlstand added Need a test The fix / implementation needs some polishing and testing on a side of the reporter or by others. and removed Need a test The fix / implementation needs some polishing and testing on a side of the reporter or by others. labels Jan 10, 2019
@Wohlstand
Copy link
Member Author

Tested and confirmed by reporter!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant