mirror of
https://github.com/ZDoom/fluidsynth.git
synced 2025-04-19 06:02:03 +00:00
Cleanup settings callback signatures to avoid error hiding casts
Removes the need to cast the callback functions when registering them. Also makes the needed cast from (void *) to (fluid_synth_t *) explicit in the callback handlers.
This commit is contained in:
parent
1b5cf26000
commit
750ffc003b
1 changed files with 28 additions and 25 deletions
|
@ -43,10 +43,8 @@ static int fluid_synth_noteon_LOCAL(fluid_synth_t* synth, int chan, int key,
|
|||
int vel);
|
||||
static int fluid_synth_noteoff_LOCAL(fluid_synth_t* synth, int chan, int key);
|
||||
static int fluid_synth_cc_LOCAL(fluid_synth_t* synth, int channum, int num);
|
||||
static void fluid_synth_update_device_id (fluid_synth_t *synth, char *name,
|
||||
int value);
|
||||
static void fluid_synth_update_overflow (fluid_synth_t *synth, char *name,
|
||||
fluid_real_t value);
|
||||
static void fluid_synth_update_device_id (void *data, const char *name, int value);
|
||||
static void fluid_synth_update_overflow (void *data, const char *name, double value);
|
||||
static int fluid_synth_sysex_midi_tuning (fluid_synth_t *synth, const char *data,
|
||||
int len, char *response,
|
||||
int *response_len, int avail_response,
|
||||
|
@ -71,13 +69,10 @@ fluid_synth_get_preset_by_sfont_name(fluid_synth_t* synth, const char *sfontname
|
|||
unsigned int banknum, unsigned int prognum);
|
||||
|
||||
static void fluid_synth_update_presets(fluid_synth_t* synth);
|
||||
static void fluid_synth_update_sample_rate(fluid_synth_t* synth,
|
||||
char* name, double value);
|
||||
static void fluid_synth_update_gain(fluid_synth_t* synth,
|
||||
char* name, double value);
|
||||
static void fluid_synth_update_sample_rate(void *data, const char* name, double value);
|
||||
static void fluid_synth_update_gain(void *data, const char* name, double value);
|
||||
static void fluid_synth_update_gain_LOCAL(fluid_synth_t* synth);
|
||||
static void fluid_synth_update_polyphony(fluid_synth_t* synth,
|
||||
char* name, int value);
|
||||
static void fluid_synth_update_polyphony(void *data, const char* name, int value);
|
||||
static int fluid_synth_update_polyphony_LOCAL(fluid_synth_t* synth, int new_polyphony);
|
||||
static void init_dither(void);
|
||||
static FLUID_INLINE int roundi (float x);
|
||||
|
@ -583,23 +578,23 @@ new_fluid_synth(fluid_settings_t *settings)
|
|||
|
||||
/* register the callbacks */
|
||||
fluid_settings_callback_num(settings, "synth.sample-rate",
|
||||
(fluid_num_update_t) fluid_synth_update_sample_rate, synth);
|
||||
fluid_synth_update_sample_rate, synth);
|
||||
fluid_settings_callback_num(settings, "synth.gain",
|
||||
(fluid_num_update_t) fluid_synth_update_gain, synth);
|
||||
fluid_synth_update_gain, synth);
|
||||
fluid_settings_callback_int(settings, "synth.polyphony",
|
||||
(fluid_int_update_t) fluid_synth_update_polyphony, synth);
|
||||
fluid_synth_update_polyphony, synth);
|
||||
fluid_settings_callback_int(settings, "synth.device-id",
|
||||
(fluid_int_update_t) fluid_synth_update_device_id, synth);
|
||||
fluid_synth_update_device_id, synth);
|
||||
fluid_settings_callback_num(settings, "synth.overflow.percussion",
|
||||
(fluid_num_update_t) fluid_synth_update_overflow, synth);
|
||||
fluid_synth_update_overflow, synth);
|
||||
fluid_settings_callback_num(settings, "synth.overflow.sustained",
|
||||
(fluid_num_update_t) fluid_synth_update_overflow, synth);
|
||||
fluid_synth_update_overflow, synth);
|
||||
fluid_settings_callback_num(settings, "synth.overflow.released",
|
||||
(fluid_num_update_t) fluid_synth_update_overflow, synth);
|
||||
fluid_synth_update_overflow, synth);
|
||||
fluid_settings_callback_num(settings, "synth.overflow.age",
|
||||
(fluid_num_update_t) fluid_synth_update_overflow, synth);
|
||||
fluid_synth_update_overflow, synth);
|
||||
fluid_settings_callback_num(settings, "synth.overflow.volume",
|
||||
(fluid_num_update_t) fluid_synth_update_overflow, synth);
|
||||
fluid_synth_update_overflow, synth);
|
||||
|
||||
/* do some basic sanity checking on the settings */
|
||||
|
||||
|
@ -1332,8 +1327,11 @@ fluid_synth_get_cc(fluid_synth_t* synth, int chan, int num, int* pval)
|
|||
* Handler for synth.device-id setting.
|
||||
*/
|
||||
static void
|
||||
fluid_synth_update_device_id (fluid_synth_t *synth, char *name, int value)
|
||||
fluid_synth_update_device_id (void *data, const char *name, int value)
|
||||
{
|
||||
fluid_synth_t *synth = (fluid_synth_t *)data;
|
||||
fluid_return_if_fail(synth != NULL);
|
||||
|
||||
fluid_synth_api_enter(synth);
|
||||
synth->device_id = value;
|
||||
fluid_synth_api_exit(synth);
|
||||
|
@ -2345,8 +2343,9 @@ fluid_synth_update_presets(fluid_synth_t* synth)
|
|||
|
||||
/* Handler for synth.sample-rate setting. */
|
||||
static void
|
||||
fluid_synth_update_sample_rate(fluid_synth_t* synth, char* name, double value)
|
||||
fluid_synth_update_sample_rate(void *data, const char* name, double value)
|
||||
{
|
||||
fluid_synth_t *synth = (fluid_synth_t *)data;
|
||||
fluid_synth_set_sample_rate(synth, (float) value);
|
||||
}
|
||||
|
||||
|
@ -2380,8 +2379,9 @@ fluid_synth_set_sample_rate(fluid_synth_t* synth, float sample_rate)
|
|||
|
||||
/* Handler for synth.gain setting. */
|
||||
static void
|
||||
fluid_synth_update_gain(fluid_synth_t* synth, char* name, double value)
|
||||
fluid_synth_update_gain(void *data, const char* name, double value)
|
||||
{
|
||||
fluid_synth_t *synth = (fluid_synth_t *)data;
|
||||
fluid_synth_set_gain(synth, (float) value);
|
||||
}
|
||||
|
||||
|
@ -2440,8 +2440,9 @@ fluid_synth_get_gain(fluid_synth_t* synth)
|
|||
* Handler for synth.polyphony setting.
|
||||
*/
|
||||
static void
|
||||
fluid_synth_update_polyphony(fluid_synth_t* synth, char* name, int value)
|
||||
fluid_synth_update_polyphony(void *data, const char* name, int value)
|
||||
{
|
||||
fluid_synth_t *synth = (fluid_synth_t *)data;
|
||||
fluid_synth_set_polyphony(synth, value);
|
||||
}
|
||||
|
||||
|
@ -3125,10 +3126,12 @@ fluid_synth_render_blocks(fluid_synth_t* synth, int blockcount)
|
|||
}
|
||||
|
||||
|
||||
static void fluid_synth_update_overflow (fluid_synth_t *synth, char *name,
|
||||
fluid_real_t value)
|
||||
static void fluid_synth_update_overflow (void *data, const char *name, double value)
|
||||
{
|
||||
double d;
|
||||
fluid_synth_t *synth = (fluid_synth_t *)data;
|
||||
fluid_return_if_fail(synth != NULL);
|
||||
|
||||
fluid_synth_api_enter(synth);
|
||||
|
||||
fluid_settings_getnum(synth->settings, "synth.overflow.percussion", &d);
|
||||
|
|
Loading…
Reference in a new issue