diff options
Diffstat (limited to 'sound/null.cpp')
-rw-r--r-- | sound/null.cpp | 54 |
1 files changed, 16 insertions, 38 deletions
diff --git a/sound/null.cpp b/sound/null.cpp index 00a5f5e488..556b96c14c 100644 --- a/sound/null.cpp +++ b/sound/null.cpp @@ -22,63 +22,41 @@ * $Id$ */ -#include "sound/musicplugin.h" -#include "sound/mpu401.h" +#include "sound/null.h" -/* NULL driver */ -class MidiDriver_NULL : public MidiDriver_MPU401 { -public: - int open() { return 0; } - void send(uint32 b) { } -}; +Common::Error NullMusicPlugin::createInstance(MidiDriver **mididriver, MidiDriver::DeviceHandle) const { + *mididriver = new MidiDriver_NULL(); + return Common::kNoError; +} -// Plugin interface +MusicDevices NullMusicPlugin::getDevices() const { + MusicDevices devices; + devices.push_back(MusicDevice(this, "", MT_NULL)); + return devices; +} -class NullMusicPlugin : public MusicPluginObject { +class AutoMusicPlugin : public NullMusicPlugin { public: const char *getName() const { - return "No music"; + return _s("<default>"); } const char *getId() const { - return "null"; + return "auto"; } - MusicDevices getDevices() const; - Common::Error createInstance(MidiDriver **mididriver) const; }; -Common::Error NullMusicPlugin::createInstance(MidiDriver **mididriver) const { - *mididriver = new MidiDriver_NULL(); - - return Common::kNoError; -} - -MusicDevices NullMusicPlugin::getDevices() const { +MusicDevices AutoMusicPlugin::getDevices() const { MusicDevices devices; - // TODO: return a different music type? - devices.push_back(MusicDevice(this, "", MT_GM)); + devices.push_back(MusicDevice(this, "", MT_AUTO)); return devices; } -MidiDriver *MidiDriver_NULL_create() { - MidiDriver *mididriver; - - NullMusicPlugin p; - p.createInstance(&mididriver); - - return mididriver; -} - -#ifdef DISABLE_ADLIB -MidiDriver *MidiDriver_ADLIB_create() { - return MidiDriver_NULL_create(); -} -#endif - //#if PLUGIN_ENABLED_DYNAMIC(NULL) //REGISTER_PLUGIN_DYNAMIC(NULL, PLUGIN_TYPE_MUSIC, NullMusicPlugin); //#else + REGISTER_PLUGIN_STATIC(AUTO, PLUGIN_TYPE_MUSIC, AutoMusicPlugin); REGISTER_PLUGIN_STATIC(NULL, PLUGIN_TYPE_MUSIC, NullMusicPlugin); //#endif |