add public getters for fluid_preset_t

This commit is contained in:
derselbst 2018-06-02 14:07:53 +02:00
parent 85356d2732
commit 344133a704
3 changed files with 39 additions and 4 deletions

View file

@ -260,6 +260,9 @@ FLUIDSYNTH_API void delete_fluid_preset(fluid_preset_t* preset);
FLUIDSYNTH_API int fluid_preset_set_data(fluid_preset_t* preset, void* data);
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_sample_t* new_fluid_sample(void);

View file

@ -341,6 +341,42 @@ void* fluid_preset_get_data(fluid_preset_t* preset)
return preset->data;
}
/**
* Retrieves the presets name by executing the \p get_name function
* provided on its creation.
*
* @param preset The SoundFont preset instance.
* @return Pointer to a NULL-terminated string containing the presets name.
*/
const char* fluid_preset_get_name(fluid_preset_t* preset)
{
return preset->get_name(preset);
}
/**
* Retrieves the presets bank number by executing the \p get_bank function
* provided on its creation.
*
* @param preset The SoundFont preset instance.
* @return The bank number of \p preset.
*/
int fluid_preset_get_banknum(fluid_preset_t* preset)
{
return preset->get_banknum(preset);
}
/**
* Retrieves the presets (instrument) number by executing the \p get_num function
* provided on its creation.
*
* @param preset The SoundFont preset instance.
* @return The number of \p preset.
*/
int fluid_preset_get_num(fluid_preset_t* preset)
{
return preset->get_num(preset);
}
/**
* Destroys a SoundFont preset instance created with new_fluid_preset().
*

View file

@ -47,10 +47,6 @@ int fluid_sample_sanitize_loop(fluid_sample_t *sample, unsigned int max_end);
#define fluid_preset_delete_internal(_preset) \
{ if ((_preset) && (_preset)->free) { (*(_preset)->free)(_preset); }}
#define fluid_preset_get_name(_preset) (*(_preset)->get_name)(_preset)
#define fluid_preset_get_banknum(_preset) (*(_preset)->get_banknum)(_preset)
#define fluid_preset_get_num(_preset) (*(_preset)->get_num)(_preset)
#define fluid_preset_noteon(_preset,_synth,_ch,_key,_vel) \
(*(_preset)->noteon)(_preset,_synth,_ch,_key,_vel)