2007-05-30 21:56:52 +00:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
2002-12-08 20:19:01 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2005-10-18 01:30:26 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2002-12-08 20:19:01 +00:00
|
|
|
*
|
2006-02-11 12:47:47 +00:00
|
|
|
* $URL$
|
|
|
|
* $Id$
|
2002-12-08 20:19:01 +00:00
|
|
|
*/
|
|
|
|
|
2008-06-13 14:30:47 +00:00
|
|
|
#include "sound/musicplugin.h"
|
2002-12-08 20:19:01 +00:00
|
|
|
#include "sound/mpu401.h"
|
|
|
|
|
|
|
|
/* NULL driver */
|
|
|
|
class MidiDriver_NULL : public MidiDriver_MPU401 {
|
|
|
|
public:
|
2003-06-11 18:30:28 +00:00
|
|
|
int open() { return 0; }
|
2002-12-08 20:19:01 +00:00
|
|
|
void send(uint32 b) { }
|
|
|
|
};
|
|
|
|
|
2008-05-14 14:56:29 +00:00
|
|
|
|
|
|
|
// Plugin interface
|
|
|
|
|
2008-06-13 14:30:47 +00:00
|
|
|
class NullMusicPlugin : public MusicPluginObject {
|
2008-05-14 14:56:29 +00:00
|
|
|
public:
|
2008-06-13 16:04:43 +00:00
|
|
|
const char *getName() const {
|
2008-05-14 14:56:29 +00:00
|
|
|
return "No music";
|
|
|
|
}
|
|
|
|
|
2008-06-13 16:04:43 +00:00
|
|
|
const char *getId() const {
|
2008-05-14 14:56:29 +00:00
|
|
|
return "null";
|
|
|
|
}
|
|
|
|
|
2008-06-13 16:04:43 +00:00
|
|
|
MusicDevices getDevices() const;
|
2009-12-09 18:05:20 +00:00
|
|
|
Common::Error createInstance(MidiDriver **mididriver) const;
|
2008-05-14 14:56:29 +00:00
|
|
|
};
|
|
|
|
|
2009-12-09 18:05:20 +00:00
|
|
|
Common::Error NullMusicPlugin::createInstance(MidiDriver **mididriver) const {
|
2008-05-14 14:56:29 +00:00
|
|
|
*mididriver = new MidiDriver_NULL();
|
|
|
|
|
2008-11-05 17:24:56 +00:00
|
|
|
return Common::kNoError;
|
2008-05-14 14:56:29 +00:00
|
|
|
}
|
|
|
|
|
2008-06-13 16:04:43 +00:00
|
|
|
MusicDevices NullMusicPlugin::getDevices() const {
|
|
|
|
MusicDevices devices;
|
|
|
|
// TODO: return a different music type?
|
|
|
|
devices.push_back(MusicDevice(this, "", MT_GM));
|
|
|
|
return devices;
|
|
|
|
}
|
|
|
|
|
2009-12-09 18:05:20 +00:00
|
|
|
MidiDriver *MidiDriver_NULL_create() {
|
2008-05-14 14:56:29 +00:00
|
|
|
MidiDriver *mididriver;
|
|
|
|
|
2008-06-13 14:30:47 +00:00
|
|
|
NullMusicPlugin p;
|
2009-12-09 18:05:20 +00:00
|
|
|
p.createInstance(&mididriver);
|
2008-05-14 14:56:29 +00:00
|
|
|
|
|
|
|
return mididriver;
|
2002-12-08 20:19:01 +00:00
|
|
|
}
|
2006-02-11 19:01:06 +00:00
|
|
|
|
|
|
|
#ifdef DISABLE_ADLIB
|
2009-12-09 18:05:20 +00:00
|
|
|
MidiDriver *MidiDriver_ADLIB_create() {
|
|
|
|
return MidiDriver_NULL_create();
|
2006-02-11 19:01:06 +00:00
|
|
|
}
|
|
|
|
#endif
|
2008-05-14 14:56:29 +00:00
|
|
|
|
|
|
|
//#if PLUGIN_ENABLED_DYNAMIC(NULL)
|
2008-06-13 14:30:47 +00:00
|
|
|
//REGISTER_PLUGIN_DYNAMIC(NULL, PLUGIN_TYPE_MUSIC, NullMusicPlugin);
|
2008-05-14 14:56:29 +00:00
|
|
|
//#else
|
2008-06-13 14:30:47 +00:00
|
|
|
REGISTER_PLUGIN_STATIC(NULL, PLUGIN_TYPE_MUSIC, NullMusicPlugin);
|
2008-05-14 14:56:29 +00:00
|
|
|
//#endif
|