aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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; }
/**