From eb6c809d2b3ccf238fa5efbf45b6cd2b00a82cd9 Mon Sep 17 00:00:00 2001 From: Jordi Vilalta Prat Date: Wed, 14 May 2008 14:56:29 +0000 Subject: - 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 --- sound/softsynth/ym2612.cpp | 43 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 37 insertions(+), 6 deletions(-) (limited to 'sound/softsynth/ym2612.cpp') diff --git a/sound/softsynth/ym2612.cpp b/sound/softsynth/ym2612.cpp index 1e985aeb1c..3fcc2c3fc4 100644 --- a/sound/softsynth/ym2612.cpp +++ b/sound/softsynth/ym2612.cpp @@ -26,6 +26,7 @@ #include "sound/softsynth/ym2612.h" #include "common/util.h" +#include "sound/midiplugin.h" //////////////////////////////////////// // @@ -751,13 +752,43 @@ void MidiDriver_YM2612::removeLookupTables() { sintbl = powtbl = frequencyTable = keycodeTable = keyscaleTable = attackOut = 0; } -//////////////////////////////////////// -// -// MidiDriver_YM2612 factory -// -//////////////////////////////////////// + +// Plugin interface + +class TownsMidiPlugin : public MidiPluginObject { +public: + virtual const char *getName() const { + return "FM Towns Emulator"; + } + + virtual const char *getId() const { + return "towns"; + } + + virtual int getCapabilities() const { + return MDT_TOWNS; + } + + virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const; +}; + +PluginError TownsMidiPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const { + *mididriver = new MidiDriver_YM2612(mixer); + + return kNoError; +} MidiDriver *MidiDriver_YM2612_create(Audio::Mixer *mixer) { - return new MidiDriver_YM2612(mixer); + MidiDriver *mididriver; + + TownsMidiPlugin p; + p.createInstance(mixer, &mididriver); + + return mididriver; } +//#if PLUGIN_ENABLED_DYNAMIC(TOWNS) + //REGISTER_PLUGIN_DYNAMIC(TOWNS, PLUGIN_TYPE_MIDI, TownsMidiPlugin); +//#else + REGISTER_PLUGIN_STATIC(TOWNS, PLUGIN_TYPE_MIDI, TownsMidiPlugin); +//#endif -- cgit v1.2.3