Optimized fluid_midi_drivers[]

This commit is contained in:
carlo-bramini 2017-10-21 12:41:42 +02:00
parent a10662e897
commit 5e0bc7c143
2 changed files with 6 additions and 7 deletions

View file

@ -86,7 +86,7 @@ void fluid_coremidi_driver_settings(fluid_settings_t* settings);
* fluid_mdriver_definition * fluid_mdriver_definition
*/ */
struct fluid_mdriver_definition_t { struct fluid_mdriver_definition_t {
char* name; const char* name;
fluid_midi_driver_t* (*new)(fluid_settings_t* settings, fluid_midi_driver_t* (*new)(fluid_settings_t* settings,
handle_midi_event_func_t event_handler, handle_midi_event_func_t event_handler,
void* event_handler_data); void* event_handler_data);
@ -95,7 +95,7 @@ struct fluid_mdriver_definition_t {
}; };
struct fluid_mdriver_definition_t fluid_midi_drivers[] = { static const struct fluid_mdriver_definition_t fluid_midi_drivers[] = {
#if JACK_SUPPORT #if JACK_SUPPORT
{ "jack", { "jack",
new_fluid_jack_midi_driver, new_fluid_jack_midi_driver,
@ -136,14 +136,13 @@ struct fluid_mdriver_definition_t fluid_midi_drivers[] = {
delete_fluid_coremidi_driver, delete_fluid_coremidi_driver,
fluid_coremidi_driver_settings }, fluid_coremidi_driver_settings },
#endif #endif
{ NULL, NULL, NULL, NULL }
}; };
void fluid_midi_driver_settings(fluid_settings_t* settings) void fluid_midi_driver_settings(fluid_settings_t* settings)
{ {
int i; unsigned int i;
fluid_settings_register_int (settings, "midi.realtime-prio", 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, NULL, NULL);
@ -186,7 +185,7 @@ void fluid_midi_driver_settings(fluid_settings_t* settings)
fluid_settings_add_option(settings, "midi.driver", "coremidi"); fluid_settings_add_option(settings, "midi.driver", "coremidi");
#endif #endif
for (i = 0; fluid_midi_drivers[i].name != NULL; i++) { for (i = 0; i < FLUID_N_ELEMENTS(fluid_midi_drivers); i++) {
if (fluid_midi_drivers[i].settings != NULL) { if (fluid_midi_drivers[i].settings != NULL) {
fluid_midi_drivers[i].settings(settings); fluid_midi_drivers[i].settings(settings);
} }

View file

@ -21,7 +21,7 @@
#ifndef _FLUID_MDRIVER_H #ifndef _FLUID_MDRIVER_H
#define _FLUID_MDRIVER_H #define _FLUID_MDRIVER_H
#include "fluidsynth_priv.h" #include "fluid_sys.h"
void fluid_midi_driver_settings(fluid_settings_t* settings); void fluid_midi_driver_settings(fluid_settings_t* settings);
@ -32,7 +32,7 @@ void fluid_midi_driver_settings(fluid_settings_t* settings);
struct _fluid_midi_driver_t struct _fluid_midi_driver_t
{ {
char* name; const char* name;
handle_midi_event_func_t handler; handle_midi_event_func_t handler;
void* data; void* data;
}; };