Load fluidsynth entrypoints dynamically (and make them optional)

This removes the static dependency on fluidsynth being present
at buildtime (even headers aren't needed anymore).

Even though midi is a default format for the RPG XP/VX series,
it has fallen more and more out of use, with VX Ace completely
abandoning it from the RTP and making ogg vorbis the de facto
standard. Midi support is kept for legacy reasons, but isn't
encouraged. On top of all this, fluidsynth together with glib
is a heavy dependency that often times won't even be used.
Making it optional at build time is an attempt to unify and
keep build config fragmentation low.

In RGSS3, fluidsynth / midi is not initialized at all by
default, but rather on demand when either a midi track is
played back or Audio.setup_midi is called.
This commit is contained in:
Jonas Kulla 2014-09-07 05:23:10 +02:00
parent 673a25f811
commit 757a1d5e39
13 changed files with 223 additions and 120 deletions

View file

@ -36,10 +36,7 @@
#include "quad.h"
#include "binding.h"
#include "exception.h"
#ifdef MIDI
#include "sharedmidistate.h"
#endif
#include <unistd.h>
#include <stdio.h>
@ -74,9 +71,7 @@ struct SharedStatePrivate
RGSSThreadData &rtData;
Config &config;
#ifdef MIDI
SharedMidiState midiState;
#endif
Graphics graphics;
Input input;
@ -109,9 +104,7 @@ struct SharedStatePrivate
eThread(*threadData->ethread),
rtData(*threadData),
config(threadData->config),
#ifdef MIDI
midiState(threadData->config),
#endif
graphics(threadData),
audio(threadData->config),
fontState(threadData->config),
@ -164,10 +157,8 @@ struct SharedStatePrivate
/* RGSS3 games will call setup_midi, so there's
* no need to do it on startup */
#if MIDI
if (rgssVer <= 2)
midiState.initDefaultSynths();
#endif
midiState.initIfNeeded(threadData->config);
}
~SharedStatePrivate()
@ -245,10 +236,7 @@ GSATT(ShaderSet&, shaders)
GSATT(TexPool&, texPool)
GSATT(Quad&, gpQuad)
GSATT(SharedFontState&, fontState)
#ifdef MIDI
GSATT(SharedMidiState&, midiState)
#endif
void SharedState::setBindingData(void *data)
{