diff --git a/include/fluidsynth/sfont.h b/include/fluidsynth/sfont.h index 2485c0c6..658ef8fd 100644 --- a/include/fluidsynth/sfont.h +++ b/include/fluidsynth/sfont.h @@ -291,7 +291,7 @@ FLUIDSYNTH_API void* fluid_preset_get_data(fluid_preset_t* preset); FLUIDSYNTH_API const char* fluid_preset_get_name(fluid_preset_t* preset); FLUIDSYNTH_API int fluid_preset_get_banknum(fluid_preset_t* preset); FLUIDSYNTH_API int fluid_preset_get_num(fluid_preset_t* preset); - +FLUIDSYNTH_API fluid_sfont_t* fluid_preset_get_sfont(fluid_preset_t* preset); FLUIDSYNTH_API fluid_sample_t* new_fluid_sample(void); FLUIDSYNTH_API void delete_fluid_sample(fluid_sample_t* sample); diff --git a/src/sfloader/fluid_sfont.c b/src/sfloader/fluid_sfont.c index f3afed59..5159d11f 100644 --- a/src/sfloader/fluid_sfont.c +++ b/src/sfloader/fluid_sfont.c @@ -431,6 +431,17 @@ int fluid_preset_get_num(fluid_preset_t* preset) return preset->get_num(preset); } +/** + * Retrieves the presets parent SoundFont instance. + * + * @param preset The SoundFont preset instance. + * @return The parent SoundFont of \p preset. + */ +fluid_sfont_t* fluid_preset_get_sfont(fluid_preset_t* preset) +{ + return preset->sfont; +} + /** * Destroys a SoundFont preset instance created with new_fluid_preset(). *