aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Kagerer2010-06-22 15:30:41 +0000
committerFlorian Kagerer2010-06-22 15:30:41 +0000
commit46ec88f74d9b7596cee2e6a167b1ccf361771601 (patch)
treebbee6636c5bdb26ef1922cb3ec3c6b61d0bf8f23
parentbb9f556c363718959a43c7a65cec1944b626d358 (diff)
downloadscummvm-rg350-46ec88f74d9b7596cee2e6a167b1ccf361771601.tar.gz
scummvm-rg350-46ec88f74d9b7596cee2e6a167b1ccf361771601.tar.bz2
scummvm-rg350-46ec88f74d9b7596cee2e6a167b1ccf361771601.zip
GUI/LAUNCHER: This should fix the regression concerning pc speaker / pcjr support caused by patch #1956501
svn-id: r50145
-rw-r--r--base/plugins.cpp2
-rw-r--r--po/POTFILES1
-rw-r--r--sound/mididrv.cpp6
-rw-r--r--sound/null.cpp28
-rw-r--r--sound/null.h56
-rw-r--r--sound/softsynth/pcspk.cpp57
6 files changed, 122 insertions, 28 deletions
diff --git a/base/plugins.cpp b/base/plugins.cpp
index 199344087c..39ee10c2cb 100644
--- a/base/plugins.cpp
+++ b/base/plugins.cpp
@@ -205,6 +205,8 @@ public:
LINK_PLUGIN(MT32)
#endif
LINK_PLUGIN(ADLIB)
+ LINK_PLUGIN(PCSPK)
+ LINK_PLUGIN(PCJR)
LINK_PLUGIN(TOWNS)
#if defined (UNIX)
LINK_PLUGIN(TIMIDITY)
diff --git a/po/POTFILES b/po/POTFILES
index 6e42829523..6f23ac6c51 100644
--- a/po/POTFILES
+++ b/po/POTFILES
@@ -22,6 +22,7 @@ engines/scumm/dialogs.cpp
engines/mohawk/dialogs.cpp
sound/musicplugin.cpp
+sound/null.h
sound/null.cpp
sound/softsynth/mt32.cpp
sound/softsynth/adlib.cpp
diff --git a/sound/mididrv.cpp b/sound/mididrv.cpp
index 51abed3aa1..15da0f3106 100644
--- a/sound/mididrv.cpp
+++ b/sound/mididrv.cpp
@@ -131,11 +131,15 @@ MidiDriver::DeviceHandle MidiDriver::detectDevice(int flags) {
// given flags.
switch (getMusicType(hdl)) {
case MT_PCSPK:
- case MT_PCJR:
if (flags & MDT_PCSPK)
return hdl;
break;
+ case MT_PCJR:
+ if (flags & MDT_PCJR)
+ return hdl;
+ break;
+
case MT_ADLIB:
if (flags & MDT_ADLIB)
return hdl;
diff --git a/sound/null.cpp b/sound/null.cpp
index 775a0e2fcb..c61add2c02 100644
--- a/sound/null.cpp
+++ b/sound/null.cpp
@@ -22,33 +22,7 @@
* $Id$
*/
-#include "sound/musicplugin.h"
-#include "sound/mpu401.h"
-#include "common/translation.h"
-
-/* NULL driver */
-class MidiDriver_NULL : public MidiDriver_MPU401 {
-public:
- int open() { return 0; }
- void send(uint32 b) { }
-};
-
-
-// Plugin interface
-
-class NullMusicPlugin : public MusicPluginObject {
-public:
- virtual const char *getName() const {
- return _s("No music");
- }
-
- virtual const char *getId() const {
- return "null";
- }
-
- virtual MusicDevices getDevices() const;
- virtual Common::Error createInstance(MidiDriver **mididriver, MidiDriver::DeviceHandle = 0) const;
-};
+#include "sound/null.h"
Common::Error NullMusicPlugin::createInstance(MidiDriver **mididriver, MidiDriver::DeviceHandle) const {
*mididriver = new MidiDriver_NULL();
diff --git a/sound/null.h b/sound/null.h
new file mode 100644
index 0000000000..f8d0a91e2d
--- /dev/null
+++ b/sound/null.h
@@ -0,0 +1,56 @@
+/* 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.
+ *
+ * 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
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ */
+
+#ifndef SOUND_NULL_H
+#define SOUND_NULL_H
+
+#include "sound/musicplugin.h"
+#include "sound/mpu401.h"
+#include "common/translation.h"
+
+/* NULL driver */
+class MidiDriver_NULL : public MidiDriver_MPU401 {
+public:
+ int open() { return 0; }
+ void send(uint32 b) { }
+};
+
+
+// Plugin interface
+
+class NullMusicPlugin : public MusicPluginObject {
+public:
+ virtual const char *getName() const {
+ return _s("No music");
+ }
+
+ virtual const char *getId() const {
+ return "null";
+ }
+
+ virtual MusicDevices getDevices() const;
+ Common::Error createInstance(MidiDriver **mididriver, MidiDriver::DeviceHandle = 0) const;
+};
+
+#endif \ No newline at end of file
diff --git a/sound/softsynth/pcspk.cpp b/sound/softsynth/pcspk.cpp
index 396d9328f1..8f66578a0b 100644
--- a/sound/softsynth/pcspk.cpp
+++ b/sound/softsynth/pcspk.cpp
@@ -24,6 +24,7 @@
*/
#include "sound/softsynth/pcspk.h"
+#include "sound/null.h"
namespace Audio {
@@ -128,3 +129,59 @@ int8 PCSpeaker::generateTriangle(uint32 x, uint32 oscLength) {
}
} // End of namespace Audio
+
+
+// Plugin interface
+// (This can only create a null driver since pc speaker support is not part of the
+// midi driver architecture. But we need the plugin for the options menu in the launcher
+// and for MidiDriver::detectDevice() which is more or less used by all engines.)
+
+class PCSpeakerMusicPlugin : public NullMusicPlugin {
+public:
+ const char *getName() const {
+ return _s("PC Speaker Emulator");
+ }
+
+ const char *getId() const {
+ return "pcspk";
+ }
+
+ MusicDevices getDevices() const;
+};
+
+MusicDevices PCSpeakerMusicPlugin::getDevices() const {
+ MusicDevices devices;
+ devices.push_back(MusicDevice(this, _s(""), MT_PCSPK));
+ return devices;
+}
+
+class PCjrMusicPlugin : public NullMusicPlugin {
+public:
+ const char *getName() const {
+ return _s("IBM PCjr Emulator");
+ }
+
+ const char *getId() const {
+ return "pcjr";
+ }
+
+ MusicDevices getDevices() const;
+};
+
+MusicDevices PCjrMusicPlugin::getDevices() const {
+ MusicDevices devices;
+ devices.push_back(MusicDevice(this, _s(""), MT_PCJR));
+ return devices;
+}
+
+//#if PLUGIN_ENABLED_DYNAMIC(PCSPK)
+ //REGISTER_PLUGIN_DYNAMIC(PCSPK, PLUGIN_TYPE_MUSIC, PCSpeakerMusicPlugin);
+//#else
+ REGISTER_PLUGIN_STATIC(PCSPK, PLUGIN_TYPE_MUSIC, PCSpeakerMusicPlugin);
+//#endif
+
+//#if PLUGIN_ENABLED_DYNAMIC(PCJR)
+ //REGISTER_PLUGIN_DYNAMIC(PCJR, PLUGIN_TYPE_MUSIC, PCjrMusicPlugin);
+//#else
+ REGISTER_PLUGIN_STATIC(PCJR, PLUGIN_TYPE_MUSIC, PCjrMusicPlugin);
+//#endif \ No newline at end of file