aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/xeen/cutscenes.cpp2
-rw-r--r--engines/xeen/locations.cpp34
-rw-r--r--engines/xeen/module.mk2
-rw-r--r--engines/xeen/sound.cpp110
-rw-r--r--engines/xeen/sound.h110
-rw-r--r--engines/xeen/sound_driver.cpp (renamed from engines/xeen/music.cpp)274
-rw-r--r--engines/xeen/sound_driver.h (renamed from engines/xeen/music.h)111
-rw-r--r--engines/xeen/worldofxeen/clouds_cutscenes.cpp12
-rw-r--r--engines/xeen/worldofxeen/darkside_cutscenes.cpp16
-rw-r--r--engines/xeen/worldofxeen/worldofxeen.cpp6
-rw-r--r--engines/xeen/worldofxeen/worldofxeen_cutscenes.cpp18
-rw-r--r--engines/xeen/xeen.cpp2
12 files changed, 332 insertions, 365 deletions
diff --git a/engines/xeen/cutscenes.cpp b/engines/xeen/cutscenes.cpp
index 46a911e096..05d9fa7b93 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 67abbd7ff7..7a8290504a 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 c464dbc50c..a7ac73e920 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/sound.cpp b/engines/xeen/sound.cpp
index bfd2082e45..2fb88076c5 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 f474063785..ab71af9b43 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/music.cpp b/engines/xeen/sound_driver.cpp
index b94c1d2894..e79fcdd501 100644
--- a/engines/xeen/music.cpp
+++ b/engines/xeen/sound_driver.cpp
@@ -22,7 +22,7 @@
#include "common/md5.h"
#include "common/config-manager.h"
-#include "xeen/music.h"
+#include "xeen/sound_driver.h"
#include "xeen/xeen.h"
#include "xeen/files.h"
@@ -32,19 +32,19 @@ namespace Xeen {
/*------------------------------------------------------------------------*/
-MusicDriver::MusicDriver() : _musicPlaying(false), _fxPlaying(false),
+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);
}
-MusicDriver::~MusicDriver() {
+SoundDriver::~SoundDriver() {
_musicPlaying = _fxPlaying = false;
_musCountdownTimer = _fxCountdownTimer = 0;
}
-void MusicDriver::execute() {
+void SoundDriver::execute() {
bool isFX = false;
const byte *srcP = nullptr;
const byte *startP = nullptr;
@@ -72,7 +72,7 @@ void MusicDriver::execute() {
} while (0);
++_frameCtr;
- debugC(3, kDebugSound, "\nMusicDriver frame - #%x", _frameCtr);
+ debugC(3, kDebugSound, "\nSoundDriver frame - #%x", _frameCtr);
// Main loop
bool breakFlag = false;
@@ -88,7 +88,7 @@ void MusicDriver::execute() {
}
-bool MusicDriver::musCallSubroutine(const byte *&srcP, byte param) {
+bool SoundDriver::musCallSubroutine(const byte *&srcP, byte param) {
debugC(3, kDebugSound, "musCallSubroutine");
if (_musSubroutines.size() < 16) {
const byte *returnP = srcP + 2;
@@ -100,7 +100,7 @@ bool MusicDriver::musCallSubroutine(const byte *&srcP, byte param) {
return false;
}
-bool MusicDriver::musSetCountdown(const byte *&srcP, byte param) {
+bool SoundDriver::musSetCountdown(const byte *&srcP, byte param) {
// Set the countdown timer
if (!param)
param = *srcP++;
@@ -113,24 +113,24 @@ bool MusicDriver::musSetCountdown(const byte *&srcP, byte param) {
return true;
}
-bool MusicDriver::cmdNoOperation(const byte *&srcP, byte param) {
+bool SoundDriver::cmdNoOperation(const byte *&srcP, byte param) {
debugC(3, kDebugSound, "cmdNoOperation");
return false;
}
-bool MusicDriver::musSkipWord(const byte *&srcP, byte param) {
+bool SoundDriver::musSkipWord(const byte *&srcP, byte param) {
debugC(3, kDebugSound, "musSkipWord");
srcP += 2;
return false;
}
-bool MusicDriver::cmdFreezeFrequency(const byte *&srcP, byte param) {
+bool SoundDriver::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) {
+bool SoundDriver::cmdChangeFrequency(const byte *&srcP, byte param) {
debugC(3, kDebugSound, "cmdChangeFrequency %d", param);
if (param != 7 || !_exclude7) {
@@ -146,7 +146,7 @@ bool MusicDriver::cmdChangeFrequency(const byte *&srcP, byte param) {
return false;
}
-bool MusicDriver::musEndSubroutine(const byte *&srcP, byte param) {
+bool SoundDriver::musEndSubroutine(const byte *&srcP, byte param) {
debugC(3, kDebugSound, "musEndSubroutine %d", param);
if (param != 15) {
@@ -160,7 +160,7 @@ bool MusicDriver::musEndSubroutine(const byte *&srcP, byte param) {
return false;
}
-bool MusicDriver::fxCallSubroutine(const byte *&srcP, byte param) {
+bool SoundDriver::fxCallSubroutine(const byte *&srcP, byte param) {
debugC(3, kDebugSound, "fxCallSubroutine");
if (_fxSubroutines.size() < 16) {
@@ -173,7 +173,7 @@ bool MusicDriver::fxCallSubroutine(const byte *&srcP, byte param) {
return false;
}
-bool MusicDriver::fxSetCountdown(const byte *&srcP, byte param) {
+bool SoundDriver::fxSetCountdown(const byte *&srcP, byte param) {
// Set the countdown timer
if (!param)
param = *srcP++;
@@ -186,7 +186,7 @@ bool MusicDriver::fxSetCountdown(const byte *&srcP, byte param) {
return true;
}
-bool MusicDriver::fxEndSubroutine(const byte *&srcP, byte param) {
+bool SoundDriver::fxEndSubroutine(const byte *&srcP, byte param) {
debugC(3, kDebugSound, "fxEndSubroutine %d", param);
if (param != 15) {
@@ -199,7 +199,7 @@ bool MusicDriver::fxEndSubroutine(const byte *&srcP, byte param) {
return false;
}
-void MusicDriver::playFX(uint effectId, const byte *data) {
+void SoundDriver::playFX(uint effectId, const byte *data) {
if (!_fxPlaying || effectId < 7 || effectId >= 11) {
_fxDataPtr = _fxStartPtr = data;
_fxCountdownTimer = 0;
@@ -211,13 +211,13 @@ void MusicDriver::playFX(uint effectId, const byte *data) {
debugC(1, kDebugSound, "Starting FX %d", effectId);
}
-void MusicDriver::stopFX() {
+void SoundDriver::stopFX() {
resetFX();
_fxPlaying = false;
_fxStartPtr = _fxDataPtr = nullptr;
}
-void MusicDriver::playSong(const byte *data) {
+void SoundDriver::playSong(const byte *data) {
_musDataPtr = _musStartPtr = data;
_musSubroutines.clear();
_musCountdownTimer = 0;
@@ -225,7 +225,7 @@ void MusicDriver::playSong(const byte *data) {
debugC(1, kDebugSound, "Starting song");
}
-int MusicDriver::songCommand(uint commandId, byte volume) {
+int SoundDriver::songCommand(uint commandId, byte volume) {
if (commandId == STOP_SONG) {
_musicPlaying = false;
} else if (commandId == RESTART_SONG) {
@@ -237,76 +237,76 @@ int MusicDriver::songCommand(uint commandId, byte volume) {
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 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 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
+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
};
/*------------------------------------------------------------------------*/
-AdlibMusicDriver::AdlibMusicDriver() : _field180(0), _field181(0), _field182(0),
+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, AdlibMusicDriver>(this, &AdlibMusicDriver::onTimer), CALLBACKS_PER_SECOND);
+ _opl->start(new Common::Functor0Mem<void, AdlibSoundDriver>(this, &AdlibSoundDriver::onTimer), CALLBACKS_PER_SECOND);
initialize();
}
-AdlibMusicDriver::~AdlibMusicDriver() {
+AdlibSoundDriver::~AdlibSoundDriver() {
_opl->stop();
delete _opl;
}
-void AdlibMusicDriver::onTimer() {
+void AdlibSoundDriver::onTimer() {
Common::StackLock slock(_driverMutex);
execute();
flush();
}
-void AdlibMusicDriver::initialize() {
+void AdlibSoundDriver::initialize() {
write(1, 0x20);
write(8, 0);
write(0xBD, 0);
resetFrequencies();
- AdlibMusicDriver::resetFX();
+ AdlibSoundDriver::resetFX();
}
-void AdlibMusicDriver::playFX(uint effectId, const byte *data) {
+void AdlibSoundDriver::playFX(uint effectId, const byte *data) {
Common::StackLock slock(_driverMutex);
- MusicDriver::playFX(effectId, data);
+ SoundDriver::playFX(effectId, data);
}
-void AdlibMusicDriver::playSong(const byte *data) {
+void AdlibSoundDriver::playSong(const byte *data) {
Common::StackLock slock(_driverMutex);
- MusicDriver::playSong(data);
+ SoundDriver::playSong(data);
_field180 = 0;
resetFrequencies();
}
-int AdlibMusicDriver::songCommand(uint commandId, byte volume) {
+int AdlibSoundDriver::songCommand(uint commandId, byte volume) {
Common::StackLock slock(_driverMutex);
- MusicDriver::songCommand(commandId, volume);
+ SoundDriver::songCommand(commandId, volume);
if (commandId == STOP_SONG) {
_field180 = 0;
@@ -328,12 +328,12 @@ int AdlibMusicDriver::songCommand(uint commandId, byte volume) {
return 0;
}
-void AdlibMusicDriver::write(int reg, int val) {
+void AdlibSoundDriver::write(int reg, int val) {
_queue.push(RegisterValue(reg, val));
debugC(9, kDebugSound, "%.2x %.2x", reg, val);
}
-void AdlibMusicDriver::flush() {
+void AdlibSoundDriver::flush() {
Common::StackLock slock(_driverMutex);
while (!_queue.empty()) {
@@ -342,7 +342,7 @@ void AdlibMusicDriver::flush() {
}
}
-void AdlibMusicDriver::pausePostProcess() {
+void AdlibSoundDriver::pausePostProcess() {
if (_field180 && ((_field181 += _field180) < 0)) {
if (--_field182 < 0) {
_musicPlaying = false;
@@ -393,7 +393,7 @@ void AdlibMusicDriver::pausePostProcess() {
}
}
-void AdlibMusicDriver::resetFX() {
+void AdlibSoundDriver::resetFX() {
if (!_exclude7) {
_channels[7]._frequency = 0;
setFrequency(7, 0);
@@ -407,28 +407,28 @@ void AdlibMusicDriver::resetFX() {
setOutputLevel(8, 63);
}
-void AdlibMusicDriver::resetFrequencies() {
+void AdlibSoundDriver::resetFrequencies() {
for (int opNum = 6; opNum >= 0; --opNum) {
_channels[opNum]._frequency = 0;
setFrequency(opNum, 0);
}
}
-void AdlibMusicDriver::setFrequency(byte operatorNum, uint frequency) {
+void AdlibSoundDriver::setFrequency(byte operatorNum, uint frequency) {
write(0xA0 + operatorNum, frequency & 0xff);
write(0xB0 + operatorNum, (frequency >> 8));
}
-uint AdlibMusicDriver::calcFrequency(byte note) {
+uint AdlibSoundDriver::calcFrequency(byte note) {
return WAVEFORMS[note & 0x1F] + ((note & 0xE0) << 5);
}
-void AdlibMusicDriver::setOutputLevel(byte channelNum, uint level) {
+void AdlibSoundDriver::setOutputLevel(byte channelNum, uint level) {
write(0x40 + OPERATOR2_INDEXES[channelNum], level |
(_channels[channelNum]._scalingValue & 0xC0));
}
-void AdlibMusicDriver::playInstrument(byte channelNum, const byte *data) {
+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);
@@ -458,7 +458,7 @@ void AdlibMusicDriver::playInstrument(byte channelNum, const byte *data) {
debugC(2, kDebugSound, "---END-playInstrument");
}
-bool AdlibMusicDriver::musSetInstrument(const byte *&srcP, byte param) {
+bool AdlibSoundDriver::musSetInstrument(const byte *&srcP, byte param) {
debugC(3, kDebugSound, "musSetInstrument %d", param);
_musInstrumentPtrs[param] = srcP;
srcP += 26;
@@ -466,21 +466,21 @@ bool AdlibMusicDriver::musSetInstrument(const byte *&srcP, byte param) {
return false;
}
-bool AdlibMusicDriver::musSetPitchWheel(const byte *&srcP, byte param) {
+bool AdlibSoundDriver::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) {
+bool AdlibSoundDriver::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) {
+bool AdlibSoundDriver::musFade(const byte *&srcP, byte param) {
++srcP;
if (param < 7)
setFrequency(param, _channels[param]._frequency);
@@ -489,7 +489,7 @@ bool AdlibMusicDriver::musFade(const byte *&srcP, byte param) {
return false;
}
-bool AdlibMusicDriver::musStartNote(const byte *&srcP, byte param) {
+bool AdlibSoundDriver::musStartNote(const byte *&srcP, byte param) {
if (param < 7) {
byte note = *srcP++;
++srcP; // Second byte is fade, which is unused by Adlib
@@ -508,7 +508,7 @@ bool AdlibMusicDriver::musStartNote(const byte *&srcP, byte param) {
return false;
}
-bool AdlibMusicDriver::musSetVolume(const byte *&srcP, byte param) {
+bool AdlibSoundDriver::musSetVolume(const byte *&srcP, byte param) {
debugC(3, kDebugSound, "musSetVolume %d", (int)*srcP);
if (*srcP++ == 5 && !_field180) {
@@ -520,7 +520,7 @@ bool AdlibMusicDriver::musSetVolume(const byte *&srcP, byte param) {
return false;
}
-bool AdlibMusicDriver::musInjectMidi(const byte *&srcP, byte param) {
+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");
@@ -530,7 +530,7 @@ bool AdlibMusicDriver::musInjectMidi(const byte *&srcP, byte param) {
return false;
}
-bool AdlibMusicDriver::musPlayInstrument(const byte *&srcP, byte param) {
+bool AdlibSoundDriver::musPlayInstrument(const byte *&srcP, byte param) {
byte instrument = *srcP++;
debugC(3, kDebugSound, "musPlayInstrument %d, %d", param, instrument);
@@ -540,7 +540,7 @@ bool AdlibMusicDriver::musPlayInstrument(const byte *&srcP, byte param) {
return false;
}
-bool AdlibMusicDriver::fxSetInstrument(const byte *&srcP, byte param) {
+bool AdlibSoundDriver::fxSetInstrument(const byte *&srcP, byte param) {
debugC(3, kDebugSound, "fxSetInstrument %d", param);
_fxInstrumentPtrs[param] = srcP;
srcP += 11;
@@ -548,7 +548,7 @@ bool AdlibMusicDriver::fxSetInstrument(const byte *&srcP, byte param) {
return false;
}
-bool AdlibMusicDriver::fxSetVolume(const byte *&srcP, byte param) {
+bool AdlibSoundDriver::fxSetVolume(const byte *&srcP, byte param) {
debugC(3, kDebugSound, "fxSetVolume %d", (int)*srcP);
if (!_field180 && (!_exclude7 || param != 7)) {
@@ -560,17 +560,17 @@ bool AdlibMusicDriver::fxSetVolume(const byte *&srcP, byte param) {
return false;
}
-bool AdlibMusicDriver::fxMidiReset(const byte *&srcP, byte param) {
+bool AdlibSoundDriver::fxMidiReset(const byte *&srcP, byte param) {
debugC(3, kDebugSound, "fxMidiReset");
return false;
}
-bool AdlibMusicDriver::fxMidiDword(const byte *&srcP, byte param) {
+bool AdlibSoundDriver::fxMidiDword(const byte *&srcP, byte param) {
debugC(3, kDebugSound, "fxMidiDword");
return false;
}
-bool AdlibMusicDriver::fxSetPanning(const byte *&srcP, byte param) {
+bool AdlibSoundDriver::fxSetPanning(const byte *&srcP, byte param) {
byte note = *srcP++;
debugC(3, kDebugSound, "fxSetPanning - %x", note);
@@ -583,14 +583,14 @@ bool AdlibMusicDriver::fxSetPanning(const byte *&srcP, byte param) {
return false;
}
-bool AdlibMusicDriver::fxChannelOff(const byte *&srcP, byte param) {
+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 AdlibMusicDriver::fxFade(const byte *&srcP, byte param) {
+bool AdlibSoundDriver::fxFade(const byte *&srcP, byte param) {
uint freq = calcFrequency(*srcP++);
debugC(3, kDebugSound, "fxFade %d %x", param, freq);
@@ -602,7 +602,7 @@ bool AdlibMusicDriver::fxFade(const byte *&srcP, byte param) {
return false;
}
-bool AdlibMusicDriver::fxStartNote(const byte *&srcP, byte param) {
+bool AdlibSoundDriver::fxStartNote(const byte *&srcP, byte param) {
if (!_exclude7 || param != 7) {
byte note = *srcP++;
uint freq = calcFrequency(note);
@@ -620,7 +620,7 @@ bool AdlibMusicDriver::fxStartNote(const byte *&srcP, byte param) {
return false;
}
-bool AdlibMusicDriver::fxInjectMidi(const byte *&srcP, byte param) {
+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
@@ -628,7 +628,7 @@ bool AdlibMusicDriver::fxInjectMidi(const byte *&srcP, byte param) {
return false;
}
-bool AdlibMusicDriver::fxPlayInstrument(const byte *&srcP, byte param) {
+bool AdlibSoundDriver::fxPlayInstrument(const byte *&srcP, byte param) {
byte instrument = *srcP++;
debugC(3, kDebugSound, "fxPlayInstrument %d, %d", param, instrument);
@@ -638,134 +638,20 @@ bool AdlibMusicDriver::fxPlayInstrument(const byte *&srcP, byte param) {
return false;
}
+/*------------------------------------------------------------------------*/
-const byte AdlibMusicDriver::OPERATOR1_INDEXES[CHANNEL_COUNT] = {
+const byte AdlibSoundDriver::OPERATOR1_INDEXES[CHANNEL_COUNT] = {
0, 1, 2, 8, 9, 0xA, 0x10, 0x11, 0x12
};
-const byte AdlibMusicDriver::OPERATOR2_INDEXES[CHANNEL_COUNT] = {
+const byte AdlibSoundDriver::OPERATOR2_INDEXES[CHANNEL_COUNT] = {
3, 4, 5, 0xB, 0xC, 0xD, 0x13, 0x14, 0x15
};
-const uint AdlibMusicDriver::WAVEFORMS[24] = {
+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
};
-/*------------------------------------------------------------------------*/
-
-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/sound_driver.h
index ac1f78433d..c78408b047 100644
--- a/engines/xeen/music.h
+++ b/engines/xeen/sound_driver.h
@@ -20,8 +20,8 @@
*
*/
-#ifndef XEEN_MUSIC_H
-#define XEEN_MUSIC_H
+#ifndef XEEN_SOUND_DRIVER_H
+#define XEEN_SOUND_DRIVER_H
#include "audio/fmopl.h"
#include "audio/mixer.h"
@@ -44,14 +44,14 @@ enum MusicCommand {
GET_STATUS = 0xFFE0
};
-class MusicDriver;
+class SoundDriver;
-typedef bool (MusicDriver::*CommandFn)(const byte *&srcP, byte param);
+typedef bool (SoundDriver::*CommandFn)(const byte *&srcP, byte param);
/**
- * Base class for music drivers
+ * Base class for sound drivers
*/
-class MusicDriver {
+class SoundDriver {
protected:
struct Subroutine {
const byte *_returnP;
@@ -145,12 +145,12 @@ public:
/**
* Constructor
*/
- MusicDriver();
+ SoundDriver();
/**
* Destructor
*/
- virtual ~MusicDriver();
+ virtual ~SoundDriver();
/**
* Starts an special effect playing
@@ -178,7 +178,7 @@ public:
bool isPlaying() const { return _musicPlaying; }
};
-class AdlibMusicDriver : public MusicDriver {
+class AdlibSoundDriver : public SoundDriver {
struct RegisterValue {
uint8 _regNum;
uint8 _value;
@@ -281,12 +281,12 @@ public:
/**
* Constructor
*/
- AdlibMusicDriver();
+ AdlibSoundDriver();
/**
* Destructor
*/
- virtual ~AdlibMusicDriver();
+ virtual ~AdlibSoundDriver();
/**
* Starts an special effect playing
@@ -304,93 +304,6 @@ public:
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 */
+#endif /* XEEN_SOUND_DRIVER_H */
diff --git a/engines/xeen/worldofxeen/clouds_cutscenes.cpp b/engines/xeen/worldofxeen/clouds_cutscenes.cpp
index 3dc40c2a5d..c58286449e 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 a08b0c1ed7..a772500eaa 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 e1e397ff46..cb2c8c7ee3 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 3ac3962f69..f53de8d94f 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 b4393fd4b0..0730760d14 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();