From 50116130efedc66ec8261df6080fb7ca6fe079f7 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Mon, 8 Mar 2010 00:54:05 +0000 Subject: 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 --- sound/fmopl.cpp | 6 ++++++ sound/fmopl.h | 3 +-- 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", "", 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; } /** -- cgit v1.2.3