[Scummvm-git-logs] scummvm master -> 8fc4a08e04b947bc1ca01e716a7821fe41a03381

dreammaster dreammaster at scummvm.org
Mon Feb 19 16:19:28 CET 2018


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
8fc4a08e04 XEEN: Refactor to merge Sound and Music classes


Commit: 8fc4a08e04b947bc1ca01e716a7821fe41a03381
    https://github.com/scummvm/scummvm/commit/8fc4a08e04b947bc1ca01e716a7821fe41a03381
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2018-02-19T10:17:33-05:00

Commit Message:
XEEN: Refactor to merge Sound and Music classes

The existing structure didn't make sense, as Sound only handled
sound files, but Music handled both music and short FX decoding.
I've merged Sound & MUsic into a single Sound class, and moved
the music driver to their own file, renamed to SoundDriver

Changed paths:
  A engines/xeen/sound_driver.cpp
  A engines/xeen/sound_driver.h
  R engines/xeen/music.cpp
  R engines/xeen/music.h
    engines/xeen/cutscenes.cpp
    engines/xeen/locations.cpp
    engines/xeen/module.mk
    engines/xeen/sound.cpp
    engines/xeen/sound.h
    engines/xeen/worldofxeen/clouds_cutscenes.cpp
    engines/xeen/worldofxeen/darkside_cutscenes.cpp
    engines/xeen/worldofxeen/worldofxeen.cpp
    engines/xeen/worldofxeen/worldofxeen_cutscenes.cpp
    engines/xeen/xeen.cpp


diff --git a/engines/xeen/cutscenes.cpp b/engines/xeen/cutscenes.cpp
index 46a911e..05d9fa7 100644
--- a/engines/xeen/cutscenes.cpp
+++ b/engines/xeen/cutscenes.cpp
@@ -92,7 +92,7 @@ bool Cutscenes::subtitlesWait(uint minTime) {
 }
 
 bool Cutscenes::waitForLineOrSound() {
-	while (_vm->_sound->isPlaying() || _subtitleSize) {
+	while (_vm->_sound->isSoundPlaying() || _subtitleSize) {
 		showSubtitles();
 		_vm->_events->pollEventsAndWait();
 		if (_vm->_events->isKeyMousePressed())
diff --git a/engines/xeen/locations.cpp b/engines/xeen/locations.cpp
index 67abbd7..7a82905 100644
--- a/engines/xeen/locations.cpp
+++ b/engines/xeen/locations.cpp
@@ -146,7 +146,7 @@ void BaseLocation::drawAnim(bool flag) {
 
 	// TODO: Figure out a clean way to split method into individual location classes
 	if (_locationActionId == BLACKSMITH) {
-		if (sound.isPlaying()) {
+		if (sound.isSoundPlaying()) {
 			if (_isDarkCc) {
 				_townSprites[_drawFrameIndex / 8].draw(0, _drawFrameIndex % 8, _animPos);
 				_townSprites[2].draw(0, _vm->getRandomNumber(11) == 1 ? 9 : 10,
@@ -168,9 +168,9 @@ void BaseLocation::drawAnim(bool flag) {
 
 	switch (_locationActionId) {
 	case BANK:
-		if (sound.isPlaying() || (_isDarkCc && _animFrame)) {
+		if (sound.isSoundPlaying() || (_isDarkCc && _animFrame)) {
 			if (_isDarkCc) {
-				if (sound.isPlaying() || _animFrame == 1) {
+				if (sound.isSoundPlaying() || _animFrame == 1) {
 					_townSprites[4].draw(0, _vm->getRandomNumber(13, 18),
 						Common::Point(8, 30));
 				} else if (_animFrame > 1) {
@@ -186,7 +186,7 @@ void BaseLocation::drawAnim(bool flag) {
 		break;
 
 	case GUILD:
-		if (!sound.isPlaying()) {
+		if (!sound.isSoundPlaying()) {
 			if (_isDarkCc) {
 				if (_animFrame) {
 					_animFrame ^= 1;
@@ -199,20 +199,20 @@ void BaseLocation::drawAnim(bool flag) {
 		break;
 
 	case TAVERN:
-		if (sound.isPlaying() && _isDarkCc) {
+		if (sound.isSoundPlaying() && _isDarkCc) {
 			_townSprites[4].draw(0, _vm->getRandomNumber(7), Common::Point(153, 49));
 		}
 		break;
 
 	case TEMPLE:
-		if (sound.isPlaying()) {
+		if (sound.isSoundPlaying()) {
 			_townSprites[3].draw(0, _vm->getRandomNumber(2, 4), Common::Point(8, 8));
 
 		}
 		break;
 
 	case TRAINING:
-		if (sound.isPlaying()) {
+		if (sound.isSoundPlaying()) {
 			if (_isDarkCc) {
 				_townSprites[_drawFrameIndex / 8].draw(0, _drawFrameIndex % 8, _animPos);
 			}
@@ -1362,7 +1362,7 @@ int ReaperCutscene::show() {
 		checkEvents(g_vm);
 		if (g_vm->shouldExit() || _buttonValue)
 			goto exit;
-	} while (sound.isPlaying() || _subtitleCtr);
+	} while (sound.isSoundPlaying() || _subtitleCtr);
 
 	sprites2.draw(0, 0, Common::Point(0, 0));
 	if (_isDarkCc)
@@ -1393,7 +1393,7 @@ int ReaperCutscene::show() {
 		checkEvents(g_vm);
 		if (g_vm->shouldExit() || _buttonValue)
 			goto exit;
-	} while (!g_vm->shouldExit() && sound.isPlaying());
+	} while (!g_vm->shouldExit() && sound.isSoundPlaying());
 
 	sprites2.draw(0, 0, Common::Point(0, 0));
 	if (_isDarkCc)
@@ -1616,7 +1616,7 @@ int GolemCutscene::show() {
 			sprites2[0].draw(0, 2, Common::Point(idx + g_vm->getRandomNumber(9) - 5,
 				g_vm->getRandomNumber(9) - 5), SPRFLAG_800);
 		
-		if (!_isDarkCc && !sound.isPlaying())
+		if (!_isDarkCc && !sound.isSoundPlaying())
 			sound.playSound("ogre.voc");
 
 		events.wait(1);
@@ -1633,7 +1633,7 @@ int GolemCutscene::show() {
 		sprites2[0].draw(0, 2);
 
 	windows[0].update();
-	while (sound.isPlaying()) {
+	while (sound.isSoundPlaying()) {
 		events.updateGameCounter();
 
 		events.wait(1);
@@ -1666,7 +1666,7 @@ int GolemCutscene::show() {
 		checkEvents(g_vm);
 		if (g_vm->shouldExit() || _buttonValue)
 			goto exit;
-	} while (sound.isPlaying() || _subtitleCtr);
+	} while (sound.isSoundPlaying() || _subtitleCtr);
 
 	sprites1.draw(0, 0, Common::Point(0, 0));
 	sprites1.draw(0, 1, Common::Point(160, 0));
@@ -1681,7 +1681,7 @@ int GolemCutscene::show() {
 
 	if (!_isDarkCc) {
 		sound.playSound("ogre.voc");
-		while (!g_vm->shouldExit() && sound.isPlaying())
+		while (!g_vm->shouldExit() && sound.isSoundPlaying())
 			events.pollEventsAndWait();
 
 		sound.playSound(_mazeFlag ? "golem16.voc" : "golem14.voc");
@@ -1711,7 +1711,7 @@ int GolemCutscene::show() {
 		checkEvents(g_vm);
 		if (g_vm->shouldExit() || _buttonValue)
 			goto exit;
-	} while (!g_vm->shouldExit() && sound.isPlaying());
+	} while (!g_vm->shouldExit() && sound.isSoundPlaying());
 
 	sprites1.draw(0, 0, Common::Point(0, 0));
 	sprites1.draw(0, 1, Common::Point(160, 0));
@@ -1721,7 +1721,7 @@ int GolemCutscene::show() {
 		sprites2[0].draw(0, 2);
 
 	windows[0].update();
-	while (!g_vm->shouldExit() && sound.isPlaying()) {
+	while (!g_vm->shouldExit() && sound.isSoundPlaying()) {
 		events.updateGameCounter();
 		events.wait(1);
 		checkEvents(g_vm);
@@ -1984,7 +1984,7 @@ int DwarfCutscene::show() {
 				if (g_vm->shouldExit() || _buttonValue)
 					goto exit;
 			}
-		} while (sound.isPlaying() || _subtitleCtr);
+		} while (sound.isSoundPlaying() || _subtitleCtr);
 
 		while (!g_vm->shouldExit() && events.timeElapsed() < 3)
 			events.pollEventsAndWait();
@@ -2166,7 +2166,7 @@ int SphinxCutscene::show() {
 			checkEvents(g_vm);
 			if (g_vm->shouldExit() || _buttonValue)
 				goto exit;
-		} while (sound.isPlaying() || _subtitleCtr);
+		} while (sound.isSoundPlaying() || _subtitleCtr);
 
 		sprites1.draw(0, 0, Common::Point(0, 0));
 		sprites1.draw(0, 1, Common::Point(160, 0));
diff --git a/engines/xeen/module.mk b/engines/xeen/module.mk
index c464dbc..a7ac73e 100644
--- a/engines/xeen/module.mk
+++ b/engines/xeen/module.mk
@@ -40,13 +40,13 @@ MODULE_OBJS := \
 	interface_scene.o \
 	locations.o \
 	map.o \
-	music.o \
 	party.o \
 	resources.o \
 	saves.o \
 	screen.o \
 	scripts.o \
 	sound.o \
+	sound_driver.o \
 	spells.o \
 	sprites.o \
 	window.o \
diff --git a/engines/xeen/music.cpp b/engines/xeen/music.cpp
deleted file mode 100644
index b94c1d2..0000000
--- a/engines/xeen/music.cpp
+++ /dev/null
@@ -1,771 +0,0 @@
-/* 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.
- *
- */
-
-#include "common/md5.h"
-#include "common/config-manager.h"
-#include "xeen/music.h"
-#include "xeen/xeen.h"
-#include "xeen/files.h"
-
-namespace Xeen {
-
-#define CALLBACKS_PER_SECOND 73
-
-/*------------------------------------------------------------------------*/
-
-MusicDriver::MusicDriver() : _musicPlaying(false), _fxPlaying(false),
-		_musCountdownTimer(0), _fxCountdownTimer(0), _musDataPtr(nullptr),
-		_fxDataPtr(nullptr), _fxStartPtr(nullptr), _musStartPtr(nullptr),
-		_exclude7(false), _frameCtr(0) {
-	_channels.resize(CHANNEL_COUNT);
-}
-
-MusicDriver::~MusicDriver() {
-	_musicPlaying = _fxPlaying = false;
-	_musCountdownTimer = _fxCountdownTimer = 0;
-}
-
-void MusicDriver::execute() {
-	bool isFX = false;
-	const byte *srcP = nullptr;
-	const byte *startP = nullptr;
-
-	// Single iteration loop to avoid use of GOTO
-	do {
-		if (_musicPlaying) {
-			startP = _musStartPtr;
-			srcP = _musDataPtr;
-			isFX = false;
-			if (_musCountdownTimer == 0 || --_musCountdownTimer == 0)
-				break;
-		}
-
-		if (_fxPlaying) {
-			startP = _fxStartPtr;
-			srcP = _fxDataPtr;
-			isFX = true;
-			if (_fxCountdownTimer == 0 || --_fxCountdownTimer == 0)
-				break;
-		}
-
-		pausePostProcess();
-		return;
-	} while (0);
-
-	++_frameCtr;
-	debugC(3, kDebugSound, "\nMusicDriver frame - #%x", _frameCtr);
-
-	// Main loop
-	bool breakFlag = false;
-	while (!breakFlag) {
-		debugCN(3, kDebugSound, "MUSCODE %.4x - %.2x  ", (uint)(srcP - startP), (uint)*srcP);
-		byte nextByte = *srcP++;
-		int cmd = (nextByte >> 4) & 15;
-		int param = (nextByte & 15);
-
-		CommandFn fn = isFX ? FX_COMMANDS[cmd] : MUSIC_COMMANDS[cmd];
-		breakFlag = (this->*fn)(srcP, param);
-	}
-}
-
-
-bool MusicDriver::musCallSubroutine(const byte *&srcP, byte param) {
-	debugC(3, kDebugSound, "musCallSubroutine");
-	if (_musSubroutines.size() < 16) {
-		const byte *returnP = srcP + 2;
-		srcP = _musStartPtr + READ_LE_UINT16(srcP);
-
-		_musSubroutines.push(Subroutine(returnP, srcP));
-	}
-
-	return false;
-}
-
-bool MusicDriver::musSetCountdown(const byte *&srcP, byte param) {
-	// Set the countdown timer
-	if (!param)
-		param = *srcP++;
-	_musCountdownTimer = param;
-	_musDataPtr = srcP;
-	debugC(3, kDebugSound, "musSetCountdown %d", param);
-
-	// Do paused handling and break out of processing loop
-	pausePostProcess();
-	return true;
-}
-
-bool MusicDriver::cmdNoOperation(const byte *&srcP, byte param) {
-	debugC(3, kDebugSound, "cmdNoOperation");
-	return false;
-}
-
-bool MusicDriver::musSkipWord(const byte *&srcP, byte param) {
-	debugC(3, kDebugSound, "musSkipWord");
-	srcP += 2;
-	return false;
-}
-
-bool MusicDriver::cmdFreezeFrequency(const byte *&srcP, byte param) {
-	debugC(3, kDebugSound, "cmdFreezeFrequency %d", param);
-	_channels[param]._changeFrequency = false;
-	return false;
-}
-
-bool MusicDriver::cmdChangeFrequency(const byte *&srcP, byte param) {
-	debugC(3, kDebugSound, "cmdChangeFrequency %d", param);
-
-	if (param != 7 || !_exclude7) {
-		_channels[param]._freqCtrChange = (int8)*srcP++;
-		_channels[param]._freqCtr = 0xFF;
-		_channels[param]._changeFrequency = true;
-		_channels[param]._freqChange = (int16)READ_BE_UINT16(srcP);
-		srcP += 2;
-	} else {
-		srcP += 3;
-	}
-
-	return false;
-}
-
-bool MusicDriver::musEndSubroutine(const byte *&srcP, byte param) {
-	debugC(3, kDebugSound, "musEndSubroutine %d", param);
-
-	if (param != 15) {
-		// Music has ended, so flag it stopped
-		_musicPlaying = false;
-		return true;
-	}
-
-	// Returning from subroutine, or looping back to start of music
-	srcP = _musSubroutines.empty() ? _musStartPtr : _musSubroutines.pop()._returnP;
-	return false;
-}
-
-bool MusicDriver::fxCallSubroutine(const byte *&srcP, byte param) {
-	debugC(3, kDebugSound, "fxCallSubroutine");
-
-	if (_fxSubroutines.size() < 16) {
-		const byte *startP = srcP + 2;
-		srcP = _musStartPtr + READ_LE_UINT16(srcP);
-
-		_fxSubroutines.push(Subroutine(startP, srcP));
-	}
-
-	return false;
-}
-
-bool MusicDriver::fxSetCountdown(const byte *&srcP, byte param) {
-	// Set the countdown timer
-	if (!param)
-		param = *srcP++;
-	_fxCountdownTimer = param;
-	_fxDataPtr = srcP;
-	debugC(3, kDebugSound, "fxSetCountdown %d", param);
-
-	// Do paused handling and break out of processing loop
-	pausePostProcess();
-	return true;
-}
-
-bool MusicDriver::fxEndSubroutine(const byte *&srcP, byte param) {
-	debugC(3, kDebugSound, "fxEndSubroutine %d", param);
-
-	if (param != 15) {
-		// FX has ended, so flag it stopped
-		_fxPlaying = false;
-		return true;
-	}
-
-	srcP = _fxSubroutines.empty() ? _fxStartPtr : _fxSubroutines.pop()._returnP;
-	return false;
-}
-
-void MusicDriver::playFX(uint effectId, const byte *data) {
-	if (!_fxPlaying || effectId < 7 || effectId >= 11) {
-		_fxDataPtr = _fxStartPtr = data;
-		_fxCountdownTimer = 0;
-		_channels[7]._changeFrequency = _channels[8]._changeFrequency = false;
-		resetFX();
-		_fxPlaying = true;
-	}
-
-	debugC(1, kDebugSound, "Starting FX %d", effectId);
-}
-
-void MusicDriver::stopFX() {
-	resetFX();
-	_fxPlaying = false;
-	_fxStartPtr = _fxDataPtr = nullptr;
-}
-
-void MusicDriver::playSong(const byte *data) {
-	_musDataPtr = _musStartPtr = data;
-	_musSubroutines.clear();
-	_musCountdownTimer = 0;
-	_musicPlaying = true;
-	debugC(1, kDebugSound, "Starting song");
-}
-
-int MusicDriver::songCommand(uint commandId, byte volume) {
-	if (commandId == STOP_SONG) {
-		_musicPlaying = false;
-	} else if (commandId == RESTART_SONG) {
-		_musicPlaying = true;
-		_musDataPtr = nullptr;
-		_musSubroutines.clear();
-	}
-
-	return 0;
-}
-
-const CommandFn MusicDriver::MUSIC_COMMANDS[16] = {
-	&MusicDriver::musCallSubroutine,   &MusicDriver::musSetCountdown,
-	&MusicDriver::musSetInstrument,    &MusicDriver::cmdNoOperation,
-	&MusicDriver::musSetPitchWheel,    &MusicDriver::musSkipWord,
-	&MusicDriver::musSetPanning,       &MusicDriver::cmdNoOperation,
-	&MusicDriver::musFade,             &MusicDriver::musStartNote,
-	&MusicDriver::musSetVolume,        &MusicDriver::musInjectMidi,
-	&MusicDriver::musPlayInstrument,   &MusicDriver::cmdFreezeFrequency,
-	&MusicDriver::cmdChangeFrequency,  &MusicDriver::musEndSubroutine
-};
-
-const CommandFn MusicDriver::FX_COMMANDS[16] = {
-	&MusicDriver::fxCallSubroutine,    &MusicDriver::fxSetCountdown,
-	&MusicDriver::fxSetInstrument,     &MusicDriver::fxSetVolume,
-	&MusicDriver::fxMidiReset,         &MusicDriver::fxMidiDword,
-	&MusicDriver::fxSetPanning,        &MusicDriver::fxChannelOff,
-	&MusicDriver::fxFade,              &MusicDriver::fxStartNote,
-	&MusicDriver::cmdNoOperation,      &MusicDriver::fxInjectMidi,
-	&MusicDriver::fxPlayInstrument,    &MusicDriver::cmdFreezeFrequency,
-	&MusicDriver::cmdChangeFrequency,  &MusicDriver::fxEndSubroutine
-};
-
-/*------------------------------------------------------------------------*/
-
-AdlibMusicDriver::AdlibMusicDriver() : _field180(0), _field181(0), _field182(0),
-		_volume(127) {
-	Common::fill(&_musInstrumentPtrs[0], &_musInstrumentPtrs[16], (const byte *)nullptr);
-	Common::fill(&_fxInstrumentPtrs[0], &_fxInstrumentPtrs[16], (const byte *)nullptr);
-
-	_opl = OPL::Config::create();
-	_opl->init();
-	_opl->start(new Common::Functor0Mem<void, AdlibMusicDriver>(this, &AdlibMusicDriver::onTimer), CALLBACKS_PER_SECOND);
-	initialize();
-}
-
-AdlibMusicDriver::~AdlibMusicDriver() {
-	_opl->stop();
-	delete _opl;
-}
-
-void AdlibMusicDriver::onTimer() {
-	Common::StackLock slock(_driverMutex);
-	execute();
-	flush();
-}
-
-void AdlibMusicDriver::initialize() {
-	write(1, 0x20);
-	write(8, 0);
-	write(0xBD, 0);
-
-	resetFrequencies();
-	AdlibMusicDriver::resetFX();
-}
-
-void AdlibMusicDriver::playFX(uint effectId, const byte *data) {
-	Common::StackLock slock(_driverMutex);
-	MusicDriver::playFX(effectId, data);
-}
-
-void AdlibMusicDriver::playSong(const byte *data) {
-	Common::StackLock slock(_driverMutex);
-	MusicDriver::playSong(data);
-	_field180 = 0;
-	resetFrequencies();
-}
-
-int AdlibMusicDriver::songCommand(uint commandId, byte volume) {
-	Common::StackLock slock(_driverMutex);
-	MusicDriver::songCommand(commandId, volume);
-
-	if (commandId == STOP_SONG) {
-		_field180 = 0;
-		resetFrequencies();
-	} else if (commandId == RESTART_SONG) {
-		_field180 = 0;
-		_musicPlaying = true;
-	} else if (commandId < 0x100) {
-		if (_musicPlaying) {
-			_field180 = commandId;
-			_field182 = 63;
-		}
-	} else if (commandId == SET_VOLUME) {
-		_volume = volume;
-	} else if (commandId == GET_STATUS) {
-		return _field180;
-	}
-
-	return 0;
-}
-
-void AdlibMusicDriver::write(int reg, int val) {
-	_queue.push(RegisterValue(reg, val));
-	debugC(9, kDebugSound, "%.2x %.2x", reg, val);
-}
-
-void AdlibMusicDriver::flush() {
-	Common::StackLock slock(_driverMutex);
-
-	while (!_queue.empty()) {
-		RegisterValue v = _queue.pop();
-		_opl->writeReg(v._regNum, v._value);
-	}
-}
-
-void AdlibMusicDriver::pausePostProcess() {
-	if (_field180 && ((_field181 += _field180) < 0)) {
-		if (--_field182 < 0) {
-			_musicPlaying = false;
-			_field180 = 0;
-			resetFrequencies();
-		} else {
-			for (int channelNum = 6; channelNum >= 0; --channelNum) {
-				if (_channels[channelNum]._volume < 63)
-					setOutputLevel(channelNum, ++_channels[channelNum]._volume);
-			}
-		}
-	}
-
-	for (int channelNum = 8; channelNum > (_exclude7 ? 7 : 6); --channelNum) {
-		Channel &chan = _channels[channelNum];
-		if (!chan._changeFrequency || (chan._freqCtr += chan._freqCtrChange) >= 0)
-			continue;
-
-		uint freq = chan._frequency & 0x3FF;
-		uint val = chan._frequency >> 8;
-		byte val1 = val & 0x20;
-		byte val2 = val & 0x1C;
-
-		freq += chan._freqChange;
-		if (chan._freqChange < 0) {
-			if (freq <= 388) {
-				freq <<= 1;
-				if (!(freq & 0x3FF))
-					--freq;
-			}
-
-			val2 = (val2 - 4) & 0x1C;
-		} else {
-			if (freq >= 734) {
-				freq >>= 1;
-				if (!(freq & 0x3FF))
-					++freq;
-			}
-
-			val2 = (val2 + 4) & 0x1C;
-		}
-
-		freq &= 0x3FF;
-		freq |= (val2 << 8);
-		freq |= val1;
-		chan._frequency = freq;
-		setFrequency(channelNum, freq);
-	}
-}
-
-void AdlibMusicDriver::resetFX() {
-	if (!_exclude7) {
-		_channels[7]._frequency = 0;
-		setFrequency(7, 0);
-		_channels[7]._volume = 63;
-		setOutputLevel(7, 63);
-	}
-
-	_channels[8]._frequency = 0;
-	setFrequency(8, 0);
-	_channels[8]._volume = 63;
-	setOutputLevel(8, 63);
-}
-
-void AdlibMusicDriver::resetFrequencies() {
-	for (int opNum = 6; opNum >= 0; --opNum) {
-		_channels[opNum]._frequency = 0;
-		setFrequency(opNum, 0);
-	}
-}
-
-void AdlibMusicDriver::setFrequency(byte operatorNum, uint frequency) {
-	write(0xA0 + operatorNum, frequency & 0xff);
-	write(0xB0 + operatorNum, (frequency >> 8));
-}
-
-uint AdlibMusicDriver::calcFrequency(byte note) {
-	return WAVEFORMS[note & 0x1F] + ((note & 0xE0) << 5);
-}
-
-void AdlibMusicDriver::setOutputLevel(byte channelNum, uint level) {
-	write(0x40 + OPERATOR2_INDEXES[channelNum], level |
-		(_channels[channelNum]._scalingValue & 0xC0));
-}
-
-void AdlibMusicDriver::playInstrument(byte channelNum, const byte *data) {
-	byte op1 = OPERATOR1_INDEXES[channelNum];
-	byte op2 = OPERATOR2_INDEXES[channelNum];
-	debugC(2, kDebugSound, "---START-playInstrument - %d", channelNum);
-	write(0x20 + op1, *data++);
-	write(0x40 + op1, *data++);
-	write(0x60 + op1, *data++);
-	write(0x80 + op1, *data++);
-	write(0xE0 + op1, *data++);
-	write(0x20 + op2, *data++);
-
-	int scalingVal = *data++;
-	_channels[channelNum]._scalingValue = scalingVal;
-	scalingVal += (127 - _volume) / 2;
-
-	if (scalingVal > 63) {
-		scalingVal = 63;
-		if (_field180)
-			scalingVal = (scalingVal & 0xC0) | _field182;
-	}
-	write(0x40 + op2, scalingVal);
-
-	write(0x60 + op2, *data++);
-	write(0x80 + op2, *data++);
-	write(0xE0 + op2, *data++);
-	write(0xC0 + channelNum, *data++);
-
-	debugC(2, kDebugSound, "---END-playInstrument");
-}
-
-bool AdlibMusicDriver::musSetInstrument(const byte *&srcP, byte param) {
-	debugC(3, kDebugSound, "musSetInstrument %d", param);
-	_musInstrumentPtrs[param] = srcP;
-	srcP += 26;
-
-	return false;
-}
-
-bool AdlibMusicDriver::musSetPitchWheel(const byte *&srcP, byte param) {
-	// Adlib does not support this
-	debugC(3, kDebugSound, "musSetPitchWheel");
-	srcP += 2;
-	return false;
-}
-
-bool AdlibMusicDriver::musSetPanning(const byte *&srcP, byte param) {
-	// Adlib does not support this
-	debugC(3, kDebugSound, "musSetPanning");
-	++srcP;
-	return false;
-}
-
-bool AdlibMusicDriver::musFade(const byte *&srcP, byte param) {
-	++srcP;
-	if (param < 7)
-		setFrequency(param, _channels[param]._frequency);
-	debugC(3, kDebugSound, "musFade");
-
-	return false;
-}
-
-bool AdlibMusicDriver::musStartNote(const byte *&srcP, byte param) {
-	if (param < 7) {
-		byte note = *srcP++;
-		++srcP;		// Second byte is fade, which is unused by Adlib
-		uint freq = calcFrequency(note);
-		debugC(3, kDebugSound, "musStartNote %x -> %x", note, freq);
-
-		setFrequency(param, freq);
-		freq |= 0x2000;
-		_channels[param]._frequency = freq;
-		setFrequency(param, freq);
-	} else {
-		srcP += 2;
-		debugC(3, kDebugSound, "musStartNote skipped");
-	}
-
-	return false;
-}
-
-bool AdlibMusicDriver::musSetVolume(const byte *&srcP, byte param) {
-	debugC(3, kDebugSound, "musSetVolume %d", (int)*srcP);
-
-	if (*srcP++ == 5 && !_field180) {
-		_channels[param]._volume = *srcP;
-		setOutputLevel(param, *srcP);
-	}
-
-	++srcP;
-	return false;
-}
-
-bool AdlibMusicDriver::musInjectMidi(const byte *&srcP, byte param) {
-	// Adlib does not support MIDI. So simply keep skipping over bytes
-	// until an 'F7' byte is found that flags the end of the MIDI data
-	debugC(3, kDebugSound, "musInjectMidi");
-	while (*srcP++ != 0xF7)
-		;
-
-	return false;
-}
-
-bool AdlibMusicDriver::musPlayInstrument(const byte *&srcP, byte param) {
-	byte instrument = *srcP++;
-	debugC(3, kDebugSound, "musPlayInstrument %d, %d", param, instrument);
-
-	if (param < 7)
-		playInstrument(param, _musInstrumentPtrs[instrument]);
-
-	return false;
-}
-
-bool AdlibMusicDriver::fxSetInstrument(const byte *&srcP, byte param) {
-	debugC(3, kDebugSound, "fxSetInstrument %d", param);
-	_fxInstrumentPtrs[param] = srcP;
-	srcP += 11;
-
-	return false;
-}
-
-bool AdlibMusicDriver::fxSetVolume(const byte *&srcP, byte param) {
-	debugC(3, kDebugSound, "fxSetVolume %d", (int)*srcP);
-
-	if (!_field180 && (!_exclude7 || param != 7)) {
-		_channels[param]._volume = *srcP;
-		setOutputLevel(param, *srcP);
-	}
-
-	++srcP;
-	return false;
-}
-
-bool AdlibMusicDriver::fxMidiReset(const byte *&srcP, byte param) {
-	debugC(3, kDebugSound, "fxMidiReset");
-	return false;
-}
-
-bool AdlibMusicDriver::fxMidiDword(const byte *&srcP, byte param) {
-	debugC(3, kDebugSound, "fxMidiDword");
-	return false;
-}
-
-bool AdlibMusicDriver::fxSetPanning(const byte *&srcP, byte param) {
-	byte note = *srcP++;
-	debugC(3, kDebugSound, "fxSetPanning - %x", note);
-
-	if (!_exclude7 || param != 7) {
-		uint freq = calcFrequency(note);
-		setFrequency(param, freq);
-		_channels[param]._frequency = freq;
-	}
-
-	return false;
-}
-
-bool AdlibMusicDriver::fxChannelOff(const byte *&srcP, byte param) {
-	debugC(3, kDebugSound, "fxChannelOff %d", param);
-	_channels[param]._frequency &= ~0x2000;
-	write(0xB0 + param, _channels[param]._frequency);
-	return false;
-}
-
-bool AdlibMusicDriver::fxFade(const byte *&srcP, byte param) {
-	uint freq = calcFrequency(*srcP++);
-	debugC(3, kDebugSound, "fxFade %d %x", param, freq);
-
-	if (!_exclude7 || param != 7) {
-		_channels[param]._frequency = freq;
-		setFrequency(param, freq);
-	}
-
-	return false;
-}
-
-bool AdlibMusicDriver::fxStartNote(const byte *&srcP, byte param) {
-	if (!_exclude7 || param != 7) {
-		byte note = *srcP++;
-		uint freq = calcFrequency(note);
-		debugC(3, kDebugSound, "fxStartNote %x -> %x", note, freq);
-
-		setFrequency(param, freq);
-		freq |= 0x2000;
-		_channels[param]._frequency = freq;
-		setFrequency(param, freq);
-	} else {
-		++srcP;
-		debugC(3, kDebugSound, "fxStartNote skipped");
-	}
-
-	return false;
-}
-
-bool AdlibMusicDriver::fxInjectMidi(const byte *&srcP, byte param) {
-	// Surpringly, unlike the musInjectMidi, this version doesn't have
-	// any logic to skip over following MIDI data. Which must mean the opcode
-	// and/or it's data aren't present in the admus driver file
-	debugC(3, kDebugSound, "fxInjectMidi");
-	return false;
-}
-
-bool AdlibMusicDriver::fxPlayInstrument(const byte *&srcP, byte param) {
-	byte instrument = *srcP++;
-	debugC(3, kDebugSound, "fxPlayInstrument %d, %d", param, instrument);
-
-	if (!_exclude7 || param != 7)
-		playInstrument(param, _fxInstrumentPtrs[instrument]);
-
-	return false;
-}
-
-
-const byte AdlibMusicDriver::OPERATOR1_INDEXES[CHANNEL_COUNT] = {
-	0, 1, 2, 8, 9, 0xA, 0x10, 0x11, 0x12
-};
-
-const byte AdlibMusicDriver::OPERATOR2_INDEXES[CHANNEL_COUNT] = {
-	3, 4, 5, 0xB, 0xC, 0xD, 0x13, 0x14, 0x15
-};
-
-const uint AdlibMusicDriver::WAVEFORMS[24] = {
-	0, 347, 388, 436, 462, 519, 582, 646,
-	0, 362, 406, 455, 484, 542, 607, 680,
-	0, 327, 367, 412, 436, 489, 549, 618
-};
-
-/*------------------------------------------------------------------------*/
-
-Music::Music() : _musicDriver(nullptr), _songData(nullptr),
-		_effectsData(nullptr), _musicOn(true), _musicSide(0) {
-	_musicDriver = new AdlibMusicDriver();
-}
-
-Music::~Music() {
-	stopSong();
-	delete _musicDriver;
-	delete[] _effectsData;
-	delete[] _songData;
-}
-
-void Music::loadEffectsData() {
-	// Check whether it's the first load, or switching from intro to game data
-//	if (_effectsData && !(_archiveType == INTRO_ARCHIVE && File::_currentArchive != INTRO_ARCHIVE))
-//		return;
-
-	// Stop any prior FX
-	stopFX();
-	delete[] _effectsData;
-//	_archiveType = File::_currentArchive;
-
-	// Load in an entire driver so we have quick access to the effects data
-	// that's hardcoded within it
-	File file("blastmus");
-	byte *effectsData = new byte[file.size()];
-	file.seek(0);
-	file.read(effectsData, file.size());
-	file.close();
-	_effectsData = effectsData;
-
-	// Locate the playFX routine
-	const byte *fx = effectsData + READ_LE_UINT16(effectsData + 10) + 12;
-	assert(READ_BE_UINT16(fx + 28) == 0x81FB);
-	uint numEffects = READ_LE_UINT16(fx + 30);
-
-	assert(READ_BE_UINT16(fx + 36) == 0x8B87);
-	const byte *table = effectsData + READ_LE_UINT16(fx + 38);
-
-	// Extract the effects offsets
-	_effectsOffsets.resize(numEffects);
-	for (uint idx = 0; idx < numEffects; ++idx)
-		_effectsOffsets[idx] = READ_LE_UINT16(&table[idx * 2]);
-}
-
-void Music::playFX(uint effectId) {
-	stopFX();
-	loadEffectsData();
-
-	if (effectId < _effectsOffsets.size()) {
-		const byte *dataP = &_effectsData[_effectsOffsets[effectId]];
-		_musicDriver->playFX(effectId, dataP);
-	}
-}
-
-void Music::stopFX() {
-	_musicDriver->stopFX();
-}
-
-int Music::songCommand(uint commandId, byte volume) {
-	int result = _musicDriver->songCommand(commandId, volume);
-	if (commandId == STOP_SONG) {
-		delete[] _songData;
-		_songData = nullptr;
-	}
-
-	return result;
-}
-
-void Music::playSong(Common::SeekableReadStream &stream) {
-	stopSong();
-	if (!_musicOn)
-		return;
-
-	byte *songData = new byte[stream.size()];
-	stream.seek(0);
-	stream.read(songData, stream.size());
-	_songData = songData;
-
-	_musicDriver->playSong(_songData);
-}
-
-void Music::playSong(const Common::String &name, int param) {
-	_priorMusic = _currentMusic;
-	_currentMusic = name;
-
-	Common::File mf;
-	if (mf.open(name)) {
-		playSong(mf);
-	} else {
-		File f(name, _musicSide);
-		playSong(f);
-	}
-}
-
-void Music::setMusicOn(bool isOn) {
-	ConfMan.setBool("music_mute", !isOn);
-	if (isOn)
-		ConfMan.setBool("mute", false);
-
-	g_vm->syncSoundSettings();
-}
-
-void Music::updateSoundSettings() {
-	_musicOn = !ConfMan.getBool("music_mute");
-	if (!_musicOn)
-		stopSong();
-}
-
-bool Music::isMusicPlaying() const {
-	return _musicDriver->isPlaying();
-}
-
-} // End of namespace Xeen
diff --git a/engines/xeen/music.h b/engines/xeen/music.h
deleted file mode 100644
index ac1f784..0000000
--- a/engines/xeen/music.h
+++ /dev/null
@@ -1,396 +0,0 @@
-/* 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.
- *
- */
-
-#ifndef XEEN_MUSIC_H
-#define XEEN_MUSIC_H
-
-#include "audio/fmopl.h"
-#include "audio/mixer.h"
-#include "common/array.h"
-#include "common/mutex.h"
-#include "common/queue.h"
-#include "common/stack.h"
-#include "xeen/files.h"
-
-#define CHANNEL_COUNT 9
-
-namespace OPL {
-	class OPL;
-}
-
-namespace Xeen {
-
-enum MusicCommand {
-	STOP_SONG = 0, RESTART_SONG = 1, SET_VOLUME = 0x100,
-	GET_STATUS = 0xFFE0
-};
-
-class MusicDriver;
-
-typedef bool (MusicDriver::*CommandFn)(const byte *&srcP, byte param);
-
-/**
- * Base class for music drivers
- */
-class MusicDriver {
-protected:
-	struct Subroutine {
-		const byte *_returnP;
-		const byte *_jumpP;
-		Subroutine() : _returnP(nullptr), _jumpP(nullptr) {}
-		Subroutine(const byte *returnP, const byte *endP) :
-			_returnP(returnP), _jumpP(endP) {}
-	};
-	struct Channel {
-		bool _changeFrequency;
-		int _freqCtrChange;
-		int _freqChange;
-		int _freqCtr;
-		byte _volume;
-		byte _scalingValue;
-		uint _frequency;
-		Channel() : _changeFrequency(false), _freqCtr(0), _freqCtrChange(0),
-			_freqChange(0), _volume(0), _scalingValue(0), _frequency(0) {}
-	};
-private:
-	static const CommandFn FX_COMMANDS[16];
-	static const CommandFn MUSIC_COMMANDS[16];
-private:
-	Common::Stack<Subroutine> _musSubroutines, _fxSubroutines;
-	int _musCountdownTimer;
-	int _fxCountdownTimer;
-	const byte *_fxDataPtr, *_musDataPtr;
-	const byte *_fxStartPtr;
-	const byte *_musStartPtr;
-	uint _frameCtr;
-private:
-	/**
-	 * Executes the next command
-	 * @param srcP		Command data pointer
-	 * @returns		If true, execution of commands for the current timer call stops
-	 */
-	bool command(const byte *&srcP);
-protected:
-	Common::Array<Channel> _channels;
-	bool _exclude7;
-	bool _musicPlaying;
-	bool _fxPlaying;
-protected:
-	/**
-	 * Executes a series of commands until instructed to stop
-	 */
-	void execute();
-
-	// Music commands (with some also used by FX)
-	virtual bool musCallSubroutine(const byte *&srcP, byte param);
-	virtual bool musSetCountdown(const byte *&srcP, byte param);
-	virtual bool musSetInstrument(const byte *&srcP, byte param) = 0;
-	virtual bool cmdNoOperation(const byte *&srcP, byte param);
-	virtual bool musSetPitchWheel(const byte *&srcP, byte param) = 0;
-	virtual bool musSkipWord(const byte *&srcP, byte param);
-	virtual bool musSetPanning(const byte *&srcP, byte param) = 0;
-	virtual bool musFade(const byte *&srcP, byte param) = 0;
-	virtual bool musStartNote(const byte *&srcP, byte param) = 0;
-	virtual bool musSetVolume(const byte *&srcP, byte param) = 0;
-	virtual bool musInjectMidi(const byte *&srcP, byte param) = 0;
-	virtual bool musPlayInstrument(const byte *&srcP, byte param) = 0;
-	virtual bool cmdFreezeFrequency(const byte *&srcP, byte param);
-	virtual bool cmdChangeFrequency(const byte *&srcP, byte param);
-	virtual bool musEndSubroutine(const byte *&srcP, byte param);
-
-	// FX commands
-	virtual bool fxCallSubroutine(const byte *&srcP, byte param);
-	virtual bool fxSetCountdown(const byte *&srcP, byte param);
-	virtual bool fxSetInstrument(const byte *&srcP, byte param) = 0;
-	virtual bool fxSetVolume(const byte *&srcP, byte param) = 0;
-	virtual bool fxMidiReset(const byte *&srcP, byte param) = 0;
-	virtual bool fxMidiDword(const byte *&srcP, byte param) = 0;
-	virtual bool fxSetPanning(const byte *&srcP, byte param) = 0;
-	virtual bool fxChannelOff(const byte *&srcP, byte param) = 0;
-	virtual bool fxFade(const byte *&srcP, byte param) = 0;
-	virtual bool fxStartNote(const byte *&srcP, byte param) = 0;
-	virtual bool fxInjectMidi(const byte *&srcP, byte param) = 0;
-	virtual bool fxPlayInstrument(const byte *&srcP, byte param) = 0;
-	virtual bool fxEndSubroutine(const byte *&srcP, byte param);
-
-	/**
-	 * Post-processing done when a pause countdown starts or is in progress
-	 */
-	virtual void pausePostProcess() = 0;
-
-	/**
-	 * Does a reset of any sound effect
-	 */
-	virtual void resetFX() = 0;
-public:
-	/**
-	 * Constructor
-	 */
-	MusicDriver();
-
-	/**
-	 * Destructor
-	 */
-	virtual ~MusicDriver();
-
-	/**
-	 * Starts an special effect playing
-	 */
-	virtual void playFX(uint effectId, const byte *data);
-
-	/**
-	 * Stop any playing FX
-	 */
-	void stopFX();
-
-	/**
-	 * Plays a song
-	 */
-	virtual void playSong(const byte *data);
-
-	/**
-	 * Executes special music command
-	 */
-	virtual int songCommand(uint commandId, byte volume = 0);
-
-	/**
-	 * Returns whether music is currently playing
-	 */
-	bool isPlaying() const { return _musicPlaying; }
-};
-
-class AdlibMusicDriver : public MusicDriver {
-	struct RegisterValue {
-		uint8 _regNum;
-		uint8 _value;
-
-		RegisterValue(int regNum, int value) {
-			_regNum = regNum; _value = value;
-		}
-	};
-private:
-	static const byte OPERATOR1_INDEXES[CHANNEL_COUNT];
-	static const byte OPERATOR2_INDEXES[CHANNEL_COUNT];
-	static const uint WAVEFORMS[24];
-private:
-	OPL::OPL *_opl;
-	Common::Queue<RegisterValue> _queue;
-	Common::Mutex _driverMutex;
-	const byte *_musInstrumentPtrs[16];
-	const byte *_fxInstrumentPtrs[16];
-	int _field180;
-	int _field181;
-	int _field182;
-	int _volume;
-private:
-	/**
-	 * Initializes the state of the Adlib OPL driver
-	 */
-	void initialize();
-
-	/**
-	 * Adds a register write to the pending queue that will be flushed
-	 * out to the OPL on the next timer call
-	 */
-	void write(int reg, int val);
-
-	/**
-	 * Timer function for OPL
-	 */
-	void onTimer();
-
-	/**
-	 * Flushes any pending writes to the OPL
-	 */
-	void flush();
-
-	/**
-	 * Resets all the output frequencies
-	 */
-	void resetFrequencies();
-
-	/**
-	 * Sets the frequency for an operator
-	 */
-	void setFrequency(byte operatorNum, uint frequency);
-
-	/**
-	 * Calculates the frequency for a note
-	 */
-	uint calcFrequency(byte note);
-
-	/**
-	 * Sets the output level for a channel
-	 */
-	void setOutputLevel(byte channelNum, uint level);
-
-	/**
-	 * Starts playing an instrument
-	 */
-	void playInstrument(byte channelNum, const byte *data);
-protected:
-	virtual bool musSetInstrument(const byte *&srcP, byte param);
-	virtual bool musSetPitchWheel(const byte *&srcP, byte param);
-	virtual bool musSetPanning(const byte *&srcP, byte param);
-	virtual bool musFade(const byte *&srcP, byte param);
-	virtual bool musStartNote(const byte *&srcP, byte param);
-	virtual bool musSetVolume(const byte *&srcP, byte param);
-	virtual bool musInjectMidi(const byte *&srcP, byte param);
-	virtual bool musPlayInstrument(const byte *&srcP, byte param);
-
-	virtual bool fxSetInstrument(const byte *&srcP, byte param);
-	virtual bool fxSetVolume(const byte *&srcP, byte param);
-	virtual bool fxMidiReset(const byte *&srcP, byte param);
-	virtual bool fxMidiDword(const byte *&srcP, byte param);
-	virtual bool fxSetPanning(const byte *&srcP, byte param);
-	virtual bool fxChannelOff(const byte *&srcP, byte param);
-	virtual bool fxFade(const byte *&srcP, byte param);
-	virtual bool fxStartNote(const byte *&srcP, byte param);
-	virtual bool fxInjectMidi(const byte *&srcP, byte param);
-	virtual bool fxPlayInstrument(const byte *&srcP, byte param);
-
-	/**
-	 * Post-processing done when a pause countdown starts or is in progress
-	 */
-	virtual void pausePostProcess();
-
-	/**
-	 * Does a reset of any sound effect
-	 */
-	virtual void resetFX();
-public:
-	/**
-	 * Constructor
-	 */
-	AdlibMusicDriver();
-
-	/**
-	 * Destructor
-	 */
-	virtual ~AdlibMusicDriver();
-
-	/**
-	 * Starts an special effect playing
-	 */
-	virtual void playFX(uint effectId, const byte *data);
-
-	/**
-	 * Plays a song
-	 */
-	virtual void playSong(const byte *data);
-
-	/**
-	 * Executes special music command
-	 */
-	virtual int songCommand(uint commandId, byte volume = 0);
-};
-
-class Music {
-private:
-	MusicDriver *_musicDriver;
-	const byte *_effectsData;
-	Common::Array<uint16> _effectsOffsets;
-	const byte *_songData;
-private:
-	/**
-	 * Loads effects data that was embedded in the music driver
-	 */
-	void loadEffectsData();
-
-	/**
-	 * Updates any playing music
-	 */
-	void update();
-public:
-	bool _musicOn;
-	Common::String _currentMusic, _priorMusic;
-	int _musicSide;
-public:
-	Music();
-	virtual ~Music();
-
-	/**
-	 * Starts an effect playing
-	 */
-	void playFX(uint effectId);
-
-	/**
-	 * Stops any currently playing FX
-	 */
-	void stopFX();
-
-	/**
-	 * Executes special music command
-	 */
-	int songCommand(uint commandId, byte volume = 0);
-
-	/**
-	 * Stops any currently playing music
-	 */
-	void stopSong() { songCommand(STOP_SONG); }
-
-	/**
-	 * Restart a previously playing song (which must still be loaded)
-	 */
-	void restartSong() { songCommand(RESTART_SONG); }
-
-	/**
-	 * Sets the music volume
-	 */
-	void setMusicVolume(byte volume) { songCommand(SET_VOLUME, volume); }
-
-	/**
-	 * Plays a song
-	 */
-	void playSong(Common::SeekableReadStream &stream);
-
-	/**
-	 * Plays a song
-	 */
-	void playSong(const Common::String &name, int param = 0);
-
-	/**
-	 * Plays a song
-	 */
-	void playSong(const byte *data) {
-		_musicDriver->playSong(data);
-	}
-
-	/**
-	 * Returns true if music is playing
-	 */
-	bool isMusicPlaying() const;
-
-	/**
-	 * Sets whether music is on
-	 */
-	void setMusicOn(bool isOn);
-
-	/**
-	 * Called to reload sound settings
-	 */
-	virtual void updateSoundSettings();
-};
-
-} // End of namespace Xeen
-
-#endif /* XEEN_MUSIC_H */
diff --git a/engines/xeen/sound.cpp b/engines/xeen/sound.cpp
index bfd2082..2fb8807 100644
--- a/engines/xeen/sound.cpp
+++ b/engines/xeen/sound.cpp
@@ -28,14 +28,17 @@
 
 namespace Xeen {
 
-/*------------------------------------------------------------------------*/
-
-Sound::Sound(XeenEngine *vm, Audio::Mixer *mixer): Music(),
-		_mixer(mixer), _soundOn(true) {
+Sound::Sound(Audio::Mixer *mixer) : _mixer(mixer), _soundOn(true), _musicOn(true),
+		_songData(nullptr), _effectsData(nullptr), _musicSide(0) {
+	_SoundDriver = new AdlibSoundDriver();
 }
 
 Sound::~Sound() {
-	stopSound();
+	stopAllAudio();
+
+	delete _SoundDriver;
+	delete[] _effectsData;
+	delete[] _songData;
 }
 
 void Sound::playSound(Common::SeekableReadStream &s, int unused) {
@@ -70,7 +73,7 @@ void Sound::stopSound() {
 	_mixer->stopHandle(_soundHandle);
 }
 
-bool Sound::isPlaying() const {
+bool Sound::isSoundPlaying() const {
 	return _mixer->isSoundHandleActive(_soundHandle);
 }
 
@@ -93,7 +96,100 @@ void Sound::updateSoundSettings() {
 	if (!_soundOn)
 		stopFX();
 
-	Music::updateSoundSettings();
+	_musicOn = !ConfMan.getBool("music_mute");
+	if (!_musicOn)
+		stopSong();
+}
+
+void Sound::loadEffectsData() {
+	// Stop any prior FX
+	stopFX();
+	delete[] _effectsData;
+
+	// Load in an entire driver so we have quick access to the effects data
+	// that's hardcoded within it
+	File file("blastmus");
+	byte *effectsData = new byte[file.size()];
+	file.seek(0);
+	file.read(effectsData, file.size());
+	file.close();
+	_effectsData = effectsData;
+
+	// Locate the playFX routine
+	const byte *fx = effectsData + READ_LE_UINT16(effectsData + 10) + 12;
+	assert(READ_BE_UINT16(fx + 28) == 0x81FB);
+	uint numEffects = READ_LE_UINT16(fx + 30);
+
+	assert(READ_BE_UINT16(fx + 36) == 0x8B87);
+	const byte *table = effectsData + READ_LE_UINT16(fx + 38);
+
+	// Extract the effects offsets
+	_effectsOffsets.resize(numEffects);
+	for (uint idx = 0; idx < numEffects; ++idx)
+		_effectsOffsets[idx] = READ_LE_UINT16(&table[idx * 2]);
+}
+
+void Sound::playFX(uint effectId) {
+	stopFX();
+	loadEffectsData();
+
+	if (effectId < _effectsOffsets.size()) {
+		const byte *dataP = &_effectsData[_effectsOffsets[effectId]];
+		_SoundDriver->playFX(effectId, dataP);
+	}
+}
+
+void Sound::stopFX() {
+	_SoundDriver->stopFX();
+}
+
+int Sound::songCommand(uint commandId, byte volume) {
+	int result = _SoundDriver->songCommand(commandId, volume);
+	if (commandId == STOP_SONG) {
+		delete[] _songData;
+		_songData = nullptr;
+	}
+
+	return result;
+}
+
+void Sound::playSong(Common::SeekableReadStream &stream) {
+	stopSong();
+	if (!_musicOn)
+		return;
+
+	byte *songData = new byte[stream.size()];
+	stream.seek(0);
+	stream.read(songData, stream.size());
+	_songData = songData;
+
+	_SoundDriver->playSong(_songData);
+}
+
+void Sound::playSong(const Common::String &name, int param) {
+	_priorMusic = _currentMusic;
+	_currentMusic = name;
+
+	Common::File mf;
+	if (mf.open(name)) {
+		playSong(mf);
+	}
+	else {
+		File f(name, _musicSide);
+		playSong(f);
+	}
+}
+
+void Sound::setMusicOn(bool isOn) {
+	ConfMan.setBool("music_mute", !isOn);
+	if (isOn)
+		ConfMan.setBool("mute", false);
+
+	g_vm->syncSoundSettings();
+}
+
+bool Sound::isMusicPlaying() const {
+	return _SoundDriver->isPlaying();
 }
 
 } // End of namespace Xeen
diff --git a/engines/xeen/sound.h b/engines/xeen/sound.h
index f474063..ab71af9 100644
--- a/engines/xeen/sound.h
+++ b/engines/xeen/sound.h
@@ -25,24 +25,107 @@
 
 #include "audio/mixer.h"
 #include "audio/audiostream.h"
-//#include "common/scummsys.h"
-//#include "common/system.h"
 #include "xeen/files.h"
-#include "xeen/music.h"
+#include "xeen/sound_driver.h"
 
 namespace Xeen {
 
-class Sound : public Music {
+
+class Sound {
 private:
+	SoundDriver *_SoundDriver;
+	const byte *_effectsData;
+	Common::Array<uint16> _effectsOffsets;
+	const byte *_songData;
 	Audio::Mixer *_mixer;
 	Audio::SoundHandle _soundHandle;
+private:
+	/**
+	 * Loads effects data that was embedded in the music driver
+	 */
+	void loadEffectsData();
+
+	/**
+	 * Updates any playing music
+	 */
+	void update();
 public:
 	bool _soundOn;
+	bool _musicOn;
+	Common::String _currentMusic, _priorMusic;
+	int _musicSide;
 public:
-	Sound(XeenEngine *vm, Audio::Mixer *mixer);
+	Sound(Audio::Mixer *mixer);
 	virtual ~Sound();
 
 	/**
+	 * Starts an effect playing
+	 */
+	void playFX(uint effectId);
+
+	/**
+	 * Stops any currently playing FX
+	 */
+	void stopFX();
+
+	/**
+	 * Executes special music command
+	 */
+	int songCommand(uint commandId, byte volume = 0);
+
+	/**
+	 * Stops any currently playing music
+	 */
+	void stopSong() { songCommand(STOP_SONG); }
+
+	/**
+	 * Restart a previously playing song (which must still be loaded)
+	 */
+	void restartSong() { songCommand(RESTART_SONG); }
+
+	/**
+	 * Sets the music volume
+	 */
+	void setMusicVolume(byte volume) { songCommand(SET_VOLUME, volume); }
+
+	/**
+	 * Plays a song
+	 */
+	void playSong(Common::SeekableReadStream &stream);
+
+	/**
+	 * Plays a song
+	 */
+	void playSong(const Common::String &name, int param = 0);
+
+	/**
+	 * Plays a song
+	 */
+	void playSong(const byte *data) {
+		_SoundDriver->playSong(data);
+	}
+
+	/**
+	 * Returns true if music is playing
+	 */
+	bool isMusicPlaying() const;
+
+	/**
+	 * Sets whether music is on
+	 */
+	void setMusicOn(bool isOn);
+
+	/**
+	* Sets whether sound effects is on
+	*/
+	void setEffectsOn(bool isOn);
+
+	/**
+	 * Called to reload sound settings
+	 */
+	void updateSoundSettings();
+
+	/**
 	 * Play a given sound
 	 */
 	void playSound(Common::SeekableReadStream &s, int unused = 0);
@@ -58,32 +141,21 @@ public:
 	void playSound(const Common::String &name, int ccNum, int unused);
 
 	/**
-	 * Stop playing a sound
+	 * Stop playing a sound loaded from a .m file
 	 * @remarks		In the original, passing 1 to playSound stopped the sound
 	 */
 	void stopSound();
 
 	/**
-	 * Returns true if a sound is currently playing
+	 * Returns true if a sound file is currently playing
 	 * @remarks		In the original, passing 0 to playSound returned play status
 	 */
-	bool isPlaying() const;
+	bool isSoundPlaying() const;
 
 	/**
 	 * Stops all playing music, FX, and sound samples
 	 */
 	void stopAllAudio();
-
-	/**
-	 * Sets whether sound effects is on
-	 */
-	void setEffectsOn(bool isOn);
-
-	/**
-	 * Called to reload sound settings
-	 */
-	virtual void updateSoundSettings();
-
 };
 
 } // End of namespace Xeen
diff --git a/engines/xeen/sound_driver.cpp b/engines/xeen/sound_driver.cpp
new file mode 100644
index 0000000..e79fcdd
--- /dev/null
+++ b/engines/xeen/sound_driver.cpp
@@ -0,0 +1,657 @@
+/* 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.
+ *
+ */
+
+#include "common/md5.h"
+#include "common/config-manager.h"
+#include "xeen/sound_driver.h"
+#include "xeen/xeen.h"
+#include "xeen/files.h"
+
+namespace Xeen {
+
+#define CALLBACKS_PER_SECOND 73
+
+/*------------------------------------------------------------------------*/
+
+SoundDriver::SoundDriver() : _musicPlaying(false), _fxPlaying(false),
+		_musCountdownTimer(0), _fxCountdownTimer(0), _musDataPtr(nullptr),
+		_fxDataPtr(nullptr), _fxStartPtr(nullptr), _musStartPtr(nullptr),
+		_exclude7(false), _frameCtr(0) {
+	_channels.resize(CHANNEL_COUNT);
+}
+
+SoundDriver::~SoundDriver() {
+	_musicPlaying = _fxPlaying = false;
+	_musCountdownTimer = _fxCountdownTimer = 0;
+}
+
+void SoundDriver::execute() {
+	bool isFX = false;
+	const byte *srcP = nullptr;
+	const byte *startP = nullptr;
+
+	// Single iteration loop to avoid use of GOTO
+	do {
+		if (_musicPlaying) {
+			startP = _musStartPtr;
+			srcP = _musDataPtr;
+			isFX = false;
+			if (_musCountdownTimer == 0 || --_musCountdownTimer == 0)
+				break;
+		}
+
+		if (_fxPlaying) {
+			startP = _fxStartPtr;
+			srcP = _fxDataPtr;
+			isFX = true;
+			if (_fxCountdownTimer == 0 || --_fxCountdownTimer == 0)
+				break;
+		}
+
+		pausePostProcess();
+		return;
+	} while (0);
+
+	++_frameCtr;
+	debugC(3, kDebugSound, "\nSoundDriver frame - #%x", _frameCtr);
+
+	// Main loop
+	bool breakFlag = false;
+	while (!breakFlag) {
+		debugCN(3, kDebugSound, "MUSCODE %.4x - %.2x  ", (uint)(srcP - startP), (uint)*srcP);
+		byte nextByte = *srcP++;
+		int cmd = (nextByte >> 4) & 15;
+		int param = (nextByte & 15);
+
+		CommandFn fn = isFX ? FX_COMMANDS[cmd] : MUSIC_COMMANDS[cmd];
+		breakFlag = (this->*fn)(srcP, param);
+	}
+}
+
+
+bool SoundDriver::musCallSubroutine(const byte *&srcP, byte param) {
+	debugC(3, kDebugSound, "musCallSubroutine");
+	if (_musSubroutines.size() < 16) {
+		const byte *returnP = srcP + 2;
+		srcP = _musStartPtr + READ_LE_UINT16(srcP);
+
+		_musSubroutines.push(Subroutine(returnP, srcP));
+	}
+
+	return false;
+}
+
+bool SoundDriver::musSetCountdown(const byte *&srcP, byte param) {
+	// Set the countdown timer
+	if (!param)
+		param = *srcP++;
+	_musCountdownTimer = param;
+	_musDataPtr = srcP;
+	debugC(3, kDebugSound, "musSetCountdown %d", param);
+
+	// Do paused handling and break out of processing loop
+	pausePostProcess();
+	return true;
+}
+
+bool SoundDriver::cmdNoOperation(const byte *&srcP, byte param) {
+	debugC(3, kDebugSound, "cmdNoOperation");
+	return false;
+}
+
+bool SoundDriver::musSkipWord(const byte *&srcP, byte param) {
+	debugC(3, kDebugSound, "musSkipWord");
+	srcP += 2;
+	return false;
+}
+
+bool SoundDriver::cmdFreezeFrequency(const byte *&srcP, byte param) {
+	debugC(3, kDebugSound, "cmdFreezeFrequency %d", param);
+	_channels[param]._changeFrequency = false;
+	return false;
+}
+
+bool SoundDriver::cmdChangeFrequency(const byte *&srcP, byte param) {
+	debugC(3, kDebugSound, "cmdChangeFrequency %d", param);
+
+	if (param != 7 || !_exclude7) {
+		_channels[param]._freqCtrChange = (int8)*srcP++;
+		_channels[param]._freqCtr = 0xFF;
+		_channels[param]._changeFrequency = true;
+		_channels[param]._freqChange = (int16)READ_BE_UINT16(srcP);
+		srcP += 2;
+	} else {
+		srcP += 3;
+	}
+
+	return false;
+}
+
+bool SoundDriver::musEndSubroutine(const byte *&srcP, byte param) {
+	debugC(3, kDebugSound, "musEndSubroutine %d", param);
+
+	if (param != 15) {
+		// Music has ended, so flag it stopped
+		_musicPlaying = false;
+		return true;
+	}
+
+	// Returning from subroutine, or looping back to start of music
+	srcP = _musSubroutines.empty() ? _musStartPtr : _musSubroutines.pop()._returnP;
+	return false;
+}
+
+bool SoundDriver::fxCallSubroutine(const byte *&srcP, byte param) {
+	debugC(3, kDebugSound, "fxCallSubroutine");
+
+	if (_fxSubroutines.size() < 16) {
+		const byte *startP = srcP + 2;
+		srcP = _musStartPtr + READ_LE_UINT16(srcP);
+
+		_fxSubroutines.push(Subroutine(startP, srcP));
+	}
+
+	return false;
+}
+
+bool SoundDriver::fxSetCountdown(const byte *&srcP, byte param) {
+	// Set the countdown timer
+	if (!param)
+		param = *srcP++;
+	_fxCountdownTimer = param;
+	_fxDataPtr = srcP;
+	debugC(3, kDebugSound, "fxSetCountdown %d", param);
+
+	// Do paused handling and break out of processing loop
+	pausePostProcess();
+	return true;
+}
+
+bool SoundDriver::fxEndSubroutine(const byte *&srcP, byte param) {
+	debugC(3, kDebugSound, "fxEndSubroutine %d", param);
+
+	if (param != 15) {
+		// FX has ended, so flag it stopped
+		_fxPlaying = false;
+		return true;
+	}
+
+	srcP = _fxSubroutines.empty() ? _fxStartPtr : _fxSubroutines.pop()._returnP;
+	return false;
+}
+
+void SoundDriver::playFX(uint effectId, const byte *data) {
+	if (!_fxPlaying || effectId < 7 || effectId >= 11) {
+		_fxDataPtr = _fxStartPtr = data;
+		_fxCountdownTimer = 0;
+		_channels[7]._changeFrequency = _channels[8]._changeFrequency = false;
+		resetFX();
+		_fxPlaying = true;
+	}
+
+	debugC(1, kDebugSound, "Starting FX %d", effectId);
+}
+
+void SoundDriver::stopFX() {
+	resetFX();
+	_fxPlaying = false;
+	_fxStartPtr = _fxDataPtr = nullptr;
+}
+
+void SoundDriver::playSong(const byte *data) {
+	_musDataPtr = _musStartPtr = data;
+	_musSubroutines.clear();
+	_musCountdownTimer = 0;
+	_musicPlaying = true;
+	debugC(1, kDebugSound, "Starting song");
+}
+
+int SoundDriver::songCommand(uint commandId, byte volume) {
+	if (commandId == STOP_SONG) {
+		_musicPlaying = false;
+	} else if (commandId == RESTART_SONG) {
+		_musicPlaying = true;
+		_musDataPtr = nullptr;
+		_musSubroutines.clear();
+	}
+
+	return 0;
+}
+
+const CommandFn SoundDriver::MUSIC_COMMANDS[16] = {
+	&SoundDriver::musCallSubroutine,   &SoundDriver::musSetCountdown,
+	&SoundDriver::musSetInstrument,    &SoundDriver::cmdNoOperation,
+	&SoundDriver::musSetPitchWheel,    &SoundDriver::musSkipWord,
+	&SoundDriver::musSetPanning,       &SoundDriver::cmdNoOperation,
+	&SoundDriver::musFade,             &SoundDriver::musStartNote,
+	&SoundDriver::musSetVolume,        &SoundDriver::musInjectMidi,
+	&SoundDriver::musPlayInstrument,   &SoundDriver::cmdFreezeFrequency,
+	&SoundDriver::cmdChangeFrequency,  &SoundDriver::musEndSubroutine
+};
+
+const CommandFn SoundDriver::FX_COMMANDS[16] = {
+	&SoundDriver::fxCallSubroutine,    &SoundDriver::fxSetCountdown,
+	&SoundDriver::fxSetInstrument,     &SoundDriver::fxSetVolume,
+	&SoundDriver::fxMidiReset,         &SoundDriver::fxMidiDword,
+	&SoundDriver::fxSetPanning,        &SoundDriver::fxChannelOff,
+	&SoundDriver::fxFade,              &SoundDriver::fxStartNote,
+	&SoundDriver::cmdNoOperation,      &SoundDriver::fxInjectMidi,
+	&SoundDriver::fxPlayInstrument,    &SoundDriver::cmdFreezeFrequency,
+	&SoundDriver::cmdChangeFrequency,  &SoundDriver::fxEndSubroutine
+};
+
+/*------------------------------------------------------------------------*/
+
+AdlibSoundDriver::AdlibSoundDriver() : _field180(0), _field181(0), _field182(0),
+		_volume(127) {
+	Common::fill(&_musInstrumentPtrs[0], &_musInstrumentPtrs[16], (const byte *)nullptr);
+	Common::fill(&_fxInstrumentPtrs[0], &_fxInstrumentPtrs[16], (const byte *)nullptr);
+
+	_opl = OPL::Config::create();
+	_opl->init();
+	_opl->start(new Common::Functor0Mem<void, AdlibSoundDriver>(this, &AdlibSoundDriver::onTimer), CALLBACKS_PER_SECOND);
+	initialize();
+}
+
+AdlibSoundDriver::~AdlibSoundDriver() {
+	_opl->stop();
+	delete _opl;
+}
+
+void AdlibSoundDriver::onTimer() {
+	Common::StackLock slock(_driverMutex);
+	execute();
+	flush();
+}
+
+void AdlibSoundDriver::initialize() {
+	write(1, 0x20);
+	write(8, 0);
+	write(0xBD, 0);
+
+	resetFrequencies();
+	AdlibSoundDriver::resetFX();
+}
+
+void AdlibSoundDriver::playFX(uint effectId, const byte *data) {
+	Common::StackLock slock(_driverMutex);
+	SoundDriver::playFX(effectId, data);
+}
+
+void AdlibSoundDriver::playSong(const byte *data) {
+	Common::StackLock slock(_driverMutex);
+	SoundDriver::playSong(data);
+	_field180 = 0;
+	resetFrequencies();
+}
+
+int AdlibSoundDriver::songCommand(uint commandId, byte volume) {
+	Common::StackLock slock(_driverMutex);
+	SoundDriver::songCommand(commandId, volume);
+
+	if (commandId == STOP_SONG) {
+		_field180 = 0;
+		resetFrequencies();
+	} else if (commandId == RESTART_SONG) {
+		_field180 = 0;
+		_musicPlaying = true;
+	} else if (commandId < 0x100) {
+		if (_musicPlaying) {
+			_field180 = commandId;
+			_field182 = 63;
+		}
+	} else if (commandId == SET_VOLUME) {
+		_volume = volume;
+	} else if (commandId == GET_STATUS) {
+		return _field180;
+	}
+
+	return 0;
+}
+
+void AdlibSoundDriver::write(int reg, int val) {
+	_queue.push(RegisterValue(reg, val));
+	debugC(9, kDebugSound, "%.2x %.2x", reg, val);
+}
+
+void AdlibSoundDriver::flush() {
+	Common::StackLock slock(_driverMutex);
+
+	while (!_queue.empty()) {
+		RegisterValue v = _queue.pop();
+		_opl->writeReg(v._regNum, v._value);
+	}
+}
+
+void AdlibSoundDriver::pausePostProcess() {
+	if (_field180 && ((_field181 += _field180) < 0)) {
+		if (--_field182 < 0) {
+			_musicPlaying = false;
+			_field180 = 0;
+			resetFrequencies();
+		} else {
+			for (int channelNum = 6; channelNum >= 0; --channelNum) {
+				if (_channels[channelNum]._volume < 63)
+					setOutputLevel(channelNum, ++_channels[channelNum]._volume);
+			}
+		}
+	}
+
+	for (int channelNum = 8; channelNum > (_exclude7 ? 7 : 6); --channelNum) {
+		Channel &chan = _channels[channelNum];
+		if (!chan._changeFrequency || (chan._freqCtr += chan._freqCtrChange) >= 0)
+			continue;
+
+		uint freq = chan._frequency & 0x3FF;
+		uint val = chan._frequency >> 8;
+		byte val1 = val & 0x20;
+		byte val2 = val & 0x1C;
+
+		freq += chan._freqChange;
+		if (chan._freqChange < 0) {
+			if (freq <= 388) {
+				freq <<= 1;
+				if (!(freq & 0x3FF))
+					--freq;
+			}
+
+			val2 = (val2 - 4) & 0x1C;
+		} else {
+			if (freq >= 734) {
+				freq >>= 1;
+				if (!(freq & 0x3FF))
+					++freq;
+			}
+
+			val2 = (val2 + 4) & 0x1C;
+		}
+
+		freq &= 0x3FF;
+		freq |= (val2 << 8);
+		freq |= val1;
+		chan._frequency = freq;
+		setFrequency(channelNum, freq);
+	}
+}
+
+void AdlibSoundDriver::resetFX() {
+	if (!_exclude7) {
+		_channels[7]._frequency = 0;
+		setFrequency(7, 0);
+		_channels[7]._volume = 63;
+		setOutputLevel(7, 63);
+	}
+
+	_channels[8]._frequency = 0;
+	setFrequency(8, 0);
+	_channels[8]._volume = 63;
+	setOutputLevel(8, 63);
+}
+
+void AdlibSoundDriver::resetFrequencies() {
+	for (int opNum = 6; opNum >= 0; --opNum) {
+		_channels[opNum]._frequency = 0;
+		setFrequency(opNum, 0);
+	}
+}
+
+void AdlibSoundDriver::setFrequency(byte operatorNum, uint frequency) {
+	write(0xA0 + operatorNum, frequency & 0xff);
+	write(0xB0 + operatorNum, (frequency >> 8));
+}
+
+uint AdlibSoundDriver::calcFrequency(byte note) {
+	return WAVEFORMS[note & 0x1F] + ((note & 0xE0) << 5);
+}
+
+void AdlibSoundDriver::setOutputLevel(byte channelNum, uint level) {
+	write(0x40 + OPERATOR2_INDEXES[channelNum], level |
+		(_channels[channelNum]._scalingValue & 0xC0));
+}
+
+void AdlibSoundDriver::playInstrument(byte channelNum, const byte *data) {
+	byte op1 = OPERATOR1_INDEXES[channelNum];
+	byte op2 = OPERATOR2_INDEXES[channelNum];
+	debugC(2, kDebugSound, "---START-playInstrument - %d", channelNum);
+	write(0x20 + op1, *data++);
+	write(0x40 + op1, *data++);
+	write(0x60 + op1, *data++);
+	write(0x80 + op1, *data++);
+	write(0xE0 + op1, *data++);
+	write(0x20 + op2, *data++);
+
+	int scalingVal = *data++;
+	_channels[channelNum]._scalingValue = scalingVal;
+	scalingVal += (127 - _volume) / 2;
+
+	if (scalingVal > 63) {
+		scalingVal = 63;
+		if (_field180)
+			scalingVal = (scalingVal & 0xC0) | _field182;
+	}
+	write(0x40 + op2, scalingVal);
+
+	write(0x60 + op2, *data++);
+	write(0x80 + op2, *data++);
+	write(0xE0 + op2, *data++);
+	write(0xC0 + channelNum, *data++);
+
+	debugC(2, kDebugSound, "---END-playInstrument");
+}
+
+bool AdlibSoundDriver::musSetInstrument(const byte *&srcP, byte param) {
+	debugC(3, kDebugSound, "musSetInstrument %d", param);
+	_musInstrumentPtrs[param] = srcP;
+	srcP += 26;
+
+	return false;
+}
+
+bool AdlibSoundDriver::musSetPitchWheel(const byte *&srcP, byte param) {
+	// Adlib does not support this
+	debugC(3, kDebugSound, "musSetPitchWheel");
+	srcP += 2;
+	return false;
+}
+
+bool AdlibSoundDriver::musSetPanning(const byte *&srcP, byte param) {
+	// Adlib does not support this
+	debugC(3, kDebugSound, "musSetPanning");
+	++srcP;
+	return false;
+}
+
+bool AdlibSoundDriver::musFade(const byte *&srcP, byte param) {
+	++srcP;
+	if (param < 7)
+		setFrequency(param, _channels[param]._frequency);
+	debugC(3, kDebugSound, "musFade");
+
+	return false;
+}
+
+bool AdlibSoundDriver::musStartNote(const byte *&srcP, byte param) {
+	if (param < 7) {
+		byte note = *srcP++;
+		++srcP;		// Second byte is fade, which is unused by Adlib
+		uint freq = calcFrequency(note);
+		debugC(3, kDebugSound, "musStartNote %x -> %x", note, freq);
+
+		setFrequency(param, freq);
+		freq |= 0x2000;
+		_channels[param]._frequency = freq;
+		setFrequency(param, freq);
+	} else {
+		srcP += 2;
+		debugC(3, kDebugSound, "musStartNote skipped");
+	}
+
+	return false;
+}
+
+bool AdlibSoundDriver::musSetVolume(const byte *&srcP, byte param) {
+	debugC(3, kDebugSound, "musSetVolume %d", (int)*srcP);
+
+	if (*srcP++ == 5 && !_field180) {
+		_channels[param]._volume = *srcP;
+		setOutputLevel(param, *srcP);
+	}
+
+	++srcP;
+	return false;
+}
+
+bool AdlibSoundDriver::musInjectMidi(const byte *&srcP, byte param) {
+	// Adlib does not support MIDI. So simply keep skipping over bytes
+	// until an 'F7' byte is found that flags the end of the MIDI data
+	debugC(3, kDebugSound, "musInjectMidi");
+	while (*srcP++ != 0xF7)
+		;
+
+	return false;
+}
+
+bool AdlibSoundDriver::musPlayInstrument(const byte *&srcP, byte param) {
+	byte instrument = *srcP++;
+	debugC(3, kDebugSound, "musPlayInstrument %d, %d", param, instrument);
+
+	if (param < 7)
+		playInstrument(param, _musInstrumentPtrs[instrument]);
+
+	return false;
+}
+
+bool AdlibSoundDriver::fxSetInstrument(const byte *&srcP, byte param) {
+	debugC(3, kDebugSound, "fxSetInstrument %d", param);
+	_fxInstrumentPtrs[param] = srcP;
+	srcP += 11;
+
+	return false;
+}
+
+bool AdlibSoundDriver::fxSetVolume(const byte *&srcP, byte param) {
+	debugC(3, kDebugSound, "fxSetVolume %d", (int)*srcP);
+
+	if (!_field180 && (!_exclude7 || param != 7)) {
+		_channels[param]._volume = *srcP;
+		setOutputLevel(param, *srcP);
+	}
+
+	++srcP;
+	return false;
+}
+
+bool AdlibSoundDriver::fxMidiReset(const byte *&srcP, byte param) {
+	debugC(3, kDebugSound, "fxMidiReset");
+	return false;
+}
+
+bool AdlibSoundDriver::fxMidiDword(const byte *&srcP, byte param) {
+	debugC(3, kDebugSound, "fxMidiDword");
+	return false;
+}
+
+bool AdlibSoundDriver::fxSetPanning(const byte *&srcP, byte param) {
+	byte note = *srcP++;
+	debugC(3, kDebugSound, "fxSetPanning - %x", note);
+
+	if (!_exclude7 || param != 7) {
+		uint freq = calcFrequency(note);
+		setFrequency(param, freq);
+		_channels[param]._frequency = freq;
+	}
+
+	return false;
+}
+
+bool AdlibSoundDriver::fxChannelOff(const byte *&srcP, byte param) {
+	debugC(3, kDebugSound, "fxChannelOff %d", param);
+	_channels[param]._frequency &= ~0x2000;
+	write(0xB0 + param, _channels[param]._frequency);
+	return false;
+}
+
+bool AdlibSoundDriver::fxFade(const byte *&srcP, byte param) {
+	uint freq = calcFrequency(*srcP++);
+	debugC(3, kDebugSound, "fxFade %d %x", param, freq);
+
+	if (!_exclude7 || param != 7) {
+		_channels[param]._frequency = freq;
+		setFrequency(param, freq);
+	}
+
+	return false;
+}
+
+bool AdlibSoundDriver::fxStartNote(const byte *&srcP, byte param) {
+	if (!_exclude7 || param != 7) {
+		byte note = *srcP++;
+		uint freq = calcFrequency(note);
+		debugC(3, kDebugSound, "fxStartNote %x -> %x", note, freq);
+
+		setFrequency(param, freq);
+		freq |= 0x2000;
+		_channels[param]._frequency = freq;
+		setFrequency(param, freq);
+	} else {
+		++srcP;
+		debugC(3, kDebugSound, "fxStartNote skipped");
+	}
+
+	return false;
+}
+
+bool AdlibSoundDriver::fxInjectMidi(const byte *&srcP, byte param) {
+	// Surpringly, unlike the musInjectMidi, this version doesn't have
+	// any logic to skip over following MIDI data. Which must mean the opcode
+	// and/or it's data aren't present in the admus driver file
+	debugC(3, kDebugSound, "fxInjectMidi");
+	return false;
+}
+
+bool AdlibSoundDriver::fxPlayInstrument(const byte *&srcP, byte param) {
+	byte instrument = *srcP++;
+	debugC(3, kDebugSound, "fxPlayInstrument %d, %d", param, instrument);
+
+	if (!_exclude7 || param != 7)
+		playInstrument(param, _fxInstrumentPtrs[instrument]);
+
+	return false;
+}
+
+/*------------------------------------------------------------------------*/
+
+const byte AdlibSoundDriver::OPERATOR1_INDEXES[CHANNEL_COUNT] = {
+	0, 1, 2, 8, 9, 0xA, 0x10, 0x11, 0x12
+};
+
+const byte AdlibSoundDriver::OPERATOR2_INDEXES[CHANNEL_COUNT] = {
+	3, 4, 5, 0xB, 0xC, 0xD, 0x13, 0x14, 0x15
+};
+
+const uint AdlibSoundDriver::WAVEFORMS[24] = {
+	0, 347, 388, 436, 462, 519, 582, 646,
+	0, 362, 406, 455, 484, 542, 607, 680,
+	0, 327, 367, 412, 436, 489, 549, 618
+};
+
+} // End of namespace Xeen
diff --git a/engines/xeen/sound_driver.h b/engines/xeen/sound_driver.h
new file mode 100644
index 0000000..c78408b
--- /dev/null
+++ b/engines/xeen/sound_driver.h
@@ -0,0 +1,309 @@
+/* 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.
+ *
+ */
+
+#ifndef XEEN_SOUND_DRIVER_H
+#define XEEN_SOUND_DRIVER_H
+
+#include "audio/fmopl.h"
+#include "audio/mixer.h"
+#include "common/array.h"
+#include "common/mutex.h"
+#include "common/queue.h"
+#include "common/stack.h"
+#include "xeen/files.h"
+
+#define CHANNEL_COUNT 9
+
+namespace OPL {
+	class OPL;
+}
+
+namespace Xeen {
+
+enum MusicCommand {
+	STOP_SONG = 0, RESTART_SONG = 1, SET_VOLUME = 0x100,
+	GET_STATUS = 0xFFE0
+};
+
+class SoundDriver;
+
+typedef bool (SoundDriver::*CommandFn)(const byte *&srcP, byte param);
+
+/**
+ * Base class for sound drivers
+ */
+class SoundDriver {
+protected:
+	struct Subroutine {
+		const byte *_returnP;
+		const byte *_jumpP;
+		Subroutine() : _returnP(nullptr), _jumpP(nullptr) {}
+		Subroutine(const byte *returnP, const byte *endP) :
+			_returnP(returnP), _jumpP(endP) {}
+	};
+	struct Channel {
+		bool _changeFrequency;
+		int _freqCtrChange;
+		int _freqChange;
+		int _freqCtr;
+		byte _volume;
+		byte _scalingValue;
+		uint _frequency;
+		Channel() : _changeFrequency(false), _freqCtr(0), _freqCtrChange(0),
+			_freqChange(0), _volume(0), _scalingValue(0), _frequency(0) {}
+	};
+private:
+	static const CommandFn FX_COMMANDS[16];
+	static const CommandFn MUSIC_COMMANDS[16];
+private:
+	Common::Stack<Subroutine> _musSubroutines, _fxSubroutines;
+	int _musCountdownTimer;
+	int _fxCountdownTimer;
+	const byte *_fxDataPtr, *_musDataPtr;
+	const byte *_fxStartPtr;
+	const byte *_musStartPtr;
+	uint _frameCtr;
+private:
+	/**
+	 * Executes the next command
+	 * @param srcP		Command data pointer
+	 * @returns		If true, execution of commands for the current timer call stops
+	 */
+	bool command(const byte *&srcP);
+protected:
+	Common::Array<Channel> _channels;
+	bool _exclude7;
+	bool _musicPlaying;
+	bool _fxPlaying;
+protected:
+	/**
+	 * Executes a series of commands until instructed to stop
+	 */
+	void execute();
+
+	// Music commands (with some also used by FX)
+	virtual bool musCallSubroutine(const byte *&srcP, byte param);
+	virtual bool musSetCountdown(const byte *&srcP, byte param);
+	virtual bool musSetInstrument(const byte *&srcP, byte param) = 0;
+	virtual bool cmdNoOperation(const byte *&srcP, byte param);
+	virtual bool musSetPitchWheel(const byte *&srcP, byte param) = 0;
+	virtual bool musSkipWord(const byte *&srcP, byte param);
+	virtual bool musSetPanning(const byte *&srcP, byte param) = 0;
+	virtual bool musFade(const byte *&srcP, byte param) = 0;
+	virtual bool musStartNote(const byte *&srcP, byte param) = 0;
+	virtual bool musSetVolume(const byte *&srcP, byte param) = 0;
+	virtual bool musInjectMidi(const byte *&srcP, byte param) = 0;
+	virtual bool musPlayInstrument(const byte *&srcP, byte param) = 0;
+	virtual bool cmdFreezeFrequency(const byte *&srcP, byte param);
+	virtual bool cmdChangeFrequency(const byte *&srcP, byte param);
+	virtual bool musEndSubroutine(const byte *&srcP, byte param);
+
+	// FX commands
+	virtual bool fxCallSubroutine(const byte *&srcP, byte param);
+	virtual bool fxSetCountdown(const byte *&srcP, byte param);
+	virtual bool fxSetInstrument(const byte *&srcP, byte param) = 0;
+	virtual bool fxSetVolume(const byte *&srcP, byte param) = 0;
+	virtual bool fxMidiReset(const byte *&srcP, byte param) = 0;
+	virtual bool fxMidiDword(const byte *&srcP, byte param) = 0;
+	virtual bool fxSetPanning(const byte *&srcP, byte param) = 0;
+	virtual bool fxChannelOff(const byte *&srcP, byte param) = 0;
+	virtual bool fxFade(const byte *&srcP, byte param) = 0;
+	virtual bool fxStartNote(const byte *&srcP, byte param) = 0;
+	virtual bool fxInjectMidi(const byte *&srcP, byte param) = 0;
+	virtual bool fxPlayInstrument(const byte *&srcP, byte param) = 0;
+	virtual bool fxEndSubroutine(const byte *&srcP, byte param);
+
+	/**
+	 * Post-processing done when a pause countdown starts or is in progress
+	 */
+	virtual void pausePostProcess() = 0;
+
+	/**
+	 * Does a reset of any sound effect
+	 */
+	virtual void resetFX() = 0;
+public:
+	/**
+	 * Constructor
+	 */
+	SoundDriver();
+
+	/**
+	 * Destructor
+	 */
+	virtual ~SoundDriver();
+
+	/**
+	 * Starts an special effect playing
+	 */
+	virtual void playFX(uint effectId, const byte *data);
+
+	/**
+	 * Stop any playing FX
+	 */
+	void stopFX();
+
+	/**
+	 * Plays a song
+	 */
+	virtual void playSong(const byte *data);
+
+	/**
+	 * Executes special music command
+	 */
+	virtual int songCommand(uint commandId, byte volume = 0);
+
+	/**
+	 * Returns whether music is currently playing
+	 */
+	bool isPlaying() const { return _musicPlaying; }
+};
+
+class AdlibSoundDriver : public SoundDriver {
+	struct RegisterValue {
+		uint8 _regNum;
+		uint8 _value;
+
+		RegisterValue(int regNum, int value) {
+			_regNum = regNum; _value = value;
+		}
+	};
+private:
+	static const byte OPERATOR1_INDEXES[CHANNEL_COUNT];
+	static const byte OPERATOR2_INDEXES[CHANNEL_COUNT];
+	static const uint WAVEFORMS[24];
+private:
+	OPL::OPL *_opl;
+	Common::Queue<RegisterValue> _queue;
+	Common::Mutex _driverMutex;
+	const byte *_musInstrumentPtrs[16];
+	const byte *_fxInstrumentPtrs[16];
+	int _field180;
+	int _field181;
+	int _field182;
+	int _volume;
+private:
+	/**
+	 * Initializes the state of the Adlib OPL driver
+	 */
+	void initialize();
+
+	/**
+	 * Adds a register write to the pending queue that will be flushed
+	 * out to the OPL on the next timer call
+	 */
+	void write(int reg, int val);
+
+	/**
+	 * Timer function for OPL
+	 */
+	void onTimer();
+
+	/**
+	 * Flushes any pending writes to the OPL
+	 */
+	void flush();
+
+	/**
+	 * Resets all the output frequencies
+	 */
+	void resetFrequencies();
+
+	/**
+	 * Sets the frequency for an operator
+	 */
+	void setFrequency(byte operatorNum, uint frequency);
+
+	/**
+	 * Calculates the frequency for a note
+	 */
+	uint calcFrequency(byte note);
+
+	/**
+	 * Sets the output level for a channel
+	 */
+	void setOutputLevel(byte channelNum, uint level);
+
+	/**
+	 * Starts playing an instrument
+	 */
+	void playInstrument(byte channelNum, const byte *data);
+protected:
+	virtual bool musSetInstrument(const byte *&srcP, byte param);
+	virtual bool musSetPitchWheel(const byte *&srcP, byte param);
+	virtual bool musSetPanning(const byte *&srcP, byte param);
+	virtual bool musFade(const byte *&srcP, byte param);
+	virtual bool musStartNote(const byte *&srcP, byte param);
+	virtual bool musSetVolume(const byte *&srcP, byte param);
+	virtual bool musInjectMidi(const byte *&srcP, byte param);
+	virtual bool musPlayInstrument(const byte *&srcP, byte param);
+
+	virtual bool fxSetInstrument(const byte *&srcP, byte param);
+	virtual bool fxSetVolume(const byte *&srcP, byte param);
+	virtual bool fxMidiReset(const byte *&srcP, byte param);
+	virtual bool fxMidiDword(const byte *&srcP, byte param);
+	virtual bool fxSetPanning(const byte *&srcP, byte param);
+	virtual bool fxChannelOff(const byte *&srcP, byte param);
+	virtual bool fxFade(const byte *&srcP, byte param);
+	virtual bool fxStartNote(const byte *&srcP, byte param);
+	virtual bool fxInjectMidi(const byte *&srcP, byte param);
+	virtual bool fxPlayInstrument(const byte *&srcP, byte param);
+
+	/**
+	 * Post-processing done when a pause countdown starts or is in progress
+	 */
+	virtual void pausePostProcess();
+
+	/**
+	 * Does a reset of any sound effect
+	 */
+	virtual void resetFX();
+public:
+	/**
+	 * Constructor
+	 */
+	AdlibSoundDriver();
+
+	/**
+	 * Destructor
+	 */
+	virtual ~AdlibSoundDriver();
+
+	/**
+	 * Starts an special effect playing
+	 */
+	virtual void playFX(uint effectId, const byte *data);
+
+	/**
+	 * Plays a song
+	 */
+	virtual void playSong(const byte *data);
+
+	/**
+	 * Executes special music command
+	 */
+	virtual int songCommand(uint commandId, byte volume = 0);
+};
+
+} // End of namespace Xeen
+
+#endif /* XEEN_SOUND_DRIVER_H */
diff --git a/engines/xeen/worldofxeen/clouds_cutscenes.cpp b/engines/xeen/worldofxeen/clouds_cutscenes.cpp
index 3dc40c2..c582864 100644
--- a/engines/xeen/worldofxeen/clouds_cutscenes.cpp
+++ b/engines/xeen/worldofxeen/clouds_cutscenes.cpp
@@ -242,7 +242,7 @@ bool CloudsCutscenes::showCloudsIntro() {
 			sound.playSound(_INTRO_VOCS[lineCtr]);
 		}
 
-		for (int frameCtr = 0, lookup = 0; sound.isPlaying() || _subtitleSize; ) {
+		for (int frameCtr = 0, lookup = 0; sound.isSoundPlaying() || _subtitleSize; ) {
 			groupo.draw(0, 0);
 			groupo.draw(0, 1, Common::Point(160, 0));
 
@@ -315,7 +315,7 @@ bool CloudsCutscenes::showCloudsIntro() {
 
 			events.updateGameCounter();
 			while (events.timeElapsed() < _INTRO_FRAMES_WAIT[_INTRO_FRAMES_LOOKUP[lineCtr]][lookup]
-					&& sound.isPlaying()) {
+					&& sound.isSoundPlaying()) {
 				events.pollEventsAndWait();
 				if (events.isKeyMousePressed())
 					return false;
@@ -436,7 +436,7 @@ bool CloudsCutscenes::showCloudsEnding1() {
 	bool flag = false;
 	for (int idx1 = 1; idx1 < 7; ++idx1) {
 		for (int idx2 = 0; idx2 < COUNTS1[idx1 - 1]; ++idx2) {
-			if (flag && !sound.isPlaying()) {
+			if (flag && !sound.isSoundPlaying()) {
 				flag = false;
 				sound.playFX(34);
 			} else if (!flag && idx1 == 1 && idx2 == 6) {
@@ -541,7 +541,7 @@ bool CloudsCutscenes::showCloudsEnding1() {
 
 			showSubtitles(0);
 			WAIT(3);
-		} while (sound.isPlaying() || _subtitleSize > 0);
+		} while (sound.isSoundPlaying() || _subtitleSize > 0);
 	}
 
 	// Laugh
@@ -663,7 +663,7 @@ bool CloudsCutscenes::showCloudsEnding2() {
 
 			showSubtitles();
 			WAIT(3);
-		} while (sound.isPlaying() || _subtitleSize);
+		} while (sound.isSoundPlaying() || _subtitleSize);
 
 		king.draw(0, 0, Common::Point(0, 0));
 		king.draw(0, 1, Common::Point(160, 0));
@@ -946,7 +946,7 @@ bool CloudsCutscenes::showCloudsEnding5() {
 
 		showSubtitles();
 		WAIT(3);
-	} while (sound.isPlaying() || _subtitleSize);
+	} while (sound.isSoundPlaying() || _subtitleSize);
 
 	king.draw(0, 0, Common::Point(0, 0));
 	king.draw(0, 1, Common::Point(160, 0));
diff --git a/engines/xeen/worldofxeen/darkside_cutscenes.cpp b/engines/xeen/worldofxeen/darkside_cutscenes.cpp
index a08b0c1..a772500 100644
--- a/engines/xeen/worldofxeen/darkside_cutscenes.cpp
+++ b/engines/xeen/worldofxeen/darkside_cutscenes.cpp
@@ -245,7 +245,7 @@ bool DarkSideCutscenes::showDarkSideIntro() {
 		pyramid.draw(0, idx, Common::Point(132, 62));
 		showSubtitles();
 
-		if (!sound.isPlaying() && !phar2)
+		if (!sound.isSoundPlaying() && !phar2)
 			sound.playSound("pharoh1b.voc");
 
 		events.updateGameCounter();
@@ -303,11 +303,11 @@ bool DarkSideCutscenes::showDarkSideIntro() {
 
 		if (idx == SCREEN_WIDTH)
 			sound.playSound(PHAR2_VOC[0]);
-		if (!sound.isPlaying() && phar2Index < 4)
+		if (!sound.isSoundPlaying() && phar2Index < 4)
 			sound.playSound(PHAR2_VOC[1 + phar2Index++]);
 
 		if (phar2Index == 4) {
-			if (!sound.isPlaying() && !_subtitleSize)
+			if (!sound.isSoundPlaying() && !_subtitleSize)
 				break;
 		}
 
@@ -464,7 +464,7 @@ bool DarkSideCutscenes::showDarkSideEnding1() {
 	// Play landing thud
 	sound.playSound("thud.voc");
 	while (!_vm->shouldExit() && !events.isKeyMousePressed()
-		&& sound.isPlaying()) {
+		&& sound.isSoundPlaying()) {
 		events.pollEventsAndWait();
 	}
 
@@ -585,7 +585,7 @@ bool DarkSideCutscenes::showDarkSideEnding2() {
 			sound.playSound("yes1.voc");
 
 		// Animate Corak speaking
-		sc08.draw(0, sound.isPlaying() ? getSpeakingFrame(0, 2) : 0);
+		sc08.draw(0, sound.isSoundPlaying() ? getSpeakingFrame(0, 2) : 0);
 		showSubtitles();
 		WAIT(3);
 	}
@@ -938,7 +938,7 @@ bool DarkSideCutscenes::showDarkSideEnding3() {
 	screen.saveBackground();
 	screen.horizMerge(SCREEN_WIDTH);
 
-	while (sound.isPlaying()) {
+	while (sound.isSoundPlaying()) {
 		WAIT(1);
 	}
 
@@ -1072,7 +1072,7 @@ bool DarkSideCutscenes::showDarkSideEnding4() {
 	showSubtitles();
 	sound.playSound("ido2.voc");
 
-	for (int idx = 0; sound.isPlaying() || _subtitleSize; ) {
+	for (int idx = 0; sound.isSoundPlaying() || _subtitleSize; ) {
 		screen.restoreBackground();
 		sc26[idx / 8].draw(0, idx % 8, Common::Point(58, 25));
 		WAIT(2);
@@ -1083,7 +1083,7 @@ bool DarkSideCutscenes::showDarkSideEnding4() {
 	screen.loadBackground("sc270001.raw");
 	screen.saveBackground();
 
-	while (sound.isPlaying() && !_vm->shouldExit()) {
+	while (sound.isSoundPlaying() && !_vm->shouldExit()) {
 		events.pollEventsAndWait();
 		if (events.isKeyMousePressed())
 			return false;
diff --git a/engines/xeen/worldofxeen/worldofxeen.cpp b/engines/xeen/worldofxeen/worldofxeen.cpp
index e1e397f..cb2c8c7 100644
--- a/engines/xeen/worldofxeen/worldofxeen.cpp
+++ b/engines/xeen/worldofxeen/worldofxeen.cpp
@@ -162,7 +162,7 @@ void WorldOfXeenEngine::death() {
 			}
 		}
 
-		if (!_sound->isPlaying())
+		if (!_sound->isSoundPlaying())
 			idx = 23;
 	}
 
@@ -187,11 +187,11 @@ void WorldOfXeenEngine::dream() {
 		_events->pollEventsAndWait();
 
 	_sound->playSound("dreams2.voc", 1);
-	while (!shouldExit() && _sound->isPlaying())
+	while (!shouldExit() && _sound->isSoundPlaying())
 		_events->pollEventsAndWait();
 
 	_sound->playSound("laff1.voc", 1);
-	while (!shouldExit() && _sound->isPlaying())
+	while (!shouldExit() && _sound->isSoundPlaying())
 		_events->pollEventsAndWait();
 
 	_events->updateGameCounter();
diff --git a/engines/xeen/worldofxeen/worldofxeen_cutscenes.cpp b/engines/xeen/worldofxeen/worldofxeen_cutscenes.cpp
index 3ac3962..f53de8d 100644
--- a/engines/xeen/worldofxeen/worldofxeen_cutscenes.cpp
+++ b/engines/xeen/worldofxeen/worldofxeen_cutscenes.cpp
@@ -78,7 +78,7 @@ void WorldOfXeenCutscenes::worldEnding1() {
 
 	windows[41].writeString("\x1\xD");
 	screen.fadeOut();
-	while (!_vm->shouldExit() && sound.isPlaying())
+	while (!_vm->shouldExit() && sound.isSoundPlaying())
 		events.pollEventsAndWait();
 
 	sound.playSong("nwblksmt.m");
@@ -211,7 +211,7 @@ void WorldOfXeenCutscenes::worldEnding1() {
 
 	frame = 0;
 	for (int idx = 185; idx > 68 && !_vm->shouldExit(); idx -= 3) {
-		if (!sound.isPlaying())
+		if (!sound.isSoundPlaying())
 			sound.playSound("cast.voc");
 
 		events.updateGameCounter();
@@ -226,7 +226,7 @@ void WorldOfXeenCutscenes::worldEnding1() {
 	}
 
 	for (int idx = 0; idx < 17 && !_vm->shouldExit(); ++idx) {
-		if (!sound.isPlaying())
+		if (!sound.isSoundPlaying())
 			sound.playSound("cast.voc");
 
 		events.updateGameCounter();
@@ -326,7 +326,7 @@ void WorldOfXeenCutscenes::worldEnding1() {
 	sound.playSound("cast.voc");
 
 	for (int idx = 0; idx < 5 && !_vm->shouldExit(); ++idx) {
-		if (!sound.isPlaying())
+		if (!sound.isSoundPlaying())
 			sound.playSound("cast.voc");
 
 		events.updateGameCounter();
@@ -342,7 +342,7 @@ void WorldOfXeenCutscenes::worldEnding1() {
 
 	frame = 0;
 	for (int idx = 0; idx < 16 && !_vm->shouldExit(); ++idx) {
-		if (!sound.isPlaying())
+		if (!sound.isSoundPlaying())
 			sound.playSound("cast.voc");
 
 		events.updateGameCounter();
@@ -359,7 +359,7 @@ void WorldOfXeenCutscenes::worldEnding1() {
 
 	frame = 0;
 	for (int idx = 11; idx < 82 && !_vm->shouldExit(); ++idx) {
-		if (!sound.isPlaying())
+		if (!sound.isSoundPlaying())
 			sound.playSound("cast.voc");
 
 		events.updateGameCounter();
@@ -505,7 +505,7 @@ void WorldOfXeenCutscenes::worldEnding3() {
 	for (int idx = 0; idx < 52 && !_vm->shouldExit(); ++idx) {
 		if (idx == 28)
 			sound.playSound("click.voc");
-		if (!sound.isPlaying())
+		if (!sound.isSoundPlaying())
 			sound.playSound("comet.voc");
 
 		events.updateGameCounter();
@@ -587,7 +587,7 @@ void WorldOfXeenCutscenes::worldEnding4() {
 	screen.fadeIn();
 
 	for (int idx = 0; idx < 89 && !_vm->shouldExit(); ++idx) {
-		if (!sound.isPlaying())
+		if (!sound.isSoundPlaying())
 			sound.playSound("comet.voc");
 		if (idx == 19 || idx == 60)
 			sound.playSound("click.voc");
@@ -609,7 +609,7 @@ void WorldOfXeenCutscenes::worldEnding4() {
 	screen.fadeIn();
 
 	for (int idx = 0; idx < 138 && !_vm->shouldExit(); ++idx) {
-		if (!sound.isPlaying() && idx > 98)
+		if (!sound.isSoundPlaying() && idx > 98)
 			sound.playSound("rumble.voc");
 
 		events.updateGameCounter();
diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp
index b4393fd..0730760 100644
--- a/engines/xeen/xeen.cpp
+++ b/engines/xeen/xeen.cpp
@@ -100,7 +100,7 @@ void XeenEngine::initialize() {
 	_saves = new SavesManager(_targetName);
 	_screen = new Screen(this);
 	_scripts = new Scripts(this);
-	_sound = new Sound(this, _mixer);
+	_sound = new Sound(_mixer);
 	_spells = new Spells(this);
 	_windows = new Windows();
 





More information about the Scummvm-git-logs mailing list