Skip to content

Commit

Permalink
dmsynth: Import and use FluidSynth 2.3.3.
Browse files Browse the repository at this point in the history
  • Loading branch information
rbernon authored and julliard committed Oct 10, 2023
1 parent d0c3a0e commit f768d6b
Show file tree
Hide file tree
Showing 90 changed files with 51,883 additions and 1 deletion.
139 changes: 139 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,8 @@ JPEG_PE_LIBS
JPEG_PE_CFLAGS
GSM_PE_LIBS
GSM_PE_CFLAGS
FLUIDSYNTH_PE_LIBS
FLUIDSYNTH_PE_CFLAGS
FAUDIO_PE_LIBS
FAUDIO_PE_CFLAGS
MINGW_PKG_CONFIG
Expand Down Expand Up @@ -1591,6 +1593,7 @@ enable_dxerr8
enable_dxerr9
enable_dxguid
enable_faudio
enable_fluidsynth
enable_gsm
enable_jpeg
enable_jxr
Expand Down Expand Up @@ -1746,6 +1749,8 @@ OBJC
OBJCFLAGS
FAUDIO_PE_CFLAGS
FAUDIO_PE_LIBS
FLUIDSYNTH_PE_CFLAGS
FLUIDSYNTH_PE_LIBS
GSM_PE_CFLAGS
GSM_PE_LIBS
JPEG_PE_CFLAGS
Expand Down Expand Up @@ -2528,6 +2533,12 @@ Some influential environment variables:
version
FAUDIO_PE_LIBS
Linker flags for the PE faudio, overriding the bundled version
FLUIDSYNTH_PE_CFLAGS
C compiler flags for the PE fluidsynth, overriding the bundled
version
FLUIDSYNTH_PE_LIBS
Linker flags for the PE fluidsynth, overriding the bundled
version
GSM_PE_CFLAGS
C compiler flags for the PE gsm, overriding the bundled version
GSM_PE_LIBS Linker flags for the PE gsm, overriding the bundled version
Expand Down Expand Up @@ -11827,6 +11838,116 @@ CPPFLAGS=$ac_save_CPPFLAGS
as_fn_append wine_notices "|FAudio ${notice_platform}MinGW development files not found (or too old); using bundled version."
fi

if ${FLUIDSYNTH_PE_CFLAGS:+false} :
then :
if test ${MINGW_PKG_CONFIG+y}
then :
FLUIDSYNTH_PE_CFLAGS=`$MINGW_PKG_CONFIG --cflags fluidsynth 2>/dev/null`
fi
fi
if ${FLUIDSYNTH_PE_LIBS:+false} :
then :
if test ${MINGW_PKG_CONFIG+y}
then :
FLUIDSYNTH_PE_LIBS=`$MINGW_PKG_CONFIG --libs fluidsynth 2>/dev/null`
fi
fi
FLUIDSYNTH_PE_LIBS=${FLUIDSYNTH_PE_LIBS:-"-lfluidsynth"}
ac_save_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$CPPFLAGS $FLUIDSYNTH_PE_CFLAGS"
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for MinGW fluidsynth.h" >&5
printf %s "checking for MinGW fluidsynth.h... " >&6; }
if test ${ac_cv_mingw_header_fluidsynth_h+y}
then :
printf %s "(cached) " >&6
else $as_nop
ac_wine_check_headers_saved_cc=$CC
ac_wine_check_headers_saved_exeext=$ac_exeext
eval CC=\$${wine_arch}_CC
ac_exeext=".exe"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */

#include <fluidsynth.h>
int
main (void)
{

;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
ac_cv_mingw_header_fluidsynth_h=yes
else $as_nop
ac_cv_mingw_header_fluidsynth_h=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
CC=$ac_wine_check_headers_saved_cc
ac_exeext=$ac_wine_check_headers_saved_exeext
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_mingw_header_fluidsynth_h" >&5
printf "%s\n" "$ac_cv_mingw_header_fluidsynth_h" >&6; }
if test "x$ac_cv_mingw_header_fluidsynth_h" = xyes
then :
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for new_fluid_synth in MinGW -lfluidsynth" >&5
printf %s "checking for new_fluid_synth in MinGW -lfluidsynth... " >&6; }
if test ${ac_cv_mingw_lib_fluidsynth+y}
then :
printf %s "(cached) " >&6
else $as_nop
ac_wine_check_headers_saved_cc=$CC
ac_wine_check_headers_saved_exeext=$ac_exeext
ac_wine_check_headers_saved_libs=$LIBS
eval CC=\$${wine_arch}_CC
ac_exeext=".exe"
LIBS="-lfluidsynth $FLUIDSYNTH_PE_LIBS $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */

/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
char new_fluid_synth ();
int
main (void)
{
return new_fluid_synth ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"
then :
ac_cv_mingw_lib_fluidsynth=yes
else $as_nop
ac_cv_mingw_lib_fluidsynth=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext conftest.$ac_ext
CC=$ac_wine_check_headers_saved_cc
ac_exeext=$ac_wine_check_headers_saved_exeext
LIBS=$ac_wine_check_headers_saved_libs
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_mingw_lib_fluidsynth" >&5
printf "%s\n" "$ac_cv_mingw_lib_fluidsynth" >&6; }
if test "x$ac_cv_mingw_lib_fluidsynth" = xyes
then :
:
else $as_nop
FLUIDSYNTH_PE_CFLAGS=""; FLUIDSYNTH_PE_LIBS=""
fi
else $as_nop
FLUIDSYNTH_PE_CFLAGS=""; FLUIDSYNTH_PE_LIBS=""
fi
CPPFLAGS=$ac_save_CPPFLAGS

if test "x$FLUIDSYNTH_PE_LIBS" = "x"
then
as_fn_append wine_notices "|Fluidsynth ${notice_platform}MinGW development files not found (or too old); using bundled version."
fi

if ${JPEG_PE_CFLAGS:+false} :
then :
if test ${MINGW_PKG_CONFIG+y}
Expand Down Expand Up @@ -13053,6 +13174,21 @@ fi
printf "%s\n" "$as_me:${as_lineno-$LINENO}: faudio cflags: $FAUDIO_PE_CFLAGS" >&5
printf "%s\n" "$as_me:${as_lineno-$LINENO}: faudio libs: $FAUDIO_PE_LIBS" >&5

if ${FLUIDSYNTH_PE_LIBS:+false} :
then :
FLUIDSYNTH_PE_LIBS="fluidsynth"
if ${FLUIDSYNTH_PE_CFLAGS:+false} :
then :
FLUIDSYNTH_PE_CFLAGS="-I\$(top_srcdir)/libs/fluidsynth/include"
else $as_nop
enable_fluidsynth=no
fi
else $as_nop
enable_fluidsynth=no
fi
printf "%s\n" "$as_me:${as_lineno-$LINENO}: fluidsynth cflags: $FLUIDSYNTH_PE_CFLAGS" >&5
printf "%s\n" "$as_me:${as_lineno-$LINENO}: fluidsynth libs: $FLUIDSYNTH_PE_LIBS" >&5

if ${GSM_PE_LIBS:+false} :
then :
GSM_PE_LIBS=gsm
Expand Down Expand Up @@ -21951,6 +22087,7 @@ wine_fn_config_makefile libs/dxerr8 enable_dxerr8
wine_fn_config_makefile libs/dxerr9 enable_dxerr9
wine_fn_config_makefile libs/dxguid enable_dxguid
wine_fn_config_makefile libs/faudio enable_faudio
wine_fn_config_makefile libs/fluidsynth enable_fluidsynth
wine_fn_config_makefile libs/gsm enable_gsm
wine_fn_config_makefile libs/jpeg enable_jpeg
wine_fn_config_makefile libs/jxr enable_jxr
Expand Down Expand Up @@ -23104,6 +23241,8 @@ PE_ARCHS = $PE_ARCHS
MINGW_PKG_CONFIG = $MINGW_PKG_CONFIG
FAUDIO_PE_CFLAGS = $FAUDIO_PE_CFLAGS
FAUDIO_PE_LIBS = $FAUDIO_PE_LIBS
FLUIDSYNTH_PE_CFLAGS = $FLUIDSYNTH_PE_CFLAGS
FLUIDSYNTH_PE_LIBS = $FLUIDSYNTH_PE_LIBS
GSM_PE_CFLAGS = $GSM_PE_CFLAGS
GSM_PE_LIBS = $GSM_PE_LIBS
JPEG_PE_CFLAGS = $JPEG_PE_CFLAGS
Expand Down
11 changes: 11 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1036,6 +1036,15 @@ then
WINE_NOTICE([FAudio ${notice_platform}MinGW development files not found (or too old); using bundled version.])
fi

WINE_MINGW_PACKAGE_FLAGS(FLUIDSYNTH,[fluidsynth],[-lfluidsynth],
[WINE_CHECK_MINGW_HEADER(fluidsynth.h,
[WINE_CHECK_MINGW_LIB(fluidsynth,new_fluid_synth,[:],[FLUIDSYNTH_PE_CFLAGS=""; FLUIDSYNTH_PE_LIBS=""],[$FLUIDSYNTH_PE_LIBS])],
[FLUIDSYNTH_PE_CFLAGS=""; FLUIDSYNTH_PE_LIBS=""])])
if test "x$FLUIDSYNTH_PE_LIBS" = "x"
then
WINE_NOTICE([Fluidsynth ${notice_platform}MinGW development files not found (or too old); using bundled version.])
fi

WINE_MINGW_PACKAGE_FLAGS(JPEG,[libjpeg],,
[WINE_CHECK_MINGW_HEADER(jpeglib.h,
[WINE_CHECK_MINGW_LIB(jpeg,jpeg_start_decompress,[:],[JPEG_PE_CFLAGS=""; JPEG_PE_LIBS=""],[$JPEG_PE_LIBS])],
Expand Down Expand Up @@ -1146,6 +1155,7 @@ then
fi

WINE_EXTLIB_FLAGS(FAUDIO, faudio, "faudio mfplat mfreadwrite mfuuid propsys", "-I\$(top_srcdir)/libs/faudio/include")
WINE_EXTLIB_FLAGS(FLUIDSYNTH, fluidsynth, "fluidsynth", "-I\$(top_srcdir)/libs/fluidsynth/include")
WINE_EXTLIB_FLAGS(GSM, gsm, gsm, "-I\$(top_srcdir)/libs/gsm/inc")
WINE_EXTLIB_FLAGS(JPEG, jpeg, jpeg, "-I\$(top_srcdir)/libs/jpeg")
WINE_EXTLIB_FLAGS(JXR, jxr, jxr, "-I\$(top_srcdir)/libs/jxr/jxrgluelib -I\$(top_srcdir)/libs/jxr/image/sys")
Expand Down Expand Up @@ -3324,6 +3334,7 @@ WINE_CONFIG_MAKEFILE(libs/dxerr8)
WINE_CONFIG_MAKEFILE(libs/dxerr9)
WINE_CONFIG_MAKEFILE(libs/dxguid)
WINE_CONFIG_MAKEFILE(libs/faudio)
WINE_CONFIG_MAKEFILE(libs/fluidsynth)
WINE_CONFIG_MAKEFILE(libs/gsm)
WINE_CONFIG_MAKEFILE(libs/jpeg)
WINE_CONFIG_MAKEFILE(libs/jxr)
Expand Down
3 changes: 2 additions & 1 deletion dlls/dmsynth/Makefile.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
MODULE = dmsynth.dll
IMPORTS = dxguid uuid ole32 advapi32
IMPORTS = $(FLUIDSYNTH_PE_LIBS) dxguid uuid ole32 advapi32 user32
EXTRAINCL = $(FLUIDSYNTH_PE_CFLAGS)

C_SRCS = \
dmsynth_main.c \
Expand Down
11 changes: 11 additions & 0 deletions dlls/dmsynth/synth.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@

#include "dmsynth_private.h"

#include <fluidsynth.h>

WINE_DEFAULT_DEBUG_CHANNEL(dmsynth);

static void dump_dmus_instrument(DMUS_INSTRUMENT *instrument)
Expand Down Expand Up @@ -228,6 +230,8 @@ struct synth

struct list instruments;
struct list waves;

fluid_settings_t *fluid_settings;
};

static inline struct synth *impl_from_IDirectMusicSynth8(IDirectMusicSynth8 *iface)
Expand Down Expand Up @@ -299,6 +303,7 @@ static ULONG WINAPI synth_Release(IDirectMusicSynth8 *iface)
wave_release(wave);
}

delete_fluid_settings(This->fluid_settings);
free(This);
}

Expand Down Expand Up @@ -1084,7 +1089,13 @@ HRESULT synth_create(IUnknown **ret_iface)
list_init(&obj->instruments);
list_init(&obj->waves);

if (!(obj->fluid_settings = new_fluid_settings())) goto failed;

TRACE("Created DirectMusicSynth %p\n", obj);
*ret_iface = (IUnknown *)&obj->IDirectMusicSynth8_iface;
return S_OK;

failed:
free(obj);
return E_OUTOFMEMORY;
}
Loading

0 comments on commit f768d6b

Please sign in to comment.