mirror of
https://github.com/ZDoom/fluidsynth.git
synced 2025-01-19 07:50:49 +00:00
commit
f3afe61b6a
4 changed files with 117 additions and 185 deletions
|
@ -105,6 +105,10 @@ if ( MIDISHARE_SUPPORT )
|
|||
include_directories ( ${MidiShare_INCLUDE_DIRS} )
|
||||
endif ( MIDISHARE_SUPPORT )
|
||||
|
||||
if ( AUFILE_SUPPORT )
|
||||
set ( fluid_aufile_SOURCES drivers/fluid_aufile.c )
|
||||
endif ( AUFILE_SUPPORT )
|
||||
|
||||
set ( config_SOURCES ${CMAKE_BINARY_DIR}/config.h )
|
||||
|
||||
set ( libfluidsynth_SOURCES
|
||||
|
@ -172,7 +176,6 @@ set ( libfluidsynth_SOURCES
|
|||
drivers/fluid_adriver.h
|
||||
drivers/fluid_mdriver.c
|
||||
drivers/fluid_mdriver.h
|
||||
drivers/fluid_aufile.c
|
||||
bindings/fluid_cmd.c
|
||||
bindings/fluid_cmd.h
|
||||
bindings/fluid_filerenderer.c
|
||||
|
@ -229,6 +232,7 @@ endif ( WIN32 AND NOT MINGW )
|
|||
add_library ( libfluidsynth-OBJ OBJECT
|
||||
${config_SOURCES}
|
||||
${fluid_alsa_SOURCES}
|
||||
${fluid_aufile_SOURCES}
|
||||
${fluid_coreaudio_SOURCES}
|
||||
${fluid_coremidi_SOURCES}
|
||||
${fluid_dart_SOURCES}
|
||||
|
|
|
@ -59,16 +59,6 @@ static const fluid_audriver_definition_t fluid_audio_drivers[] =
|
|||
},
|
||||
#endif
|
||||
|
||||
#if OSS_SUPPORT
|
||||
{
|
||||
"oss",
|
||||
new_fluid_oss_audio_driver,
|
||||
new_fluid_oss_audio_driver2,
|
||||
delete_fluid_oss_audio_driver,
|
||||
fluid_oss_audio_driver_settings
|
||||
},
|
||||
#endif
|
||||
|
||||
#if PULSE_SUPPORT
|
||||
{
|
||||
"pulseaudio",
|
||||
|
@ -79,6 +69,16 @@ static const fluid_audriver_definition_t fluid_audio_drivers[] =
|
|||
},
|
||||
#endif
|
||||
|
||||
#if OSS_SUPPORT
|
||||
{
|
||||
"oss",
|
||||
new_fluid_oss_audio_driver,
|
||||
new_fluid_oss_audio_driver2,
|
||||
delete_fluid_oss_audio_driver,
|
||||
fluid_oss_audio_driver_settings
|
||||
},
|
||||
#endif
|
||||
|
||||
#if COREAUDIO_SUPPORT
|
||||
{
|
||||
"coreaudio",
|
||||
|
@ -99,16 +99,6 @@ static const fluid_audriver_definition_t fluid_audio_drivers[] =
|
|||
},
|
||||
#endif
|
||||
|
||||
#if PORTAUDIO_SUPPORT
|
||||
{
|
||||
"portaudio",
|
||||
new_fluid_portaudio_driver,
|
||||
NULL,
|
||||
delete_fluid_portaudio_driver,
|
||||
fluid_portaudio_driver_settings
|
||||
},
|
||||
#endif
|
||||
|
||||
#if SNDMAN_SUPPORT
|
||||
{
|
||||
"sndman",
|
||||
|
@ -119,6 +109,16 @@ static const fluid_audriver_definition_t fluid_audio_drivers[] =
|
|||
},
|
||||
#endif
|
||||
|
||||
#if PORTAUDIO_SUPPORT
|
||||
{
|
||||
"portaudio",
|
||||
new_fluid_portaudio_driver,
|
||||
NULL,
|
||||
delete_fluid_portaudio_driver,
|
||||
fluid_portaudio_driver_settings
|
||||
},
|
||||
#endif
|
||||
|
||||
#if DART_SUPPORT
|
||||
{
|
||||
"dart",
|
||||
|
@ -138,6 +138,8 @@ static const fluid_audriver_definition_t fluid_audio_drivers[] =
|
|||
NULL
|
||||
},
|
||||
#endif
|
||||
/* NULL terminator to avoid zero size array if no driver available */
|
||||
{ NULL, NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
#define ENABLE_AUDIO_DRIVER(_drv, _idx) \
|
||||
|
@ -151,6 +153,7 @@ static uint8_t fluid_adriver_disable_mask[(FLUID_N_ELEMENTS(fluid_audio_drivers)
|
|||
void fluid_audio_driver_settings(fluid_settings_t *settings)
|
||||
{
|
||||
unsigned int i;
|
||||
const char *def_name = NULL;
|
||||
|
||||
fluid_settings_register_str(settings, "audio.sample-format", "16bits", 0);
|
||||
fluid_settings_add_option(settings, "audio.sample-format", "16bits");
|
||||
|
@ -169,72 +172,32 @@ void fluid_audio_driver_settings(fluid_settings_t *settings)
|
|||
|
||||
fluid_settings_register_int(settings, "audio.realtime-prio",
|
||||
FLUID_DEFAULT_AUDIO_RT_PRIO, 0, 99, 0);
|
||||
|
||||
/* Set the default driver */
|
||||
#if JACK_SUPPORT
|
||||
fluid_settings_register_str(settings, "audio.driver", "jack", 0);
|
||||
#elif ALSA_SUPPORT
|
||||
fluid_settings_register_str(settings, "audio.driver", "alsa", 0);
|
||||
#elif PULSE_SUPPORT
|
||||
fluid_settings_register_str(settings, "audio.driver", "pulseaudio", 0);
|
||||
#elif OSS_SUPPORT
|
||||
fluid_settings_register_str(settings, "audio.driver", "oss", 0);
|
||||
#elif COREAUDIO_SUPPORT
|
||||
fluid_settings_register_str(settings, "audio.driver", "coreaudio", 0);
|
||||
#elif DSOUND_SUPPORT
|
||||
fluid_settings_register_str(settings, "audio.driver", "dsound", 0);
|
||||
#elif SNDMAN_SUPPORT
|
||||
fluid_settings_register_str(settings, "audio.driver", "sndman", 0);
|
||||
#elif PORTAUDIO_SUPPORT
|
||||
fluid_settings_register_str(settings, "audio.driver", "portaudio", 0);
|
||||
#elif DART_SUPPORT
|
||||
fluid_settings_register_str(settings, "audio.driver", "dart", 0);
|
||||
#elif AUFILE_SUPPORT
|
||||
fluid_settings_register_str(settings, "audio.driver", "file", 0);
|
||||
#else
|
||||
|
||||
fluid_settings_register_str(settings, "audio.driver", "", 0);
|
||||
#endif
|
||||
|
||||
/* Add all drivers to the list of options */
|
||||
#if PULSE_SUPPORT
|
||||
fluid_settings_add_option(settings, "audio.driver", "pulseaudio");
|
||||
#endif
|
||||
#if ALSA_SUPPORT
|
||||
fluid_settings_add_option(settings, "audio.driver", "alsa");
|
||||
#endif
|
||||
#if OSS_SUPPORT
|
||||
fluid_settings_add_option(settings, "audio.driver", "oss");
|
||||
#endif
|
||||
#if COREAUDIO_SUPPORT
|
||||
fluid_settings_add_option(settings, "audio.driver", "coreaudio");
|
||||
#endif
|
||||
#if DSOUND_SUPPORT
|
||||
fluid_settings_add_option(settings, "audio.driver", "dsound");
|
||||
#endif
|
||||
#if SNDMAN_SUPPORT
|
||||
fluid_settings_add_option(settings, "audio.driver", "sndman");
|
||||
#endif
|
||||
#if PORTAUDIO_SUPPORT
|
||||
fluid_settings_add_option(settings, "audio.driver", "portaudio");
|
||||
#endif
|
||||
#if JACK_SUPPORT
|
||||
fluid_settings_add_option(settings, "audio.driver", "jack");
|
||||
#endif
|
||||
#if DART_SUPPORT
|
||||
fluid_settings_add_option(settings, "audio.driver", "dart");
|
||||
#endif
|
||||
#if AUFILE_SUPPORT
|
||||
fluid_settings_add_option(settings, "audio.driver", "file");
|
||||
#endif
|
||||
|
||||
for(i = 0; i < FLUID_N_ELEMENTS(fluid_audio_drivers); i++)
|
||||
for(i = 0; i < FLUID_N_ELEMENTS(fluid_audio_drivers) - 1; i++)
|
||||
{
|
||||
/* Select the default driver */
|
||||
if (def_name == NULL)
|
||||
{
|
||||
def_name = fluid_audio_drivers[i].name;
|
||||
}
|
||||
|
||||
/* Add the driver to the list of options */
|
||||
fluid_settings_add_option(settings, "audio.driver", fluid_audio_drivers[i].name);
|
||||
|
||||
if(fluid_audio_drivers[i].settings != NULL &&
|
||||
IS_AUDIO_DRIVER_ENABLED(fluid_adriver_disable_mask, i))
|
||||
{
|
||||
fluid_audio_drivers[i].settings(settings);
|
||||
}
|
||||
}
|
||||
|
||||
/* Set the default driver, if any */
|
||||
if(def_name != NULL)
|
||||
{
|
||||
fluid_settings_setstr(settings, "audio.driver", def_name);
|
||||
}
|
||||
}
|
||||
|
||||
static const fluid_audriver_definition_t *
|
||||
|
@ -244,7 +207,7 @@ find_fluid_audio_driver(fluid_settings_t *settings)
|
|||
char *name;
|
||||
char *allnames;
|
||||
|
||||
for(i = 0; i < FLUID_N_ELEMENTS(fluid_audio_drivers); i++)
|
||||
for(i = 0; i < FLUID_N_ELEMENTS(fluid_audio_drivers) - 1; i++)
|
||||
{
|
||||
/* If this driver is de-activated, just ignore it */
|
||||
if(!IS_AUDIO_DRIVER_ENABLED(fluid_adriver_disable_mask, i))
|
||||
|
@ -259,21 +222,25 @@ find_fluid_audio_driver(fluid_settings_t *settings)
|
|||
}
|
||||
}
|
||||
|
||||
allnames = fluid_settings_option_concat(settings, "audio.driver", NULL);
|
||||
fluid_settings_dupstr(settings, "audio.driver", &name); /* ++ alloc name */
|
||||
FLUID_LOG(FLUID_ERR, "Couldn't find the requested audio driver %s. Valid drivers are: %s.",
|
||||
name ? name : "NULL", allnames ? allnames : "ERROR");
|
||||
|
||||
if(name)
|
||||
FLUID_LOG(FLUID_ERR, "Couldn't find the requested audio driver '%s'.", name ? name : "NULL");
|
||||
|
||||
allnames = fluid_settings_option_concat(settings, "audio.driver", NULL);
|
||||
if(allnames != NULL)
|
||||
{
|
||||
FLUID_FREE(name);
|
||||
if(allnames[0] != '\0')
|
||||
{
|
||||
FLUID_LOG(FLUID_INFO, "Valid drivers are: %s", allnames);
|
||||
}
|
||||
else
|
||||
{
|
||||
FLUID_LOG(FLUID_INFO, "No audio drivers available.");
|
||||
}
|
||||
}
|
||||
|
||||
if(allnames)
|
||||
{
|
||||
FLUID_FREE(allnames);
|
||||
}
|
||||
|
||||
|
||||
FLUID_FREE(name);
|
||||
FLUID_FREE(allnames);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -363,7 +330,7 @@ delete_fluid_audio_driver(fluid_audio_driver_t *driver)
|
|||
fluid_return_if_fail(driver != NULL);
|
||||
|
||||
/* iterate over fluid_audio_drivers_template to ensure deleting even drivers currently not registered */
|
||||
for(i = 0; i < FLUID_N_ELEMENTS(fluid_audio_drivers); i++)
|
||||
for(i = 0; i < FLUID_N_ELEMENTS(fluid_audio_drivers) - 1; i++)
|
||||
{
|
||||
if(fluid_audio_drivers[i].name == driver->name)
|
||||
{
|
||||
|
@ -417,8 +384,8 @@ int fluid_audio_driver_register(const char **adrivers)
|
|||
{
|
||||
unsigned int j;
|
||||
|
||||
/* search the requested audio driver in the template and copy it over if found */
|
||||
for(j = 0; j < FLUID_N_ELEMENTS(fluid_audio_drivers); j++)
|
||||
/* search the requested audio driver in the template and enable it if found */
|
||||
for(j = 0; j < FLUID_N_ELEMENTS(fluid_audio_drivers) - 1; j++)
|
||||
{
|
||||
if(FLUID_STRCMP(adrivers[i], fluid_audio_drivers[j].name) == 0)
|
||||
{
|
||||
|
@ -427,19 +394,13 @@ int fluid_audio_driver_register(const char **adrivers)
|
|||
}
|
||||
}
|
||||
|
||||
if(j >= FLUID_N_ELEMENTS(fluid_audio_drivers))
|
||||
if(j >= FLUID_N_ELEMENTS(fluid_audio_drivers) - 1)
|
||||
{
|
||||
/* requested driver not found, failure */
|
||||
return FLUID_FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
if(i >= FLUID_N_ELEMENTS(fluid_audio_drivers))
|
||||
{
|
||||
/* user requested more drivers than this build of fluidsynth supports, failure */
|
||||
return FLUID_FAILED;
|
||||
}
|
||||
|
||||
/* Update list of activated drivers */
|
||||
FLUID_MEMCPY(fluid_adriver_disable_mask, disable_mask, sizeof(disable_mask));
|
||||
|
||||
|
|
|
@ -21,16 +21,6 @@
|
|||
#include "fluid_mdriver.h"
|
||||
#include "fluid_settings.h"
|
||||
|
||||
#undef FLUID_MIDI_SUPPORT
|
||||
|
||||
#if ALSA_SUPPORT || JACK_SUPPORT || OSS_SUPPORT || \
|
||||
WINMIDI_SUPPORT || MIDISHARE_SUPPORT || COREMIDI_SUPPORT
|
||||
/* At least an input driver exits */
|
||||
#define FLUID_MIDI_SUPPORT 1
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef FLUID_MIDI_SUPPORT
|
||||
|
||||
/*
|
||||
* fluid_mdriver_definition
|
||||
|
@ -48,6 +38,20 @@ struct fluid_mdriver_definition_t
|
|||
|
||||
static const struct fluid_mdriver_definition_t fluid_midi_drivers[] =
|
||||
{
|
||||
#if ALSA_SUPPORT
|
||||
{
|
||||
"alsa_seq",
|
||||
new_fluid_alsa_seq_driver,
|
||||
delete_fluid_alsa_seq_driver,
|
||||
fluid_alsa_seq_driver_settings
|
||||
},
|
||||
{
|
||||
"alsa_raw",
|
||||
new_fluid_alsa_rawmidi_driver,
|
||||
delete_fluid_alsa_rawmidi_driver,
|
||||
fluid_alsa_rawmidi_driver_settings
|
||||
},
|
||||
#endif
|
||||
#if JACK_SUPPORT
|
||||
{
|
||||
"jack",
|
||||
|
@ -64,20 +68,6 @@ static const struct fluid_mdriver_definition_t fluid_midi_drivers[] =
|
|||
fluid_oss_midi_driver_settings
|
||||
},
|
||||
#endif
|
||||
#if ALSA_SUPPORT
|
||||
{
|
||||
"alsa_raw",
|
||||
new_fluid_alsa_rawmidi_driver,
|
||||
delete_fluid_alsa_rawmidi_driver,
|
||||
fluid_alsa_rawmidi_driver_settings
|
||||
},
|
||||
{
|
||||
"alsa_seq",
|
||||
new_fluid_alsa_seq_driver,
|
||||
delete_fluid_alsa_seq_driver,
|
||||
fluid_alsa_seq_driver_settings
|
||||
},
|
||||
#endif
|
||||
#if WINMIDI_SUPPORT
|
||||
{
|
||||
"winmidi",
|
||||
|
@ -102,70 +92,45 @@ static const struct fluid_mdriver_definition_t fluid_midi_drivers[] =
|
|||
fluid_coremidi_driver_settings
|
||||
},
|
||||
#endif
|
||||
/* NULL terminator to avoid zero size array if no driver available */
|
||||
{ NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
#endif /* FLUID_MIDI_SUPPORT */
|
||||
|
||||
void fluid_midi_driver_settings(fluid_settings_t *settings)
|
||||
{
|
||||
#ifdef FLUID_MIDI_SUPPORT
|
||||
unsigned int i;
|
||||
#endif
|
||||
const char *def_name = 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);
|
||||
|
||||
/* Set the default driver */
|
||||
#if ALSA_SUPPORT
|
||||
fluid_settings_register_str(settings, "midi.driver", "alsa_seq", 0);
|
||||
#elif JACK_SUPPORT
|
||||
fluid_settings_register_str(settings, "midi.driver", "jack", 0);
|
||||
#elif OSS_SUPPORT
|
||||
fluid_settings_register_str(settings, "midi.driver", "oss", 0);
|
||||
#elif WINMIDI_SUPPORT
|
||||
fluid_settings_register_str(settings, "midi.driver", "winmidi", 0);
|
||||
#elif MIDISHARE_SUPPORT
|
||||
fluid_settings_register_str(settings, "midi.driver", "midishare", 0);
|
||||
#elif COREMIDI_SUPPORT
|
||||
fluid_settings_register_str(settings, "midi.driver", "coremidi", 0);
|
||||
#else
|
||||
|
||||
fluid_settings_register_str(settings, "midi.driver", "", 0);
|
||||
#endif
|
||||
|
||||
/* Add all drivers to the list of options */
|
||||
#if ALSA_SUPPORT
|
||||
fluid_settings_add_option(settings, "midi.driver", "alsa_seq");
|
||||
fluid_settings_add_option(settings, "midi.driver", "alsa_raw");
|
||||
#endif
|
||||
#if JACK_SUPPORT
|
||||
fluid_settings_add_option(settings, "midi.driver", "jack");
|
||||
#endif
|
||||
#if OSS_SUPPORT
|
||||
fluid_settings_add_option(settings, "midi.driver", "oss");
|
||||
#endif
|
||||
#if WINMIDI_SUPPORT
|
||||
fluid_settings_add_option(settings, "midi.driver", "winmidi");
|
||||
#endif
|
||||
#if MIDISHARE_SUPPORT
|
||||
fluid_settings_add_option(settings, "midi.driver", "midishare");
|
||||
#endif
|
||||
#if COREMIDI_SUPPORT
|
||||
fluid_settings_add_option(settings, "midi.driver", "coremidi");
|
||||
#endif
|
||||
|
||||
#ifdef FLUID_MIDI_SUPPORT
|
||||
|
||||
for(i = 0; i < FLUID_N_ELEMENTS(fluid_midi_drivers); i++)
|
||||
for(i = 0; i < FLUID_N_ELEMENTS(fluid_midi_drivers) - 1; i++)
|
||||
{
|
||||
/* Select the default driver */
|
||||
if (def_name == NULL)
|
||||
{
|
||||
def_name = fluid_midi_drivers[i].name;
|
||||
}
|
||||
|
||||
/* Add the driver to the list of options */
|
||||
fluid_settings_add_option(settings, "midi.driver", fluid_midi_drivers[i].name);
|
||||
|
||||
if(fluid_midi_drivers[i].settings != NULL)
|
||||
{
|
||||
fluid_midi_drivers[i].settings(settings);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
/* Set the default driver, if any */
|
||||
if(def_name != NULL)
|
||||
{
|
||||
fluid_settings_setstr(settings, "midi.driver", def_name);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -178,37 +143,43 @@ void fluid_midi_driver_settings(fluid_settings_t *settings)
|
|||
*/
|
||||
fluid_midi_driver_t *new_fluid_midi_driver(fluid_settings_t *settings, handle_midi_event_func_t handler, void *event_handler_data)
|
||||
{
|
||||
#ifdef FLUID_MIDI_SUPPORT
|
||||
fluid_midi_driver_t *driver = NULL;
|
||||
char *allnames;
|
||||
unsigned int i;
|
||||
|
||||
for(i = 0; i < FLUID_N_ELEMENTS(fluid_midi_drivers); i++)
|
||||
for(i = 0; i < FLUID_N_ELEMENTS(fluid_midi_drivers) - 1; i++)
|
||||
{
|
||||
if(fluid_settings_str_equal(settings, "midi.driver", fluid_midi_drivers[i].name))
|
||||
const char* name = fluid_midi_drivers[i].name;
|
||||
if(fluid_settings_str_equal(settings, "midi.driver", name))
|
||||
{
|
||||
FLUID_LOG(FLUID_DBG, "Using '%s' midi driver", fluid_midi_drivers[i].name);
|
||||
FLUID_LOG(FLUID_DBG, "Using '%s' midi driver", name);
|
||||
driver = fluid_midi_drivers[i].new(settings, handler, event_handler_data);
|
||||
|
||||
if(driver)
|
||||
{
|
||||
driver->name = fluid_midi_drivers[i].name;
|
||||
driver->name = name;
|
||||
}
|
||||
|
||||
return driver;
|
||||
}
|
||||
}
|
||||
|
||||
FLUID_LOG(FLUID_ERR, "Couldn't find the requested midi driver.");
|
||||
allnames = fluid_settings_option_concat(settings, "midi.driver", NULL);
|
||||
FLUID_LOG(FLUID_ERR, "Couldn't find the requested midi driver. Valid drivers are: %s.",
|
||||
allnames ? allnames : "ERROR");
|
||||
|
||||
if(allnames)
|
||||
if(allnames != NULL)
|
||||
{
|
||||
FLUID_FREE(allnames);
|
||||
if(allnames[0] != '\0')
|
||||
{
|
||||
FLUID_LOG(FLUID_INFO, "Valid drivers are: %s", allnames);
|
||||
}
|
||||
else
|
||||
{
|
||||
FLUID_LOG(FLUID_INFO, "No MIDI drivers available.");
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
FLUID_FREE(allnames);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -218,11 +189,10 @@ fluid_midi_driver_t *new_fluid_midi_driver(fluid_settings_t *settings, handle_mi
|
|||
*/
|
||||
void delete_fluid_midi_driver(fluid_midi_driver_t *driver)
|
||||
{
|
||||
#ifdef FLUID_MIDI_SUPPORT
|
||||
unsigned int i;
|
||||
fluid_return_if_fail(driver != NULL);
|
||||
|
||||
for(i = 0; i < FLUID_N_ELEMENTS(fluid_midi_drivers); i++)
|
||||
for(i = 0; i < FLUID_N_ELEMENTS(fluid_midi_drivers) - 1; i++)
|
||||
{
|
||||
if(fluid_midi_drivers[i].name == driver->name)
|
||||
{
|
||||
|
@ -230,6 +200,4 @@ void delete_fluid_midi_driver(fluid_midi_driver_t *driver)
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -148,7 +148,6 @@ static int fluid_synth_set_chorus_full_LOCAL(fluid_synth_t *synth, int set, int
|
|||
/* fluid_atomic_int_t may be anything, so init with {0} to catch most cases */
|
||||
static fluid_atomic_int_t fluid_synth_initialized = {0};
|
||||
static void fluid_synth_init(void);
|
||||
static void init_dither(void);
|
||||
|
||||
/* default modulators
|
||||
* SF2.01 page 52 ff:
|
||||
|
|
Loading…
Reference in a new issue