- 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
This commit is contained in:
parent
e2d58f4885
commit
eb6c809d2b
21 changed files with 447 additions and 26 deletions
|
@ -247,6 +247,14 @@ public:
|
||||||
return "ALSA";
|
return "ALSA";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual const char *getId() const {
|
||||||
|
return "alsa";
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual int getCapabilities() const {
|
||||||
|
return MDT_MIDI;
|
||||||
|
}
|
||||||
|
|
||||||
virtual Common::StringList getDevices() const;
|
virtual Common::StringList getDevices() const;
|
||||||
|
|
||||||
virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const;
|
virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const;
|
||||||
|
@ -309,4 +317,10 @@ MidiDriver *MidiDriver_ALSA_create(Audio::Mixer *mixer) {
|
||||||
return mididriver;
|
return mididriver;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//#if PLUGIN_ENABLED_DYNAMIC(ALSA)
|
||||||
|
//REGISTER_PLUGIN_DYNAMIC(ALSA, PLUGIN_TYPE_MIDI, AlsaMidiPlugin);
|
||||||
|
//#else
|
||||||
|
REGISTER_PLUGIN_STATIC(ALSA, PLUGIN_TYPE_MIDI, AlsaMidiPlugin);
|
||||||
|
//#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -172,6 +172,14 @@ public:
|
||||||
return "CAMD";
|
return "CAMD";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual const char *getId() const {
|
||||||
|
return "camd";
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual int getCapabilities() const {
|
||||||
|
return MDT_MIDI;
|
||||||
|
}
|
||||||
|
|
||||||
//virtual Common::StringList getDevices() const;
|
//virtual Common::StringList getDevices() const;
|
||||||
|
|
||||||
virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const;
|
virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const;
|
||||||
|
@ -192,4 +200,10 @@ MidiDriver *MidiDriver_CAMD_create(Audio::Mixer *mixer) {
|
||||||
return mididriver;
|
return mididriver;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//#if PLUGIN_ENABLED_DYNAMIC(CAMD)
|
||||||
|
//REGISTER_PLUGIN_DYNAMIC(CAMD, PLUGIN_TYPE_MIDI, CamdMidiPlugin);
|
||||||
|
//#else
|
||||||
|
REGISTER_PLUGIN_STATIC(CAMD, PLUGIN_TYPE_MIDI, CamdMidiPlugin);
|
||||||
|
//#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -202,6 +202,14 @@ public:
|
||||||
return "CoreAudio";
|
return "CoreAudio";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual const char *getId() const {
|
||||||
|
return "core";
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual int getCapabilities() const {
|
||||||
|
return MDT_MIDI;
|
||||||
|
}
|
||||||
|
|
||||||
virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const;
|
virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -220,4 +228,10 @@ MidiDriver *MidiDriver_CORE_create(Audio::Mixer *mixer) {
|
||||||
return mididriver;
|
return mididriver;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//#if PLUGIN_ENABLED_DYNAMIC(COREAUDIO)
|
||||||
|
//REGISTER_PLUGIN_DYNAMIC(COREAUDIO, PLUGIN_TYPE_MIDI, CoreAudioMidiPlugin);
|
||||||
|
//#else
|
||||||
|
REGISTER_PLUGIN_STATIC(COREAUDIO, PLUGIN_TYPE_MIDI, CoreAudioMidiPlugin);
|
||||||
|
//#endif
|
||||||
|
|
||||||
#endif // MACOSX
|
#endif // MACOSX
|
||||||
|
|
|
@ -185,6 +185,14 @@ public:
|
||||||
return "CoreMIDI";
|
return "CoreMIDI";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual const char *getId() const {
|
||||||
|
return "coremidi";
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual int getCapabilities() const {
|
||||||
|
return MDT_MIDI;
|
||||||
|
}
|
||||||
|
|
||||||
virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const;
|
virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -203,4 +211,10 @@ MidiDriver *MidiDriver_CoreMIDI_create(Audio::Mixer *mixer) {
|
||||||
return mididriver;
|
return mididriver;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//#if PLUGIN_ENABLED_DYNAMIC(COREMIDI)
|
||||||
|
//REGISTER_PLUGIN_DYNAMIC(COREMIDI, PLUGIN_TYPE_MIDI, CoreMIDIMidiPlugin);
|
||||||
|
//#else
|
||||||
|
REGISTER_PLUGIN_STATIC(COREMIDI, PLUGIN_TYPE_MIDI, CoreMIDIMidiPlugin);
|
||||||
|
//#endif
|
||||||
|
|
||||||
#endif // MACOSX
|
#endif // MACOSX
|
||||||
|
|
|
@ -184,6 +184,14 @@ public:
|
||||||
return "DMedia";
|
return "DMedia";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual const char *getId() const {
|
||||||
|
return "dmedia";
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual int getCapabilities() const {
|
||||||
|
return MDT_MIDI;
|
||||||
|
}
|
||||||
|
|
||||||
virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const;
|
virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -202,4 +210,10 @@ MidiDriver *MidiDriver_DMEDIA_create(Audio::Mixer *mixer) {
|
||||||
return mididriver;
|
return mididriver;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//#if PLUGIN_ENABLED_DYNAMIC(DMEDIA)
|
||||||
|
//REGISTER_PLUGIN_DYNAMIC(DMEDIA, PLUGIN_TYPE_MIDI, DMediaMidiPlugin);
|
||||||
|
//#else
|
||||||
|
REGISTER_PLUGIN_STATIC(DMEDIA, PLUGIN_TYPE_MIDI, DMediaMidiPlugin);
|
||||||
|
//#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -259,6 +259,14 @@ public:
|
||||||
return "QuickTime";
|
return "QuickTime";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual const char *getId() const {
|
||||||
|
return "qt";
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual int getCapabilities() const {
|
||||||
|
return MDT_MIDI;
|
||||||
|
}
|
||||||
|
|
||||||
virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const;
|
virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -277,4 +285,10 @@ MidiDriver *MidiDriver_QT_create(Audio::Mixer *mixer) {
|
||||||
return mididriver;
|
return mididriver;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//#if PLUGIN_ENABLED_DYNAMIC(QT)
|
||||||
|
//REGISTER_PLUGIN_DYNAMIC(QT, PLUGIN_TYPE_MIDI, QuickTimeMidiPlugin);
|
||||||
|
//#else
|
||||||
|
REGISTER_PLUGIN_STATIC(QT, PLUGIN_TYPE_MIDI, QuickTimeMidiPlugin);
|
||||||
|
//#endif
|
||||||
|
|
||||||
#endif // MACOSX || macintosh
|
#endif // MACOSX || macintosh
|
||||||
|
|
|
@ -179,6 +179,14 @@ public:
|
||||||
return "SEQ";
|
return "SEQ";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual const char *getId() const {
|
||||||
|
return "seq";
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual int getCapabilities() const {
|
||||||
|
return MDT_MIDI;
|
||||||
|
}
|
||||||
|
|
||||||
virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const;
|
virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -197,4 +205,10 @@ MidiDriver *MidiDriver_SEQ_create(Audio::Mixer *mixer) {
|
||||||
return mididriver;
|
return mididriver;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//#if PLUGIN_ENABLED_DYNAMIC(SEQ)
|
||||||
|
//REGISTER_PLUGIN_DYNAMIC(SEQ, PLUGIN_TYPE_MIDI, SeqMidiPlugin);
|
||||||
|
//#else
|
||||||
|
REGISTER_PLUGIN_STATIC(SEQ, PLUGIN_TYPE_MIDI, SeqMidiPlugin);
|
||||||
|
//#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -520,6 +520,14 @@ public:
|
||||||
return "TiMidity";
|
return "TiMidity";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual const char *getId() const {
|
||||||
|
return "timidity";
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual int getCapabilities() const {
|
||||||
|
return MDT_MIDI;
|
||||||
|
}
|
||||||
|
|
||||||
virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const;
|
virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -538,4 +546,10 @@ MidiDriver *MidiDriver_TIMIDITY_create(Audio::Mixer *mixer) {
|
||||||
return mididriver;
|
return mididriver;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//#if PLUGIN_ENABLED_DYNAMIC(TIMIDITY)
|
||||||
|
//REGISTER_PLUGIN_DYNAMIC(TIMIDITY, PLUGIN_TYPE_MIDI, TimidityMidiPlugin);
|
||||||
|
//#else
|
||||||
|
REGISTER_PLUGIN_STATIC(TIMIDITY, PLUGIN_TYPE_MIDI, TimidityMidiPlugin);
|
||||||
|
//#endif
|
||||||
|
|
||||||
#endif // defined (UNIX)
|
#endif // defined (UNIX)
|
||||||
|
|
|
@ -153,6 +153,14 @@ public:
|
||||||
return "Windows MIDI";
|
return "Windows MIDI";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual const char *getId() const {
|
||||||
|
return "windows";
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual int getCapabilities() const {
|
||||||
|
return MDT_MIDI;
|
||||||
|
}
|
||||||
|
|
||||||
virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const;
|
virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -171,4 +179,10 @@ MidiDriver *MidiDriver_WIN_create(Audio::Mixer *mixer) {
|
||||||
return mididriver;
|
return mididriver;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//#if PLUGIN_ENABLED_DYNAMIC(WINDOWS)
|
||||||
|
//REGISTER_PLUGIN_DYNAMIC(WINDOWS, PLUGIN_TYPE_MIDI, WindowsMidiPlugin);
|
||||||
|
//#else
|
||||||
|
REGISTER_PLUGIN_STATIC(WINDOWS, PLUGIN_TYPE_MIDI, WindowsMidiPlugin);
|
||||||
|
//#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -112,6 +112,14 @@ public:
|
||||||
return "Yamaha Pa1";
|
return "Yamaha Pa1";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual const char *getId() const {
|
||||||
|
return "ypa1";
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual int getCapabilities() const {
|
||||||
|
return MDT_MIDI;
|
||||||
|
}
|
||||||
|
|
||||||
virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const;
|
virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -129,3 +137,9 @@ MidiDriver *MidiDriver_YamahaPa1_create(Audio::Mixer *mixer) {
|
||||||
|
|
||||||
return mididriver;
|
return mididriver;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//#if PLUGIN_ENABLED_DYNAMIC(YPA1)
|
||||||
|
//REGISTER_PLUGIN_DYNAMIC(YPA1, PLUGIN_TYPE_MIDI, YamahaPa1MidiPlugin);
|
||||||
|
//#else
|
||||||
|
REGISTER_PLUGIN_STATIC(YPA1, PLUGIN_TYPE_MIDI, YamahaPa1MidiPlugin);
|
||||||
|
//#endif
|
||||||
|
|
|
@ -130,6 +130,14 @@ public:
|
||||||
return "Tapwave Zodiac";
|
return "Tapwave Zodiac";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual const char *getId() const {
|
||||||
|
return "zodiac";
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual int getCapabilities() const {
|
||||||
|
return MDT_MIDI;
|
||||||
|
}
|
||||||
|
|
||||||
virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const;
|
virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -148,4 +156,10 @@ MidiDriver *MidiDriver_Zodiac_create(Audio::Mixer *mixer) {
|
||||||
return mididriver;
|
return mididriver;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//#if PLUGIN_ENABLED_DYNAMIC(ZODIAC)
|
||||||
|
//REGISTER_PLUGIN_DYNAMIC(ZODIAC, PLUGIN_TYPE_MIDI, ZodiacMidiPlugin);
|
||||||
|
//#else
|
||||||
|
REGISTER_PLUGIN_STATIC(ZODIAC, PLUGIN_TYPE_MIDI, ZodiacMidiPlugin);
|
||||||
|
//#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
|
|
||||||
int pluginTypeVersions[PLUGIN_TYPE_MAX] = {
|
int pluginTypeVersions[PLUGIN_TYPE_MAX] = {
|
||||||
PLUGIN_TYPE_ENGINE_VERSION,
|
PLUGIN_TYPE_ENGINE_VERSION,
|
||||||
|
PLUGIN_TYPE_MIDI_VERSION,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -82,6 +83,7 @@ public:
|
||||||
// "Loader" for the static plugins.
|
// "Loader" for the static plugins.
|
||||||
// Iterate over all registered (static) plugins and load them.
|
// Iterate over all registered (static) plugins and load them.
|
||||||
|
|
||||||
|
// Engine plugins
|
||||||
#if PLUGIN_ENABLED_STATIC(SCUMM)
|
#if PLUGIN_ENABLED_STATIC(SCUMM)
|
||||||
LINK_PLUGIN(SCUMM)
|
LINK_PLUGIN(SCUMM)
|
||||||
#endif
|
#endif
|
||||||
|
@ -140,6 +142,49 @@ public:
|
||||||
LINK_PLUGIN(TOUCHE)
|
LINK_PLUGIN(TOUCHE)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// MIDI plugins
|
||||||
|
// TODO: Use defines to disable or enable each MIDI driver as a
|
||||||
|
// static/dynamic plugin, like it's done for the engines
|
||||||
|
LINK_PLUGIN(NULL)
|
||||||
|
#if defined(WIN32) && !defined(_WIN32_WCE) && !defined(__SYMBIAN32__)
|
||||||
|
LINK_PLUGIN(WINDOWS)
|
||||||
|
#endif
|
||||||
|
#if defined(UNIX) && defined(USE_ALSA)
|
||||||
|
LINK_PLUGIN(ALSA)
|
||||||
|
#endif
|
||||||
|
#if defined(UNIX) && !defined(__BEOS__) && !defined(__MAEMO__)
|
||||||
|
LINK_PLUGIN(SEQ)
|
||||||
|
#endif
|
||||||
|
#if defined(IRIX)
|
||||||
|
LINK_PLUGIN(DMEDIA)
|
||||||
|
#endif
|
||||||
|
#if defined(__amigaos4__)
|
||||||
|
LINK_PLUGIN(CAMD)
|
||||||
|
#endif
|
||||||
|
#if defined(MACOSX)
|
||||||
|
LINK_PLUGIN(COREAUDIO)
|
||||||
|
LINK_PLUGIN(COREMIDI)
|
||||||
|
LINK_PLUGIN(QUICKTIME)
|
||||||
|
#endif
|
||||||
|
#if defined(PALMOS_MODE)
|
||||||
|
# if defined(COMPILE_CLIE)
|
||||||
|
LINK_PLUGIN(YPA1)
|
||||||
|
# elif defined(COMPILE_ZODIAC) && (!defined(ENABLE_SCUMM) || !defined(PALMOS_ARM))
|
||||||
|
LINK_PLUGIN(ZODIAC)
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
#ifdef USE_FLUIDSYNTH
|
||||||
|
LINK_PLUGIN(FLUIDSYNTH)
|
||||||
|
#endif
|
||||||
|
#ifdef USE_MT32EMU
|
||||||
|
LINK_PLUGIN(MT32)
|
||||||
|
#endif
|
||||||
|
LINK_PLUGIN(ADLIB)
|
||||||
|
LINK_PLUGIN(TOWNS)
|
||||||
|
#if defined (UNIX)
|
||||||
|
LINK_PLUGIN(TIMIDITY)
|
||||||
|
#endif
|
||||||
|
|
||||||
return pl;
|
return pl;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -336,3 +381,14 @@ GameList EngineManager::detectGames(const FSList &fslist) const {
|
||||||
const EnginePlugin::list &EngineManager::getPlugins() const {
|
const EnginePlugin::list &EngineManager::getPlugins() const {
|
||||||
return (const EnginePlugin::list&)PluginManager::instance().getPlugins(PLUGIN_TYPE_ENGINE);
|
return (const EnginePlugin::list&)PluginManager::instance().getPlugins(PLUGIN_TYPE_ENGINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// MIDI plugins
|
||||||
|
|
||||||
|
#include "sound/midiplugin.h"
|
||||||
|
|
||||||
|
DECLARE_SINGLETON(MidiManager);
|
||||||
|
|
||||||
|
const MidiPlugin::list &MidiManager::getPlugins() const {
|
||||||
|
return (const MidiPlugin::list&)PluginManager::instance().getPlugins(PLUGIN_TYPE_MIDI);
|
||||||
|
}
|
||||||
|
|
|
@ -63,6 +63,7 @@
|
||||||
|
|
||||||
enum PluginType {
|
enum PluginType {
|
||||||
PLUGIN_TYPE_ENGINE = 0,
|
PLUGIN_TYPE_ENGINE = 0,
|
||||||
|
PLUGIN_TYPE_MIDI,
|
||||||
|
|
||||||
PLUGIN_TYPE_MAX
|
PLUGIN_TYPE_MAX
|
||||||
};
|
};
|
||||||
|
@ -70,6 +71,7 @@ enum PluginType {
|
||||||
// TODO: Make the engine API version depend on ScummVM's version
|
// TODO: Make the engine API version depend on ScummVM's version
|
||||||
// because of the backlinking
|
// because of the backlinking
|
||||||
#define PLUGIN_TYPE_ENGINE_VERSION 1
|
#define PLUGIN_TYPE_ENGINE_VERSION 1
|
||||||
|
#define PLUGIN_TYPE_MIDI_VERSION 1
|
||||||
|
|
||||||
extern int pluginTypeVersions[PLUGIN_TYPE_MAX];
|
extern int pluginTypeVersions[PLUGIN_TYPE_MAX];
|
||||||
|
|
||||||
|
|
|
@ -216,7 +216,7 @@ int MidiDriver::detectMusicDriver(int flags) {
|
||||||
|
|
||||||
MidiDriver *MidiDriver::createMidi(int midiDriver) {
|
MidiDriver *MidiDriver::createMidi(int midiDriver) {
|
||||||
switch (midiDriver) {
|
switch (midiDriver) {
|
||||||
case MD_NULL: return MidiDriver_NULL_create();
|
case MD_NULL: return MidiDriver_NULL_create(g_system->getMixer());
|
||||||
|
|
||||||
case MD_ADLIB: return MidiDriver_ADLIB_create(g_system->getMixer());
|
case MD_ADLIB: return MidiDriver_ADLIB_create(g_system->getMixer());
|
||||||
|
|
||||||
|
|
|
@ -268,7 +268,7 @@ public:
|
||||||
|
|
||||||
|
|
||||||
// Factory functions, for faster compile
|
// Factory functions, for faster compile
|
||||||
extern MidiDriver *MidiDriver_NULL_create();
|
extern MidiDriver *MidiDriver_NULL_create(Audio::Mixer *mixer);
|
||||||
extern MidiDriver *MidiDriver_ADLIB_create(Audio::Mixer *mixer);
|
extern MidiDriver *MidiDriver_ADLIB_create(Audio::Mixer *mixer);
|
||||||
extern MidiDriver *MidiDriver_WIN_create(Audio::Mixer *mixer);
|
extern MidiDriver *MidiDriver_WIN_create(Audio::Mixer *mixer);
|
||||||
extern MidiDriver *MidiDriver_SEQ_create(Audio::Mixer *mixer);
|
extern MidiDriver *MidiDriver_SEQ_create(Audio::Mixer *mixer);
|
||||||
|
|
|
@ -36,6 +36,18 @@ class MidiPluginObject : public PluginObject {
|
||||||
public:
|
public:
|
||||||
virtual ~MidiPluginObject() {}
|
virtual ~MidiPluginObject() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a unique string identifier which will be used to save the
|
||||||
|
* selected MIDI driver to the config file.
|
||||||
|
*/
|
||||||
|
virtual const char *getId() const = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the type kind of music supported by this driver, as specified
|
||||||
|
* by the MidiDriverFlags enum.
|
||||||
|
*/
|
||||||
|
virtual int getCapabilities() const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a list of the available devices. The empty string means the
|
* Returns a list of the available devices. The empty string means the
|
||||||
* default device.
|
* default device.
|
||||||
|
@ -59,4 +71,23 @@ public:
|
||||||
virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const = 0;
|
virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// MIDI plugins
|
||||||
|
|
||||||
|
typedef PluginSubclass<MidiPluginObject> MidiPlugin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Singleton class which manages all MIDI plugins.
|
||||||
|
*/
|
||||||
|
class MidiManager : public Common::Singleton<MidiManager> {
|
||||||
|
private:
|
||||||
|
friend class Common::Singleton<SingletonBaseType>;
|
||||||
|
|
||||||
|
public:
|
||||||
|
const MidiPlugin::list &getPlugins() const;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** Convenience shortcut for accessing the MIDI manager. */
|
||||||
|
#define MidiMan MidiManager::instance()
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
* $Id$
|
* $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "sound/midiplugin.h"
|
||||||
#include "sound/mpu401.h"
|
#include "sound/mpu401.h"
|
||||||
|
|
||||||
/* NULL driver */
|
/* NULL driver */
|
||||||
|
@ -31,12 +32,49 @@ public:
|
||||||
void send(uint32 b) { }
|
void send(uint32 b) { }
|
||||||
};
|
};
|
||||||
|
|
||||||
MidiDriver *MidiDriver_NULL_create() {
|
|
||||||
return new MidiDriver_NULL();
|
// Plugin interface
|
||||||
|
|
||||||
|
class NullMidiPlugin : public MidiPluginObject {
|
||||||
|
public:
|
||||||
|
virtual const char *getName() const {
|
||||||
|
return "No music";
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual const char *getId() const {
|
||||||
|
return "null";
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual int getCapabilities() const {
|
||||||
|
return MDT_MIDI | MDT_PCSPK | MDT_ADLIB | MDT_TOWNS;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
PluginError NullMidiPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const {
|
||||||
|
*mididriver = new MidiDriver_NULL();
|
||||||
|
|
||||||
|
return kNoError;
|
||||||
|
}
|
||||||
|
|
||||||
|
MidiDriver *MidiDriver_NULL_create(Audio::Mixer *mixer) {
|
||||||
|
MidiDriver *mididriver;
|
||||||
|
|
||||||
|
NullMidiPlugin p;
|
||||||
|
p.createInstance(mixer, &mididriver);
|
||||||
|
|
||||||
|
return mididriver;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DISABLE_ADLIB
|
#ifdef DISABLE_ADLIB
|
||||||
MidiDriver *MidiDriver_ADLIB_create(Audio::Mixer *mixer) {
|
MidiDriver *MidiDriver_ADLIB_create(Audio::Mixer *mixer) {
|
||||||
return new MidiDriver_NULL();
|
return MidiDriver_NULL_create(mixer);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//#if PLUGIN_ENABLED_DYNAMIC(NULL)
|
||||||
|
//REGISTER_PLUGIN_DYNAMIC(NULL, PLUGIN_TYPE_MIDI, NullMidiPlugin);
|
||||||
|
//#else
|
||||||
|
REGISTER_PLUGIN_STATIC(NULL, PLUGIN_TYPE_MIDI, NullMidiPlugin);
|
||||||
|
//#endif
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include "sound/softsynth/emumidi.h"
|
#include "sound/softsynth/emumidi.h"
|
||||||
#include "common/util.h"
|
#include "common/util.h"
|
||||||
#include "sound/fmopl.h"
|
#include "sound/fmopl.h"
|
||||||
|
#include "sound/midiplugin.h"
|
||||||
|
|
||||||
#ifdef DEBUG_ADLIB
|
#ifdef DEBUG_ADLIB
|
||||||
static int tick;
|
static int tick;
|
||||||
|
@ -970,10 +971,6 @@ MidiChannel *MidiDriver_ADLIB::allocateChannel() {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
MidiDriver *MidiDriver_ADLIB_create(Audio::Mixer *mixer) {
|
|
||||||
return new MidiDriver_ADLIB(mixer);
|
|
||||||
}
|
|
||||||
|
|
||||||
// All the code brought over from IMuseAdlib
|
// All the code brought over from IMuseAdlib
|
||||||
|
|
||||||
void MidiDriver_ADLIB::adlib_write(byte port, byte value) {
|
void MidiDriver_ADLIB::adlib_write(byte port, byte value) {
|
||||||
|
@ -1517,3 +1514,44 @@ void MidiDriver_ADLIB::adlib_note_on(int chan, byte note, int mod) {
|
||||||
curnote_table[chan] = code;
|
curnote_table[chan] = code;
|
||||||
adlib_playnote(chan, (int16) channel_table_2[chan] + code);
|
adlib_playnote(chan, (int16) channel_table_2[chan] + code);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Plugin interface
|
||||||
|
|
||||||
|
class AdlibMidiPlugin : public MidiPluginObject {
|
||||||
|
public:
|
||||||
|
virtual const char *getName() const {
|
||||||
|
return "AdLib Emulator";
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual const char *getId() const {
|
||||||
|
return "adlib";
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual int getCapabilities() const {
|
||||||
|
return MDT_ADLIB;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
PluginError AdlibMidiPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const {
|
||||||
|
*mididriver = new MidiDriver_ADLIB(mixer);
|
||||||
|
|
||||||
|
return kNoError;
|
||||||
|
}
|
||||||
|
|
||||||
|
MidiDriver *MidiDriver_ADLIB_create(Audio::Mixer *mixer) {
|
||||||
|
MidiDriver *mididriver;
|
||||||
|
|
||||||
|
AdlibMidiPlugin p;
|
||||||
|
p.createInstance(mixer, &mididriver);
|
||||||
|
|
||||||
|
return mididriver;
|
||||||
|
}
|
||||||
|
|
||||||
|
//#if PLUGIN_ENABLED_DYNAMIC(ADLIB)
|
||||||
|
//REGISTER_PLUGIN_DYNAMIC(ADLIB, PLUGIN_TYPE_MIDI, AdlibMidiPlugin);
|
||||||
|
//#else
|
||||||
|
REGISTER_PLUGIN_STATIC(ADLIB, PLUGIN_TYPE_MIDI, AdlibMidiPlugin);
|
||||||
|
//#endif
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#ifdef USE_FLUIDSYNTH
|
#ifdef USE_FLUIDSYNTH
|
||||||
|
|
||||||
#include "common/config-manager.h"
|
#include "common/config-manager.h"
|
||||||
|
#include "sound/midiplugin.h"
|
||||||
#include "sound/mpu401.h"
|
#include "sound/mpu401.h"
|
||||||
#include "sound/softsynth/emumidi.h"
|
#include "sound/softsynth/emumidi.h"
|
||||||
|
|
||||||
|
@ -211,12 +212,49 @@ MidiChannel *MidiDriver_FluidSynth::getPercussionChannel() {
|
||||||
return &_midiChannels[9];
|
return &_midiChannels[9];
|
||||||
}
|
}
|
||||||
|
|
||||||
MidiDriver *MidiDriver_FluidSynth_create(Audio::Mixer *mixer) {
|
|
||||||
return new MidiDriver_FluidSynth(mixer);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MidiDriver_FluidSynth::generateSamples(int16 *data, int len) {
|
void MidiDriver_FluidSynth::generateSamples(int16 *data, int len) {
|
||||||
fluid_synth_write_s16(_synth, len, data, 0, 2, data, 1, 2);
|
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
|
#endif
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include "sound/softsynth/mt32/mt32emu.h"
|
#include "sound/softsynth/mt32/mt32emu.h"
|
||||||
|
|
||||||
#include "sound/softsynth/emumidi.h"
|
#include "sound/softsynth/emumidi.h"
|
||||||
|
#include "sound/midiplugin.h"
|
||||||
#include "sound/mpu401.h"
|
#include "sound/mpu401.h"
|
||||||
|
|
||||||
#include "common/config-manager.h"
|
#include "common/config-manager.h"
|
||||||
|
@ -479,17 +480,49 @@ void MidiDriver_ThreadedMT32::onTimer() {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
////////////////////////////////////////
|
|
||||||
//
|
// Plugin interface
|
||||||
// MidiDriver_MT32 factory
|
|
||||||
//
|
class MT32MidiPlugin : public MidiPluginObject {
|
||||||
////////////////////////////////////////
|
public:
|
||||||
|
virtual const char *getName() const {
|
||||||
|
return "MT-32 Emulator";
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual const char *getId() const {
|
||||||
|
return "mt32";
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual int getCapabilities() const {
|
||||||
|
return MDT_MIDI;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
PluginError MT32MidiPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const {
|
||||||
|
*mididriver = new MidiDriver_MT32(mixer);
|
||||||
|
|
||||||
|
return kNoError;
|
||||||
|
}
|
||||||
|
|
||||||
MidiDriver *MidiDriver_MT32_create(Audio::Mixer *mixer) {
|
MidiDriver *MidiDriver_MT32_create(Audio::Mixer *mixer) {
|
||||||
// HACK: It will stay here until engine plugin loader overhaul
|
// HACK: It will stay here until engine plugin loader overhaul
|
||||||
if (ConfMan.hasKey("extrapath"))
|
if (ConfMan.hasKey("extrapath"))
|
||||||
Common::File::addDefaultDirectory(ConfMan.get("extrapath"));
|
Common::File::addDefaultDirectory(ConfMan.get("extrapath"));
|
||||||
return new MidiDriver_MT32(mixer);
|
|
||||||
|
MidiDriver *mididriver;
|
||||||
|
|
||||||
|
MT32MidiPlugin p;
|
||||||
|
p.createInstance(mixer, &mididriver);
|
||||||
|
|
||||||
|
return mididriver;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//#if PLUGIN_ENABLED_DYNAMIC(MT32)
|
||||||
|
//REGISTER_PLUGIN_DYNAMIC(MT32, PLUGIN_TYPE_MIDI, MT32MidiPlugin);
|
||||||
|
//#else
|
||||||
|
REGISTER_PLUGIN_STATIC(MT32, PLUGIN_TYPE_MIDI, MT32MidiPlugin);
|
||||||
|
//#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
|
|
||||||
#include "sound/softsynth/ym2612.h"
|
#include "sound/softsynth/ym2612.h"
|
||||||
#include "common/util.h"
|
#include "common/util.h"
|
||||||
|
#include "sound/midiplugin.h"
|
||||||
|
|
||||||
////////////////////////////////////////
|
////////////////////////////////////////
|
||||||
//
|
//
|
||||||
|
@ -751,13 +752,43 @@ void MidiDriver_YM2612::removeLookupTables() {
|
||||||
sintbl = powtbl = frequencyTable = keycodeTable = keyscaleTable = attackOut = 0;
|
sintbl = powtbl = frequencyTable = keycodeTable = keyscaleTable = attackOut = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// MidiDriver_YM2612 factory
|
|
||||||
//
|
|
||||||
////////////////////////////////////////
|
|
||||||
|
|
||||||
MidiDriver *MidiDriver_YM2612_create(Audio::Mixer *mixer) {
|
// Plugin interface
|
||||||
return new MidiDriver_YM2612(mixer);
|
|
||||||
|
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) {
|
||||||
|
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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue