aboutsummaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorJohannes Schickel2010-03-08 00:54:05 +0000
committerJohannes Schickel2010-03-08 00:54:05 +0000
commit50116130efedc66ec8261df6080fb7ca6fe079f7 (patch)
treef4b9b56031797e398c3d10352778a2568b7ce3fc /sound
parentb8901a47419b0e8c98820fb8cad54d4e7dabc5b9 (diff)
downloadscummvm-rg350-50116130efedc66ec8261df6080fb7ca6fe079f7.tar.gz
scummvm-rg350-50116130efedc66ec8261df6080fb7ca6fe079f7.tar.bz2
scummvm-rg350-50116130efedc66ec8261df6080fb7ca6fe079f7.zip
Show an error message in case multiple OPL outputs are created instead of using an assert.
The new DBOPL emulator we are using should support multiple instances though. We *might* consider allowing as many instances as the user wants. Of course since the original games only had one OPL chip available, that should not be required. Also just in case we might allow real hardware as playback device that would be out of the question again too. svn-id: r48183
Diffstat (limited to 'sound')
-rw-r--r--sound/fmopl.cpp6
-rw-r--r--sound/fmopl.h3
2 files changed, 7 insertions, 2 deletions
diff --git a/sound/fmopl.cpp b/sound/fmopl.cpp
index f8f6b97fcc..8fdddc20f8 100644
--- a/sound/fmopl.cpp
+++ b/sound/fmopl.cpp
@@ -39,6 +39,12 @@ enum OplEmulator {
kDOSBox = 2
};
+OPL::OPL() {
+ if (_hasInstance)
+ error("There are multiple OPL output instances running.");
+ _hasInstance = true;
+}
+
const Config::EmulatorDescription Config::_drivers[] = {
{ "auto", "<default>", kAuto, kFlagOpl2 | kFlagDualOpl2 | kFlagOpl3 },
{ "mame", "MAME OPL emulator", kMame, kFlagOpl2 },
diff --git a/sound/fmopl.h b/sound/fmopl.h
index 2b0e9c1ab2..33235f3545 100644
--- a/sound/fmopl.h
+++ b/sound/fmopl.h
@@ -93,10 +93,9 @@ private:
class OPL {
private:
- // TODO: This is part of a temporary HACK to allow only 1 instance
static bool _hasInstance;
public:
- OPL() { assert(!_hasInstance); _hasInstance = true; }
+ OPL();
virtual ~OPL() { _hasInstance = false; }
/**