mirror of
https://github.com/ZDoom/fluidsynth.git
synced 2024-11-10 15:01:40 +00:00
Merge pull request #315 from carlo-bramini/misc-fixes-3
Remove redundant includes and avoid zero-size array if MIDI input unavailable.
This commit is contained in:
commit
2d83700dc7
3 changed files with 22 additions and 6 deletions
|
@ -28,12 +28,13 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include "fluid_sys.h"
|
||||
#include "fluid_synth.h"
|
||||
#include "fluid_adriver.h"
|
||||
#include "fluid_mdriver.h"
|
||||
#include "fluid_settings.h"
|
||||
|
||||
#if JACK_SUPPORT
|
||||
|
||||
#include <jack/jack.h>
|
||||
#include <jack/midiport.h>
|
||||
|
||||
|
@ -97,7 +98,7 @@ int fluid_jack_driver_process(jack_nframes_t nframes, void *arg);
|
|||
void delete_fluid_jack_midi_driver(fluid_midi_driver_t *p);
|
||||
|
||||
|
||||
static fluid_mutex_t last_client_mutex = G_STATIC_MUTEX_INIT; /* Probably not necessary, but just in case drivers are created by multiple threads */
|
||||
static fluid_mutex_t last_client_mutex = FLUID_MUTEX_INIT; /* Probably not necessary, but just in case drivers are created by multiple threads */
|
||||
static fluid_jack_client_t *last_client = NULL; /* Last unpaired client. For audio/MIDI driver pairing. */
|
||||
|
||||
|
||||
|
@ -675,3 +676,5 @@ delete_fluid_jack_midi_driver(fluid_midi_driver_t *p)
|
|||
|
||||
FLUID_FREE (dev);
|
||||
}
|
||||
|
||||
#endif /* JACK_SUPPORT */
|
||||
|
|
|
@ -21,6 +21,13 @@
|
|||
#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
|
||||
|
||||
/* ALSA */
|
||||
#if ALSA_SUPPORT
|
||||
|
@ -82,6 +89,8 @@ void fluid_coremidi_driver_settings(fluid_settings_t* settings);
|
|||
#endif
|
||||
|
||||
|
||||
#ifdef FLUID_MIDI_SUPPORT
|
||||
|
||||
/*
|
||||
* fluid_mdriver_definition
|
||||
*/
|
||||
|
@ -138,7 +147,7 @@ static const struct fluid_mdriver_definition_t fluid_midi_drivers[] = {
|
|||
#endif
|
||||
};
|
||||
|
||||
|
||||
#endif /* FLUID_MIDI_SUPPORT */
|
||||
|
||||
void fluid_midi_driver_settings(fluid_settings_t* settings)
|
||||
{
|
||||
|
@ -187,11 +196,13 @@ void fluid_midi_driver_settings(fluid_settings_t* settings)
|
|||
fluid_settings_add_option(settings, "midi.driver", "coremidi");
|
||||
#endif
|
||||
|
||||
#ifdef FLUID_MIDI_SUPPORT
|
||||
for (i = 0; i < FLUID_N_ELEMENTS(fluid_midi_drivers); i++) {
|
||||
if (fluid_midi_drivers[i].settings != NULL) {
|
||||
fluid_midi_drivers[i].settings(settings);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -204,6 +215,7 @@ 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;
|
||||
|
@ -223,7 +235,7 @@ fluid_midi_driver_t* new_fluid_midi_driver(fluid_settings_t* settings, handle_mi
|
|||
FLUID_LOG(FLUID_ERR, "Couldn't find the requested midi driver. Valid drivers are: %s.",
|
||||
allnames ? allnames : "ERROR");
|
||||
if (allnames) FLUID_FREE (allnames);
|
||||
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -233,6 +245,7 @@ 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);
|
||||
|
||||
|
@ -242,4 +255,5 @@ void delete_fluid_midi_driver(fluid_midi_driver_t* driver)
|
|||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
*/
|
||||
|
||||
#include "fluid_synth.h"
|
||||
#include "fluid_sys.h"
|
||||
#include "fluid_settings.h"
|
||||
#include "fluid_adriver.h"
|
||||
|
||||
|
@ -362,4 +361,4 @@ delete_fluid_portaudio_driver(fluid_audio_driver_t *p)
|
|||
FLUID_FREE (dev);
|
||||
}
|
||||
|
||||
#endif /*#if PORTAUDIO_SUPPORT */
|
||||
#endif /* PORTAUDIO_SUPPORT */
|
||||
|
|
Loading…
Reference in a new issue