Skip to content

Commit

Permalink
implement libinstpatch sfloader
Browse files Browse the repository at this point in the history
addresses #320
  • Loading branch information
derselbst committed Dec 29, 2018
1 parent e6d7fe8 commit 543669c
Show file tree
Hide file tree
Showing 5 changed files with 652 additions and 4 deletions.
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 @@ -122,6 +123,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 )

set ( config_SOURCES ${CMAKE_BINARY_DIR}/config.h )

set ( libfluidsynth_SOURCES
Expand Down Expand Up @@ -260,6 +265,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 @@ -336,6 +342,7 @@ target_link_libraries ( libfluidsynth
${WINDOWS_LIBS}
${MidiShare_LIBS}
${LIBFLUID_LIBS}
${LIBINSTPATCH_LIBRARIES}
)

# ************ CLI program ************
Expand Down
17 changes: 16 additions & 1 deletion src/fluidsynth.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
#define GETOPT_SUPPORT 1
#endif

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

#include "fluidsynth.h"

#include "fluid_lash.h"
Expand Down Expand Up @@ -753,8 +757,19 @@ 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]))
#ifdef LIBINSTPATCH_SUPPORT
IpatchFileHandle *fhandle = NULL;
#endif
if(fluid_is_soundfont(argv[i])
#ifdef LIBINSTPATCH_SUPPORT
|| (fhandle = ipatch_file_identify_open (argv[i], NULL)) != NULL
)
{
ipatch_file_close(fhandle); /* safe when called with NULL */
#else
)
{
#endif
if(fluid_synth_sfload(synth, argv[i], 1) == -1)
{
fprintf(stderr, "Failed to load the SoundFont %s\n", argv[i]);
Expand Down
Loading

0 comments on commit 543669c

Please sign in to comment.