Make fluidsynth call ipatch_close() (#644)

This commit is contained in:
jjceresa 2020-05-02 14:31:34 +02:00 committed by GitHub
parent 87a6debba0
commit 8a3eaf9b18
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 2 deletions

View file

@ -49,6 +49,11 @@ void fluid_instpatch_init(void)
ipatch_init();
}
void fluid_instpatch_deinit(void)
{
ipatch_close();
}
static int delete_fluid_instpatch(fluid_instpatch_font_t *pfont);
static const char *fluid_instpatch_sfont_get_name(fluid_sfont_t *sfont);

View file

@ -6,6 +6,7 @@
#include "fluid_settings.h"
void fluid_instpatch_init(void);
void fluid_instpatch_deinit(void);
fluid_sfloader_t *new_fluid_instpatch_loader(fluid_settings_t *settings);
#endif // _FLUID_INSTPATCH_H

View file

@ -463,8 +463,10 @@ fluid_synth_init(void)
fluid_mod_set_dest(&custom_balance_mod, GEN_CUSTOM_BALANCE); /* Destination: stereo balance */
/* Amount: 96 dB of attenuation (on the opposite channel) */
fluid_mod_set_amount(&custom_balance_mod, FLUID_PEAK_ATTENUATION); /* Amount: 960 */
#ifdef LIBINSTPATCH_SUPPORT
/* libinstpatch <= 1.1.4 only supports calling init() once */
#if defined(LIBINSTPATCH_SUPPORT) && \
FLUID_VERSION_CHECK(IPATCH_VERSION_MAJOR,IPATCH_VERSION_MINOR,IPATCH_VERSION_PATCH) <= FLUID_VERSION_CHECK(1,1,4)
/* defer libinstpatch init to fluid_instpatch.c to avoid #include "libinstpatch.h" */
fluid_instpatch_init();
#endif
@ -626,6 +628,12 @@ new_fluid_synth(fluid_settings_t *settings)
FLUID_MEMSET(synth, 0, sizeof(fluid_synth_t));
#if defined(LIBINSTPATCH_SUPPORT) && \
FLUID_VERSION_CHECK(IPATCH_VERSION_MAJOR,IPATCH_VERSION_MINOR,IPATCH_VERSION_PATCH) > FLUID_VERSION_CHECK(1,1,4)
/* defer libinstpatch init to fluid_instpatch.c to avoid #include "libinstpatch.h" */
fluid_instpatch_init();
#endif
fluid_rec_mutex_init(synth->mutex);
fluid_settings_getint(settings, "synth.threadsafe-api", &synth->use_mutex);
synth->public_api_count = 0;
@ -1116,6 +1124,12 @@ delete_fluid_synth(fluid_synth_t *synth)
fluid_rec_mutex_destroy(synth->mutex);
FLUID_FREE(synth);
#if defined(LIBINSTPATCH_SUPPORT) && \
FLUID_VERSION_CHECK(IPATCH_VERSION_MAJOR,IPATCH_VERSION_MINOR,IPATCH_VERSION_PATCH) > FLUID_VERSION_CHECK(1,1,4)
/* defer libinstpatch deinit to fluid_instpatch.c to avoid #include "libinstpatch.h" */
fluid_instpatch_deinit();
#endif
}
/**

View file

@ -170,6 +170,8 @@ typedef gintptr intptr_t;
#define FLUID_INLINE inline
#define FLUID_VERSION_CHECK(major, minor, patch) ((major<<16)|(minor<<8)|(patch))
/* Integer<->pointer conversion */
#define FLUID_POINTER_TO_UINT(x) ((unsigned int)(uintptr_t)(x))
#define FLUID_UINT_TO_POINTER(x) ((void *)(uintptr_t)(x))