Remove callback and data parameters from settings_register_* functions

Callback functions and user data can be set with the previously added
functions. And callbacks are only used in a single place in new_fluid_synth,
all other calls to setttings_register_* set those two params to NULL,
so lets remove them everywhere.
This commit is contained in:
Marcus Weseloh 2017-11-30 19:51:21 +01:00
parent 5cd03e0171
commit 9f579d99f3
18 changed files with 122 additions and 167 deletions

View file

@ -80,8 +80,8 @@ static int fluid_handle_voice_count (void* data, int ac, char **av,
void fluid_shell_settings(fluid_settings_t* settings)
{
fluid_settings_register_str(settings, "shell.prompt", "", 0, NULL, NULL);
fluid_settings_register_int(settings, "shell.port", 9800, 1, 65535, 0, NULL, NULL);
fluid_settings_register_str(settings, "shell.prompt", "", 0);
fluid_settings_register_int(settings, "shell.port", 9800, 1, 65535, 0);
}

View file

@ -113,10 +113,10 @@ fluid_file_renderer_settings (fluid_settings_t* settings)
unsigned int n;
fluid_settings_register_str(settings, "audio.file.name", "fluidsynth.wav",
FLUID_HINT_FILENAME, NULL, NULL);
fluid_settings_register_str(settings, "audio.file.type", "auto", 0, NULL, NULL);
fluid_settings_register_str(settings, "audio.file.format", "s16", 0, NULL, NULL);
fluid_settings_register_str(settings, "audio.file.endian", "auto", 0, NULL, NULL);
FLUID_HINT_FILENAME);
fluid_settings_register_str(settings, "audio.file.type", "auto", 0);
fluid_settings_register_str(settings, "audio.file.format", "s16", 0);
fluid_settings_register_str(settings, "audio.file.endian", "auto", 0);
fluid_settings_add_option (settings, "audio.file.type", "auto");
@ -149,12 +149,12 @@ fluid_file_renderer_settings (fluid_settings_t* settings)
#else
fluid_settings_register_str(settings, "audio.file.name", "fluidsynth.raw", 0, NULL, NULL);
fluid_settings_register_str(settings, "audio.file.type", "raw", 0, NULL, NULL);
fluid_settings_register_str(settings, "audio.file.name", "fluidsynth.raw", 0);
fluid_settings_register_str(settings, "audio.file.type", "raw", 0);
fluid_settings_add_option (settings, "audio.file.type", "raw");
fluid_settings_register_str(settings, "audio.file.format", "s16", 0, NULL, NULL);
fluid_settings_register_str(settings, "audio.file.format", "s16", 0);
fluid_settings_add_option (settings, "audio.file.format", "s16");
fluid_settings_register_str(settings, "audio.file.endian", "cpu", 0, NULL, NULL);
fluid_settings_register_str(settings, "audio.file.endian", "cpu", 0);
fluid_settings_add_option (settings, "audio.file.endian", "cpu");
#endif
}

View file

@ -268,47 +268,47 @@ void fluid_audio_driver_settings(fluid_settings_t* settings)
{
unsigned int i;
fluid_settings_register_str(settings, "audio.sample-format", "16bits", 0, NULL, NULL);
fluid_settings_register_str(settings, "audio.sample-format", "16bits", 0);
fluid_settings_add_option(settings, "audio.sample-format", "16bits");
fluid_settings_add_option(settings, "audio.sample-format", "float");
#if defined(WIN32)
fluid_settings_register_int(settings, "audio.period-size", 512, 64, 8192, 0, NULL, NULL);
fluid_settings_register_int(settings, "audio.periods", 8, 2, 64, 0, NULL, NULL);
fluid_settings_register_int(settings, "audio.period-size", 512, 64, 8192, 0);
fluid_settings_register_int(settings, "audio.periods", 8, 2, 64, 0);
#elif defined(MACOS9)
fluid_settings_register_int(settings, "audio.period-size", 64, 64, 8192, 0, NULL, NULL);
fluid_settings_register_int(settings, "audio.periods", 8, 2, 64, 0, NULL, NULL);
fluid_settings_register_int(settings, "audio.period-size", 64, 64, 8192, 0);
fluid_settings_register_int(settings, "audio.periods", 8, 2, 64, 0);
#else
fluid_settings_register_int(settings, "audio.period-size", 64, 64, 8192, 0, NULL, NULL);
fluid_settings_register_int(settings, "audio.periods", 16, 2, 64, 0, NULL, NULL);
fluid_settings_register_int(settings, "audio.period-size", 64, 64, 8192, 0);
fluid_settings_register_int(settings, "audio.periods", 16, 2, 64, 0);
#endif
fluid_settings_register_int (settings, "audio.realtime-prio",
FLUID_DEFAULT_AUDIO_RT_PRIO, 0, 99, 0, NULL, NULL);
FLUID_DEFAULT_AUDIO_RT_PRIO, 0, 99, 0);
/* Set the default driver */
#if JACK_SUPPORT
fluid_settings_register_str(settings, "audio.driver", "jack", 0, NULL, NULL);
fluid_settings_register_str(settings, "audio.driver", "jack", 0);
#elif ALSA_SUPPORT
fluid_settings_register_str(settings, "audio.driver", "alsa", 0, NULL, NULL);
fluid_settings_register_str(settings, "audio.driver", "alsa", 0);
#elif PULSE_SUPPORT
fluid_settings_register_str(settings, "audio.driver", "pulseaudio", 0, NULL, NULL);
fluid_settings_register_str(settings, "audio.driver", "pulseaudio", 0);
#elif OSS_SUPPORT
fluid_settings_register_str(settings, "audio.driver", "oss", 0, NULL, NULL);
fluid_settings_register_str(settings, "audio.driver", "oss", 0);
#elif COREAUDIO_SUPPORT
fluid_settings_register_str(settings, "audio.driver", "coreaudio", 0, NULL, NULL);
fluid_settings_register_str(settings, "audio.driver", "coreaudio", 0);
#elif DSOUND_SUPPORT
fluid_settings_register_str(settings, "audio.driver", "dsound", 0, NULL, NULL);
fluid_settings_register_str(settings, "audio.driver", "dsound", 0);
#elif SNDMAN_SUPPORT
fluid_settings_register_str(settings, "audio.driver", "sndman", 0, NULL, NULL);
fluid_settings_register_str(settings, "audio.driver", "sndman", 0);
#elif PORTAUDIO_SUPPORT
fluid_settings_register_str(settings, "audio.driver", "portaudio", 0, NULL, NULL);
fluid_settings_register_str(settings, "audio.driver", "portaudio", 0);
#elif DART_SUPPORT
fluid_settings_register_str(settings, "audio.driver", "dart", 0, NULL, NULL);
fluid_settings_register_str(settings, "audio.driver", "dart", 0);
#elif AUFILE_SUPPORT
fluid_settings_register_str(settings, "audio.driver", "file", 0, NULL, NULL);
fluid_settings_register_str(settings, "audio.driver", "file", 0);
#else
fluid_settings_register_str(settings, "audio.driver", "", 0, NULL, NULL);
fluid_settings_register_str(settings, "audio.driver", "", 0);
#endif
/* Add all drivers to the list of options */

View file

@ -151,7 +151,7 @@ static fluid_thread_return_t fluid_alsa_seq_run(void* d);
void fluid_alsa_audio_driver_settings(fluid_settings_t* settings)
{
fluid_settings_register_str(settings, "audio.alsa.device", "default", 0, NULL, NULL);
fluid_settings_register_str(settings, "audio.alsa.device", "default", 0);
}
@ -548,7 +548,7 @@ static fluid_thread_return_t fluid_alsa_audio_run_s16 (void *d)
void fluid_alsa_rawmidi_driver_settings(fluid_settings_t* settings)
{
fluid_settings_register_str(settings, "midi.alsa.device", "default", 0, NULL, NULL);
fluid_settings_register_str(settings, "midi.alsa.device", "default", 0);
}
/*
@ -715,8 +715,8 @@ fluid_alsa_midi_run(void* d)
void fluid_alsa_seq_driver_settings(fluid_settings_t* settings)
{
fluid_settings_register_str(settings, "midi.alsa_seq.device", "default", 0, NULL, NULL);
fluid_settings_register_str(settings, "midi.alsa_seq.id", "pid", 0, NULL, NULL);
fluid_settings_register_str(settings, "midi.alsa_seq.device", "default", 0);
fluid_settings_register_str(settings, "midi.alsa_seq.id", "pid", 0);
}

View file

@ -111,7 +111,7 @@ fluid_core_audio_driver_settings(fluid_settings_t* settings)
pa.mScope = kAudioObjectPropertyScopeWildcard;
pa.mElement = kAudioObjectPropertyElementMaster;
fluid_settings_register_str (settings, "audio.coreaudio.device", "default", 0, NULL, NULL);
fluid_settings_register_str (settings, "audio.coreaudio.device", "default", 0);
fluid_settings_add_option (settings, "audio.coreaudio.device", "default");
if (OK (AudioObjectGetPropertyDataSize (kAudioObjectSystemObject, &pa, 0, 0, &size))) {
int num = size / (int) sizeof (AudioDeviceID);

View file

@ -66,7 +66,7 @@ void fluid_coremidi_callback(const MIDIPacketList *list, void *p, void *src);
void fluid_coremidi_driver_settings(fluid_settings_t* settings)
{
fluid_settings_register_str(settings, "midi.coremidi.id", "pid", 0, NULL, NULL);
fluid_settings_register_str(settings, "midi.coremidi.id", "pid", 0);
}
/*

View file

@ -75,7 +75,7 @@ static LONG APIENTRY fluid_dart_audio_run( ULONG ulStatus, PMCI_MIX_BUFFER pBuff
void fluid_dart_audio_driver_settings(fluid_settings_t* settings)
{
fluid_settings_register_str(settings, "audio.dart.device", "default", 0, NULL, NULL);
fluid_settings_register_str(settings, "audio.dart.device", "default", 0);
}

View file

@ -84,7 +84,7 @@ fluid_dsound_enum_callback2(LPGUID guid, LPCTSTR description, LPCTSTR module, LP
void fluid_dsound_audio_driver_settings(fluid_settings_t* settings)
{
fluid_settings_register_str(settings, "audio.dsound.device", "default", 0, NULL, NULL);
fluid_settings_register_str(settings, "audio.dsound.device", "default", 0);
fluid_settings_add_option(settings, "audio.dsound.device", "default");
DirectSoundEnumerate((LPDSENUMCALLBACK) fluid_dsound_enum_callback, settings);
}

View file

@ -106,10 +106,10 @@ static fluid_jack_client_t *last_client = NULL; /* Last unpaired client. F
void
fluid_jack_audio_driver_settings(fluid_settings_t* settings)
{
fluid_settings_register_str(settings, "audio.jack.id", "fluidsynth", 0, NULL, NULL);
fluid_settings_register_int(settings, "audio.jack.multi", 0, 0, 1, FLUID_HINT_TOGGLED, NULL, NULL);
fluid_settings_register_int(settings, "audio.jack.autoconnect", 0, 0, 1, FLUID_HINT_TOGGLED, NULL, NULL);
fluid_settings_register_str(settings, "audio.jack.server", "", 0, NULL, NULL);
fluid_settings_register_str(settings, "audio.jack.id", "fluidsynth", 0);
fluid_settings_register_int(settings, "audio.jack.multi", 0, 0, 1, FLUID_HINT_TOGGLED);
fluid_settings_register_int(settings, "audio.jack.autoconnect", 0, 0, 1, FLUID_HINT_TOGGLED);
fluid_settings_register_str(settings, "audio.jack.server", "", 0);
}
/*
@ -614,8 +614,8 @@ fluid_jack_driver_shutdown(void *arg)
void fluid_jack_midi_driver_settings (fluid_settings_t *settings)
{
fluid_settings_register_str (settings, "midi.jack.id", "fluidsynth-midi", 0, NULL, NULL);
fluid_settings_register_str (settings, "midi.jack.server", "", 0, NULL, NULL);
fluid_settings_register_str (settings, "midi.jack.id", "fluidsynth-midi", 0);
fluid_settings_register_str (settings, "midi.jack.server", "", 0);
}
/*

View file

@ -144,26 +144,26 @@ void fluid_midi_driver_settings(fluid_settings_t* settings)
{
unsigned int i;
fluid_settings_register_int (settings, "midi.autoconnect", 0, 0, 1, FLUID_HINT_TOGGLED, NULL, NULL);
fluid_settings_register_int (settings, "midi.autoconnect", 0, 0, 1, FLUID_HINT_TOGGLED);
fluid_settings_register_int (settings, "midi.realtime-prio",
FLUID_DEFAULT_MIDI_RT_PRIO, 0, 99, 0, NULL, NULL);
FLUID_DEFAULT_MIDI_RT_PRIO, 0, 99, 0);
/* Set the default driver */
#if ALSA_SUPPORT
fluid_settings_register_str(settings, "midi.driver", "alsa_seq", 0, NULL, NULL);
fluid_settings_register_str(settings, "midi.driver", "alsa_seq", 0);
#elif JACK_SUPPORT
fluid_settings_register_str(settings, "midi.driver", "jack", 0, NULL, NULL);
fluid_settings_register_str(settings, "midi.driver", "jack", 0);
#elif OSS_SUPPORT
fluid_settings_register_str(settings, "midi.driver", "oss", 0, NULL, NULL);
fluid_settings_register_str(settings, "midi.driver", "oss", 0);
#elif WINMIDI_SUPPORT
fluid_settings_register_str(settings, "midi.driver", "winmidi", 0, NULL, NULL);
fluid_settings_register_str(settings, "midi.driver", "winmidi", 0);
#elif MIDISHARE_SUPPORT
fluid_settings_register_str(settings, "midi.driver", "midishare", 0, NULL, NULL);
fluid_settings_register_str(settings, "midi.driver", "midishare", 0);
#elif COREMIDI_SUPPORT
fluid_settings_register_str(settings, "midi.driver", "coremidi", 0, NULL, NULL);
fluid_settings_register_str(settings, "midi.driver", "coremidi", 0);
#else
fluid_settings_register_str(settings, "midi.driver", "", 0, NULL, NULL);
fluid_settings_register_str(settings, "midi.driver", "", 0);
#endif
/* Add all drivers to the list of options */

View file

@ -101,7 +101,7 @@ static fluid_thread_return_t fluid_oss_midi_run(void* d);
void
fluid_oss_audio_driver_settings(fluid_settings_t* settings)
{
fluid_settings_register_str(settings, "audio.oss.device", "/dev/dsp", 0, NULL, NULL);
fluid_settings_register_str(settings, "audio.oss.device", "/dev/dsp", 0);
}
/*
@ -502,7 +502,7 @@ fluid_oss_audio_run2(void* d)
void fluid_oss_midi_driver_settings(fluid_settings_t* settings)
{
fluid_settings_register_str(settings, "midi.oss.device", "/dev/midi", 0, NULL, NULL);
fluid_settings_register_str(settings, "midi.oss.device", "/dev/midi", 0);
}
/*

View file

@ -122,7 +122,7 @@ fluid_portaudio_driver_settings (fluid_settings_t *settings)
PaError err;
int i;
fluid_settings_register_str (settings, "audio.portaudio.device", PORTAUDIO_DEFAULT_DEVICE, 0, NULL, NULL);
fluid_settings_register_str (settings, "audio.portaudio.device", PORTAUDIO_DEFAULT_DEVICE, 0);
fluid_settings_add_option (settings, "audio.portaudio.device", PORTAUDIO_DEFAULT_DEVICE);
err = Pa_Initialize();

View file

@ -63,11 +63,11 @@ static fluid_thread_return_t fluid_pulse_audio_run2(void* d);
void fluid_pulse_audio_driver_settings(fluid_settings_t* settings)
{
fluid_settings_register_str(settings, "audio.pulseaudio.server", "default", 0, NULL, NULL);
fluid_settings_register_str(settings, "audio.pulseaudio.device", "default", 0, NULL, NULL);
fluid_settings_register_str(settings, "audio.pulseaudio.media-role", "music", 0, NULL, NULL);
fluid_settings_register_str(settings, "audio.pulseaudio.server", "default", 0);
fluid_settings_register_str(settings, "audio.pulseaudio.device", "default", 0);
fluid_settings_register_str(settings, "audio.pulseaudio.media-role", "music", 0);
fluid_settings_register_int(settings, "audio.pulseaudio.adjust-latency", 1, 0, 1,
FLUID_HINT_TOGGLED, NULL, NULL);
FLUID_HINT_TOGGLED);
}

View file

@ -86,7 +86,7 @@ void fluid_winmidi_midi_driver_settings(fluid_settings_t* settings)
MMRESULT res;
MIDIINCAPS in_caps;
UINT i, num;
fluid_settings_register_str(settings, "midi.winmidi.device", "default", 0, NULL, NULL);
fluid_settings_register_str(settings, "midi.winmidi.device", "default", 0);
num = midiInGetNumDevs();
if (num > 0) {
fluid_settings_add_option(settings, "midi.winmidi.device", "default");

View file

@ -1293,14 +1293,12 @@ fluid_player_settings(fluid_settings_t *settings)
{
/* player.timing-source can be either "system" (use system timer)
or "sample" (use timer based on number of written samples) */
fluid_settings_register_str(settings, "player.timing-source", "sample", 0,
NULL, NULL);
fluid_settings_register_str(settings, "player.timing-source", "sample", 0);
fluid_settings_add_option(settings, "player.timing-source", "sample");
fluid_settings_add_option(settings, "player.timing-source", "system");
/* Selects whether the player should reset the synth between songs, or not. */
fluid_settings_register_int(settings, "player.reset-synth", 1, 0, 1,
FLUID_HINT_TOGGLED, NULL, NULL);
fluid_settings_register_int(settings, "player.reset-synth", 1, 0, 1, FLUID_HINT_TOGGLED);
}

View file

@ -155,77 +155,47 @@ static const fluid_revmodel_presets_t revmodel_preset[] = {
* INITIALIZATION & UTILITIES
*/
static void fluid_synth_register_overflow(fluid_settings_t* settings,
fluid_num_update_t update_func,
void* update_data)
{
fluid_settings_register_num(settings, "synth.overflow.percussion",
4000, -10000, 10000, 0, update_func, update_data);
fluid_settings_register_num(settings, "synth.overflow.sustained",
-1000, -10000, 10000, 0, update_func, update_data);
fluid_settings_register_num(settings, "synth.overflow.released",
-2000, -10000, 10000, 0, update_func, update_data);
fluid_settings_register_num(settings, "synth.overflow.age",
1000, -10000, 10000, 0, update_func, update_data);
fluid_settings_register_num(settings, "synth.overflow.volume",
500, -10000, 10000, 0, update_func, update_data);
}
void fluid_synth_settings(fluid_settings_t* settings)
{
fluid_settings_register_int(settings, "synth.verbose", 0, 0, 1,
FLUID_HINT_TOGGLED, NULL, NULL);
fluid_settings_register_int(settings, "synth.reverb.active", 1, 0, 1,
FLUID_HINT_TOGGLED, NULL, NULL);
fluid_settings_register_int(settings, "synth.chorus.active", 1, 0, 1,
FLUID_HINT_TOGGLED, NULL, NULL);
fluid_settings_register_int(settings, "synth.ladspa.active", 0, 0, 1,
FLUID_HINT_TOGGLED, NULL, NULL);
fluid_settings_register_int(settings, "synth.lock-memory", 1, 0, 1,
FLUID_HINT_TOGGLED, NULL, NULL);
fluid_settings_register_str(settings, "midi.portname", "", 0, NULL, NULL);
fluid_settings_register_int(settings, "synth.verbose", 0, 0, 1, FLUID_HINT_TOGGLED);
fluid_settings_register_int(settings, "synth.reverb.active", 1, 0, 1, FLUID_HINT_TOGGLED);
fluid_settings_register_int(settings, "synth.chorus.active", 1, 0, 1, FLUID_HINT_TOGGLED);
fluid_settings_register_int(settings, "synth.ladspa.active", 0, 0, 1, FLUID_HINT_TOGGLED);
fluid_settings_register_int(settings, "synth.lock-memory", 1, 0, 1, FLUID_HINT_TOGGLED);
fluid_settings_register_str(settings, "midi.portname", "", 0);
#ifdef DEFAULT_SOUNDFONT
fluid_settings_register_str(settings, "synth.default-soundfont",
DEFAULT_SOUNDFONT, 0, NULL, NULL);
fluid_settings_register_str(settings, "synth.default-soundfont", DEFAULT_SOUNDFONT, 0);
#endif
fluid_settings_register_int(settings, "synth.polyphony",
256, 1, 65535, 0, NULL, NULL);
fluid_settings_register_int(settings, "synth.midi-channels",
16, 16, 256, 0, NULL, NULL);
fluid_settings_register_num(settings, "synth.gain",
0.2f, 0.0f, 10.0f,
0, NULL, NULL);
fluid_settings_register_int(settings, "synth.audio-channels",
1, 1, 128, 0, NULL, NULL);
fluid_settings_register_int(settings, "synth.audio-groups",
1, 1, 128, 0, NULL, NULL);
fluid_settings_register_int(settings, "synth.effects-channels",
2, 2, 2, 0, NULL, NULL);
fluid_settings_register_num(settings, "synth.sample-rate",
44100.0f, 8000.0f, 96000.0f,
0, NULL, NULL);
fluid_settings_register_int(settings, "synth.device-id",
0, 0, 126, 0, NULL, NULL);
fluid_settings_register_int(settings, "synth.cpu-cores", 1, 1, 256, 0, NULL, NULL);
fluid_settings_register_int(settings, "synth.polyphony", 256, 1, 65535, 0);
fluid_settings_register_int(settings, "synth.midi-channels", 16, 16, 256, 0);
fluid_settings_register_num(settings, "synth.gain", 0.2f, 0.0f, 10.0f, 0);
fluid_settings_register_int(settings, "synth.audio-channels", 1, 1, 128, 0);
fluid_settings_register_int(settings, "synth.audio-groups", 1, 1, 128, 0);
fluid_settings_register_int(settings, "synth.effects-channels", 2, 2, 2, 0);
fluid_settings_register_num(settings, "synth.sample-rate", 44100.0f, 8000.0f, 96000.0f, 0);
fluid_settings_register_int(settings, "synth.device-id", 0, 0, 126, 0);
fluid_settings_register_int(settings, "synth.cpu-cores", 1, 1, 256, 0);
fluid_settings_register_int(settings, "synth.min-note-length", 10, 0, 65535, 0, NULL, NULL);
fluid_settings_register_int(settings, "synth.min-note-length", 10, 0, 65535, 0);
fluid_settings_register_int(settings, "synth.threadsafe-api", 1, 0, 1,
FLUID_HINT_TOGGLED, NULL, NULL);
fluid_settings_register_int(settings, "synth.parallel-render", 1, 0, 1,
FLUID_HINT_TOGGLED, NULL, NULL);
fluid_settings_register_int(settings, "synth.threadsafe-api", 1, 0, 1, FLUID_HINT_TOGGLED);
fluid_settings_register_int(settings, "synth.parallel-render", 1, 0, 1, FLUID_HINT_TOGGLED);
fluid_synth_register_overflow(settings, NULL, NULL);
fluid_settings_register_num(settings, "synth.overflow.percussion", 4000, -10000, 10000, 0);
fluid_settings_register_num(settings, "synth.overflow.sustained", -1000, -10000, 10000, 0);
fluid_settings_register_num(settings, "synth.overflow.released", -2000, -10000, 10000, 0);
fluid_settings_register_num(settings, "synth.overflow.age", 1000, -10000, 10000, 0);
fluid_settings_register_num(settings, "synth.overflow.volume", 500, -10000, 10000, 0);
fluid_settings_register_str(settings, "synth.midi-bank-select", "gs", 0, NULL, NULL);
fluid_settings_register_str(settings, "synth.midi-bank-select", "gs", 0);
fluid_settings_add_option(settings, "synth.midi-bank-select", "gm");
fluid_settings_add_option(settings, "synth.midi-bank-select", "gs");
fluid_settings_add_option(settings, "synth.midi-bank-select", "xg");
fluid_settings_add_option(settings, "synth.midi-bank-select", "mma");
fluid_settings_register_str(settings, "synth.volenv", "emu", 0, NULL, NULL);
fluid_settings_register_str(settings, "synth.volenv", "emu", 0);
fluid_settings_add_option(settings, "synth.volenv", "emu");
fluid_settings_add_option(settings, "synth.volenv", "compliant");
}
@ -620,8 +590,15 @@ new_fluid_synth(fluid_settings_t *settings)
(fluid_int_update_t) 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_register_overflow(settings,
fluid_settings_callback_num(settings, "synth.overflow.percussion",
(fluid_num_update_t) fluid_synth_update_overflow, synth);
fluid_settings_callback_num(settings, "synth.overflow.sustained",
(fluid_num_update_t) fluid_synth_update_overflow, synth);
fluid_settings_callback_num(settings, "synth.overflow.released",
(fluid_num_update_t) fluid_synth_update_overflow, synth);
fluid_settings_callback_num(settings, "synth.overflow.age",
(fluid_num_update_t) fluid_synth_update_overflow, synth);
fluid_settings_callback_num(settings, "synth.overflow.volume",
(fluid_num_update_t) fluid_synth_update_overflow, synth);
/* do some basic sanity checking on the settings */

View file

@ -87,7 +87,7 @@ typedef struct {
} fluid_setting_node_t;
static fluid_setting_node_t*
new_fluid_str_setting(const char* value, const char* def, int hints, fluid_str_update_t fun, void* data)
new_fluid_str_setting(const char* value, const char* def, int hints)
{
fluid_setting_node_t* node;
fluid_str_setting_t* str;
@ -101,14 +101,14 @@ new_fluid_str_setting(const char* value, const char* def, int hints, fluid_str_u
}
node->type = FLUID_STR_TYPE;
str = &node->str;
str = &node->str;
str->value = value? FLUID_STRDUP(value) : NULL;
str->def = def? FLUID_STRDUP(def) : NULL;
str->hints = hints;
str->options = NULL;
str->update = fun;
str->data = data;
str->update = NULL;
str->data = NULL;
return node;
}
@ -138,8 +138,7 @@ delete_fluid_str_setting(fluid_setting_node_t* node)
static fluid_setting_node_t*
new_fluid_num_setting(double min, double max, double def,
int hints, fluid_num_update_t fun, void* data)
new_fluid_num_setting(double min, double max, double def, int hints)
{
fluid_setting_node_t* node;
fluid_num_setting_t* num;
@ -153,15 +152,15 @@ new_fluid_num_setting(double min, double max, double def,
}
node->type = FLUID_NUM_TYPE;
num = &node->num;
num = &node->num;
num->value = def;
num->def = def;
num->min = min;
num->max = max;
num->hints = hints;
num->update = fun;
num->data = data;
num->update = NULL;
num->data = NULL;
return node;
}
@ -176,8 +175,7 @@ delete_fluid_num_setting(fluid_setting_node_t* node)
}
static fluid_setting_node_t*
new_fluid_int_setting(int min, int max, int def,
int hints, fluid_int_update_t fun, void* data)
new_fluid_int_setting(int min, int max, int def, int hints)
{
fluid_setting_node_t* node;
fluid_int_setting_t* i;
@ -191,15 +189,15 @@ new_fluid_int_setting(int min, int max, int def,
}
node->type = FLUID_INT_TYPE;
i = &node->i;
i = &node->i;
i->value = def;
i->def = def;
i->min = min;
i->max = max;
i->hints = hints;
i->update = fun;
i->data = data;
i->update = NULL;
i->data = NULL;
return node;
}
@ -471,13 +469,10 @@ fluid_settings_set(fluid_settings_t* settings, const char *name, fluid_setting_n
* @param name the setting's name
* @param def the default value for the setting
* @param hints the hints for the setting
* @param fun an update function for the setting
* @param data user supplied data
* @return #FLUID_OK if the value has been register correctly, #FLUID_FAILED otherwise
*/
int
fluid_settings_register_str(fluid_settings_t* settings, const char* name, const char* def, int hints,
fluid_str_update_t fun, void* data)
fluid_settings_register_str(fluid_settings_t* settings, const char* name, const char* def, int hints)
{
fluid_setting_node_t *node;
int retval = FLUID_FAILED;
@ -489,15 +484,13 @@ fluid_settings_register_str(fluid_settings_t* settings, const char* name, const
fluid_rec_mutex_lock (settings->mutex);
if (fluid_settings_get(settings, name, &node) != FLUID_OK) {
node = new_fluid_str_setting(def, def, hints, fun, data);
node = new_fluid_str_setting(def, def, hints);
retval = fluid_settings_set(settings, name, node);
if (retval != FLUID_OK) delete_fluid_str_setting (node);
} else {
/* if variable already exists, don't change its value. */
if (node->type == FLUID_STR_TYPE) {
fluid_str_setting_t* setting = &node->str;
setting->update = fun;
setting->data = data;
setting->def = def? FLUID_STRDUP(def) : NULL;
setting->hints = hints;
retval = FLUID_OK;
@ -520,14 +513,11 @@ fluid_settings_register_str(fluid_settings_t* settings, const char* name, const
* @param min the smallest allowed value for the setting
* @param max the largest allowed value for the setting
* @param hints the hints for the setting
* @param fun an update function for the setting
* @param data user supplied data
* @return #FLUID_OK if the value has been register correctly, #FLUID_FAILED otherwise
*/
int
fluid_settings_register_num(fluid_settings_t* settings, const char* name, double def,
double min, double max, int hints,
fluid_num_update_t fun, void* data)
double min, double max, int hints)
{
fluid_setting_node_t *node;
int retval = FLUID_FAILED;
@ -543,15 +533,13 @@ fluid_settings_register_num(fluid_settings_t* settings, const char* name, double
if (fluid_settings_get(settings, name, &node) != FLUID_OK) {
/* insert a new setting */
node = new_fluid_num_setting(min, max, def, hints, fun, data);
node = new_fluid_num_setting(min, max, def, hints);
retval = fluid_settings_set(settings, name, node);
if (retval != FLUID_OK) delete_fluid_num_setting (node);
} else {
if (node->type == FLUID_NUM_TYPE) {
/* update the existing setting but don't change its value */
fluid_num_setting_t* setting = &node->num;
setting->update = fun;
setting->data = data;
setting->min = min;
setting->max = max;
setting->def = def;
@ -577,14 +565,11 @@ fluid_settings_register_num(fluid_settings_t* settings, const char* name, double
* @param min the smallest allowed value for the setting
* @param max the largest allowed value for the setting
* @param hints the hints for the setting
* @param fun an update function for the setting
* @param data user supplied data
* @return #FLUID_OK if the value has been register correctly, #FLUID_FAILED otherwise
*/
int
fluid_settings_register_int(fluid_settings_t* settings, const char* name, int def,
int min, int max, int hints,
fluid_int_update_t fun, void* data)
int min, int max, int hints)
{
fluid_setting_node_t *node;
int retval = FLUID_FAILED;
@ -600,15 +585,13 @@ fluid_settings_register_int(fluid_settings_t* settings, const char* name, int de
if (fluid_settings_get(settings, name, &node) != FLUID_OK) {
/* insert a new setting */
node = new_fluid_int_setting(min, max, def, hints, fun, data);
node = new_fluid_int_setting(min, max, def, hints);
retval = fluid_settings_set(settings, name, node);
if (retval != FLUID_OK) delete_fluid_int_setting (node);
} else {
if (node->type == FLUID_INT_TYPE) {
/* update the existing setting but don't change its value */
fluid_int_setting_t* setting = &node->i;
setting->update = fun;
setting->data = data;
setting->min = min;
setting->max = max;
setting->def = def;
@ -890,7 +873,7 @@ fluid_settings_setstr(fluid_settings_t* settings, const char *name, const char *
}
} else {
/* insert a new setting */
node = new_fluid_str_setting(str, NULL, 0, NULL, NULL);
node = new_fluid_str_setting(str, NULL, 0);
retval = fluid_settings_set(settings, name, node);
if (retval != FLUID_OK) delete_fluid_str_setting (node);
}
@ -1221,7 +1204,7 @@ fluid_settings_setnum(fluid_settings_t* settings, const char *name, double val)
}
} else {
/* insert a new setting */
node = new_fluid_num_setting(-1e10, 1e10, 0.0f, 0, NULL, NULL);
node = new_fluid_num_setting(-1e10, 1e10, 0.0f, 0);
node->num.value = val;
retval = fluid_settings_set(settings, name, node);
if (retval != FLUID_OK) delete_fluid_num_setting (node);
@ -1373,7 +1356,7 @@ fluid_settings_setint(fluid_settings_t* settings, const char *name, int val)
}
} else {
/* insert a new setting */
node = new_fluid_int_setting(INT_MIN, INT_MAX, 0, 0, NULL, NULL);
node = new_fluid_int_setting(INT_MIN, INT_MAX, 0, 0);
node->i.value = val;
retval = fluid_settings_set(settings, name, node);
if (retval != FLUID_OK) delete_fluid_int_setting (node);

View file

@ -28,8 +28,7 @@ int fluid_settings_remove_option(fluid_settings_t* settings, const char* name, c
typedef int (*fluid_str_update_t)(void* data, const char* name, const char* value);
int fluid_settings_register_str(fluid_settings_t* settings, const char* name, const char* def, int hints,
fluid_str_update_t fun, void* data);
int fluid_settings_register_str(fluid_settings_t* settings, const char* name, const char* def, int hints);
int fluid_settings_callback_str(fluid_settings_t* settings, const char* name,
fluid_str_update_t fun, void* data);
@ -37,16 +36,14 @@ int fluid_settings_callback_str(fluid_settings_t* settings, const char* name,
typedef int (*fluid_num_update_t)(void* data, const char* name, double value);
int fluid_settings_register_num(fluid_settings_t* settings, const char* name, double def,
double min, double max, int hints,
fluid_num_update_t fun, void* data);
double min, double max, int hints);
int fluid_settings_callback_num(fluid_settings_t* settings, const char* name,
fluid_num_update_t fun, void* data);
typedef int (*fluid_int_update_t)(void* data, const char* name, int value);
int fluid_settings_register_int(fluid_settings_t* settings, const char* name, int def,
int min, int max, int hints,
fluid_int_update_t fun, void* data);
int min, int max, int hints);
int fluid_settings_callback_int(fluid_settings_t* settings, const char* name,
fluid_int_update_t fun, void* data);