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

Support Loading DLS Files #493

Merged
merged 26 commits into from
May 11, 2019
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
e6d7fe8
detect libinstpatch by cmake
derselbst Dec 18, 2018
543669c
implement libinstpatch sfloader
derselbst Dec 18, 2018
e1fd074
log msg
derselbst Dec 29, 2018
0298b9f
do not copy sample data
derselbst Dec 29, 2018
dbeb31a
Merge branch 'master' into dls2
derselbst Dec 30, 2018
ecf2b42
fix win32 build
derselbst Dec 30, 2018
f065d25
avoid null deref
derselbst Jan 2, 2019
7185fa7
update AUTHORS
derselbst Mar 17, 2019
4e64325
Merge branch 'master' into dls2
derselbst Mar 17, 2019
81611ad
Merge branch 'master' into dls2
derselbst Mar 27, 2019
5929dd9
silence a warning when calling ipatch_file_close() with NULL
derselbst Mar 30, 2019
98bc6d0
avoid double unref
derselbst Apr 6, 2019
d1434de
avoid possible NULL derefs
derselbst Apr 6, 2019
c96f974
remove debug code
derselbst Apr 6, 2019
20b1acf
Merge branch 'master' into dls2
derselbst Apr 6, 2019
f8654b9
preallocate all preset and cache them in a list
derselbst Apr 13, 2019
232f225
implement preset iteration
derselbst Apr 13, 2019
961d2aa
correctly handle percussion instruments
derselbst Apr 13, 2019
035b7d5
fix a use after free in instpatch sfloader
derselbst May 4, 2019
7e0285e
add comment
derselbst May 4, 2019
87997f9
make format
derselbst May 5, 2019
617f6a8
revert error msg "Not a SF file"
derselbst May 5, 2019
7110cd6
remaining nit-picks
derselbst May 5, 2019
48cf39c
remove remaining full stops
derselbst May 5, 2019
106b3f3
Merge branch 'master' into dls2
derselbst May 5, 2019
91a5e95
improve warning message if DLS instrument cannot be used
derselbst May 6, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ summary of contributions.

* Tom Moebert (fluidsynth's maintainer since Jun 2017) cleaned up and refactored
fluidsynth's API and revised its documentation, added support for 24 bit sample
soundfonts, fixed various bugs, implemented unit tests and CI builds for
Windows, Linux, MacOSX.
soundfonts, added support for DLS soundfonts, fixed various bugs, implemented
unit tests and CI builds for Windows, Linux, MacOSX and BSD.

* Growing list of individuals who contributed bug fixes, corrections and minor features:
Nicolas Boulicault for ALSA sequencer midi.portname setting.
Expand Down
9 changes: 8 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ option ( enable-dbus "compile DBUS support (if it is available)" on )
option ( enable-ipv6 "enable ipv6 support" on )
option ( enable-jack "compile JACK support (if it is available)" on )
option ( enable-ladspa "enable LADSPA effect units" on )
option ( enable-libinstpatch "use libinstpatch (if available) to load DLS and GIG files" on )
option ( enable-libsndfile "compile libsndfile support (if it is available)" on )
option ( enable-midishare "compile MidiShare support (if it is available)" on )
option ( enable-opensles "compile OpenSLES support (if it is available)" off )
Expand Down Expand Up @@ -567,7 +568,13 @@ else(NOT enable-pkgconfig)
set ( LADSPA 1 )
endif ( LADSPA_SUPPORT )
endif ( enable-ladspa )


unset ( LIBINSTPATCH_SUPPORT CACHE )
if ( enable-libinstpatch )
pkg_check_modules ( LIBINSTPATCH libinstpatch-1.0 )
set ( LIBINSTPATCH_SUPPORT ${LIBINSTPATCH_FOUND} )
endif ( enable-libinstpatch )

unset ( SDL2_SUPPORT CACHE )
if ( enable-sdl2 )
pkg_check_modules ( SDL2 sdl2 )
Expand Down
6 changes: 6 additions & 0 deletions cmake_admin/report.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,12 @@ else ( WITH_READLINE )
message ( "Readline: no" )
endif ( WITH_READLINE )

if ( LIBINSTPATCH_SUPPORT )
message ( "libinstpatch: yes" )
else ( LIBINSTPATCH_SUPPORT )
message ( "libinstpatch: no" )
endif ( LIBINSTPATCH_SUPPORT )

if ( WITH_FLOAT )
message ( "Samples type=float: yes" )
else ( WITH_FLOAT )
Expand Down
11 changes: 9 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,14 @@ include_directories (
${CMAKE_SOURCE_DIR}/src/bindings
${CMAKE_SOURCE_DIR}/include
${CMAKE_BINARY_DIR}/include
${PTHREADS_INCLUDE_DIR}
${SDL2_INCLUDE_DIR}
)

include_directories (
SYSTEM
${GLIB_INCLUDE_DIRS}
${PTHREADS_INCLUDE_DIR}
${SDL2_INCLUDE_DIR}
${LIBINSTPATCH_INCLUDE_DIRS}
)

# ************ library ************
Expand Down Expand Up @@ -127,6 +128,10 @@ if ( AUFILE_SUPPORT )
set ( fluid_aufile_SOURCES drivers/fluid_aufile.c )
endif ( AUFILE_SUPPORT )

if ( LIBINSTPATCH_SUPPORT )
set ( fluid_libinstpatch_SOURCES sfloader/fluid_instpatch.c sfloader/fluid_instpatch.h )
endif ( LIBINSTPATCH_SUPPORT )

if ( OPENSLES_SUPPORT )
set ( fluid_opensles_SOURCES drivers/fluid_opensles.c )
include_directories ( ${OpenSLES_INCLUDE_DIRS} )
Expand Down Expand Up @@ -277,6 +282,7 @@ add_library ( libfluidsynth-OBJ OBJECT
${fluid_waveout_SOURCES}
${fluid_winmidi_SOURCES}
${fluid_sdl2_SOURCES}
${fluid_libinstpatch_SOURCES}
${libfluidsynth_SOURCES}
${public_HEADERS}
${public_main_HEADER}
Expand Down Expand Up @@ -355,6 +361,7 @@ target_link_libraries ( libfluidsynth
${OpenSLES_LIBS}
${OBOE_LIBS}
${LIBFLUID_LIBS}
${LIBINSTPATCH_LIBRARIES}
)

# ************ CLI program ************
Expand Down
3 changes: 3 additions & 0 deletions src/config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@
/* Define to enable network support */
#cmakedefine NETWORK_SUPPORT @NETWORK_SUPPORT@

/* libinstpatch for DLS and GIG */
#cmakedefine LIBINSTPATCH_SUPPORT @LIBINSTPATCH_SUPPORT@

/* libsndfile has ogg vorbis support */
#cmakedefine LIBSNDFILE_HASVORBIS @LIBSNDFILE_HASVORBIS@

Expand Down
23 changes: 22 additions & 1 deletion src/fluidsynth.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
#define GETOPT_SUPPORT 1
#endif

#ifdef LIBINSTPATCH_SUPPORT
#include <libinstpatch/libinstpatch.h>
#endif
#include "fluid_lash.h"

#ifdef SYSTEMD_SUPPORT
Expand Down Expand Up @@ -297,6 +300,22 @@ fast_render_loop(fluid_settings_t *settings, fluid_synth_t *synth, fluid_player_
delete_fluid_file_renderer(renderer);
}

static int is_dls(const char* fname)
{
#ifdef LIBINSTPATCH_SUPPORT
IpatchFileHandle *fhandle = ipatch_file_identify_open (fname, NULL);
derselbst marked this conversation as resolved.
Show resolved Hide resolved
int ret = (fhandle != NULL);
if(ret)
{
ipatch_file_close(fhandle);
}

return ret;
#else
return FALSE;
#endif
}

/*
* main
* Process initialization steps in the following order:
Expand Down Expand Up @@ -766,7 +785,9 @@ int main(int argc, char **argv)
/* load the soundfonts (check that all non options are SoundFont or MIDI files) */
for(i = arg1; i < argc; i++)
{
if(fluid_is_soundfont(argv[i]))
if(fluid_is_soundfont(argv[i])
derselbst marked this conversation as resolved.
Show resolved Hide resolved
|| is_dls(argv[i])
)
{
if(fluid_synth_sfload(synth, argv[i], 1) == -1)
{
Expand Down
4 changes: 2 additions & 2 deletions src/sfloader/fluid_defsfont.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ fluid_sfont_t *fluid_defsfloader_load(fluid_sfloader_t *loader, const char *file

if(fluid_defsfont_load(defsfont, &loader->file_callbacks, filename) == FLUID_FAILED)
{
fluid_sfont_delete_internal(sfont);
fluid_defsfont_sfont_delete(sfont);
return NULL;
}

Expand Down Expand Up @@ -425,7 +425,7 @@ int fluid_defsfont_load(fluid_defsfont_t *defsfont, const fluid_file_callbacks_t

if(sfdata == NULL)
{
FLUID_LOG(FLUID_ERR, "Couldn't load soundfont file");
/* error message already printed */
return FLUID_FAILED;
}

Expand Down
Loading