diff options
author | Jordi Vilalta Prat | 2008-05-14 14:56:29 +0000 |
---|---|---|
committer | Jordi Vilalta Prat | 2008-05-14 14:56:29 +0000 |
commit | eb6c809d2b3ccf238fa5efbf45b6cd2b00a82cd9 (patch) | |
tree | d52fc76e91a873d7f457b6f97cb57039210895ee /sound/softsynth/fluidsynth.cpp | |
parent | e2d58f4885352744c88892e93fe2cdd33ecfa1b0 (diff) | |
download | scummvm-rg350-eb6c809d2b3ccf238fa5efbf45b6cd2b00a82cd9.tar.gz scummvm-rg350-eb6c809d2b3ccf238fa5efbf45b6cd2b00a82cd9.tar.bz2 scummvm-rg350-eb6c809d2b3ccf238fa5efbf45b6cd2b00a82cd9.zip |
- Added more information (ID and capabilities) to the MIDI drivers
- Added the MidiPlugin interface to the remaining MIDI drivers
- Added an initial MidiManager to handle the MIDI plugins (just static plugins by now)
svn-id: r32117
Diffstat (limited to 'sound/softsynth/fluidsynth.cpp')
-rw-r--r-- | sound/softsynth/fluidsynth.cpp | 46 |
1 files changed, 42 insertions, 4 deletions
diff --git a/sound/softsynth/fluidsynth.cpp b/sound/softsynth/fluidsynth.cpp index 4a61cd023b..ae89a8df8a 100644 --- a/sound/softsynth/fluidsynth.cpp +++ b/sound/softsynth/fluidsynth.cpp @@ -27,6 +27,7 @@ #ifdef USE_FLUIDSYNTH #include "common/config-manager.h" +#include "sound/midiplugin.h" #include "sound/mpu401.h" #include "sound/softsynth/emumidi.h" @@ -211,12 +212,49 @@ MidiChannel *MidiDriver_FluidSynth::getPercussionChannel() { return &_midiChannels[9]; } -MidiDriver *MidiDriver_FluidSynth_create(Audio::Mixer *mixer) { - return new MidiDriver_FluidSynth(mixer); -} - void MidiDriver_FluidSynth::generateSamples(int16 *data, int len) { fluid_synth_write_s16(_synth, len, data, 0, 2, data, 1, 2); } + +// Plugin interface + +class FluidSynthMidiPlugin : public MidiPluginObject { +public: + virtual const char *getName() const { + return "FluidSynth"; + } + + virtual const char *getId() const { + return "fluidsynth"; + } + + virtual int getCapabilities() const { + return MDT_MIDI; + } + + virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const; +}; + +PluginError FluidSynthMidiPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const { + *mididriver = new MidiDriver_FluidSynth(mixer); + + return kNoError; +} + +MidiDriver *MidiDriver_FluidSynth_create(Audio::Mixer *mixer) { + MidiDriver *mididriver; + + FluidSynthMidiPlugin p; + p.createInstance(mixer, &mididriver); + + return mididriver; +} + +//#if PLUGIN_ENABLED_DYNAMIC(FLUIDSYNTH) + //REGISTER_PLUGIN_DYNAMIC(FLUIDSYNTH, PLUGIN_TYPE_MIDI, FluidSynthMidiPlugin); +//#else + REGISTER_PLUGIN_STATIC(FLUIDSYNTH, PLUGIN_TYPE_MIDI, FluidSynthMidiPlugin); +//#endif + #endif |