Skip to content

Commit

Permalink
Minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Oct 18, 2017
1 parent d1f62e3 commit 453c94f
Showing 1 changed file with 22 additions and 20 deletions.
42 changes: 22 additions & 20 deletions music_fluidsynth.c
Expand Up @@ -61,11 +61,11 @@ static fluidsynth_loader fluidsynth = {
};

#ifdef FLUIDSYNTH_DYNAMIC
#define FLUIDSYNTH_LOADER(FUNC, SIG) \
#define FUNCTION_LOADER(FUNC, SIG) \
fluidsynth.FUNC = (SIG) SDL_LoadFunction(fluidsynth.handle, #FUNC); \
if (fluidsynth.FUNC == NULL) { SDL_UnloadObject(fluidsynth.handle); return -1; }
#else
#define FLUIDSYNTH_LOADER(FUNC, SIG) \
#define FUNCTION_LOADER(FUNC, SIG) \
fluidsynth.FUNC = FUNC;
#endif

Expand All @@ -74,26 +74,28 @@ static int FLUIDSYNTH_Load()
if (fluidsynth.loaded == 0) {
#ifdef FLUIDSYNTH_DYNAMIC
fluidsynth.handle = SDL_LoadObject(FLUIDSYNTH_DYNAMIC);
if (fluidsynth.handle == NULL) return -1;
if (fluidsynth.handle == NULL) {
return -1;
}
#endif

FLUIDSYNTH_LOADER(delete_fluid_player, int (*)(fluid_player_t*));
FLUIDSYNTH_LOADER(delete_fluid_settings, void (*)(fluid_settings_t*));
FLUIDSYNTH_LOADER(delete_fluid_synth, int (*)(fluid_synth_t*));
FLUIDSYNTH_LOADER(fluid_player_add, int (*)(fluid_player_t*, const char*));
FLUIDSYNTH_LOADER(fluid_player_add_mem, int (*)(fluid_player_t*, const void*, size_t));
FLUIDSYNTH_LOADER(fluid_player_get_status, int (*)(fluid_player_t*));
FLUIDSYNTH_LOADER(fluid_player_play, int (*)(fluid_player_t*));
FLUIDSYNTH_LOADER(fluid_player_set_loop, int (*)(fluid_player_t*, int));
FLUIDSYNTH_LOADER(fluid_player_stop, int (*)(fluid_player_t*));
FLUIDSYNTH_LOADER(fluid_settings_setnum, int (*)(fluid_settings_t*, const char*, double));
FLUIDSYNTH_LOADER(fluid_synth_get_settings, fluid_settings_t* (*)(fluid_synth_t*));
FLUIDSYNTH_LOADER(fluid_synth_set_gain, void (*)(fluid_synth_t*, float));
FLUIDSYNTH_LOADER(fluid_synth_sfload, int(*)(fluid_synth_t*, const char*, int));
FLUIDSYNTH_LOADER(fluid_synth_write_s16, int(*)(fluid_synth_t*, int, void*, int, int, void*, int, int));
FLUIDSYNTH_LOADER(new_fluid_player, fluid_player_t* (*)(fluid_synth_t*));
FLUIDSYNTH_LOADER(new_fluid_settings, fluid_settings_t* (*)(void));
FLUIDSYNTH_LOADER(new_fluid_synth, fluid_synth_t* (*)(fluid_settings_t*));
FUNCTION_LOADER(delete_fluid_player, int (*)(fluid_player_t*))
FUNCTION_LOADER(delete_fluid_settings, void (*)(fluid_settings_t*))
FUNCTION_LOADER(delete_fluid_synth, int (*)(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*))
FUNCTION_LOADER(fluid_player_play, int (*)(fluid_player_t*))
FUNCTION_LOADER(fluid_player_set_loop, int (*)(fluid_player_t*, int))
FUNCTION_LOADER(fluid_player_stop, int (*)(fluid_player_t*))
FUNCTION_LOADER(fluid_settings_setnum, int (*)(fluid_settings_t*, const char*, double))
FUNCTION_LOADER(fluid_synth_get_settings, fluid_settings_t* (*)(fluid_synth_t*))
FUNCTION_LOADER(fluid_synth_set_gain, void (*)(fluid_synth_t*, float))
FUNCTION_LOADER(fluid_synth_sfload, int(*)(fluid_synth_t*, const char*, int))
FUNCTION_LOADER(fluid_synth_write_s16, int(*)(fluid_synth_t*, int, void*, int, int, void*, int, int))
FUNCTION_LOADER(new_fluid_player, fluid_player_t* (*)(fluid_synth_t*))
FUNCTION_LOADER(new_fluid_settings, fluid_settings_t* (*)(void))
FUNCTION_LOADER(new_fluid_synth, fluid_synth_t* (*)(fluid_settings_t*))
}
++fluidsynth.loaded;

Expand Down

0 comments on commit 453c94f

Please sign in to comment.