aboutsummaryrefslogtreecommitdiff
path: root/engines/mohawk
diff options
context:
space:
mode:
Diffstat (limited to 'engines/mohawk')
-rw-r--r--engines/mohawk/console.cpp8
-rw-r--r--engines/mohawk/detection_tables.h6
-rw-r--r--engines/mohawk/myst.cpp18
-rw-r--r--engines/mohawk/myst.h2
-rw-r--r--engines/mohawk/myst_areas.cpp2
-rw-r--r--engines/mohawk/myst_scripts.cpp18
-rw-r--r--engines/mohawk/myst_sound.cpp199
-rw-r--r--engines/mohawk/myst_sound.h49
-rw-r--r--engines/mohawk/myst_stacks/channelwood.cpp42
-rw-r--r--engines/mohawk/myst_stacks/mechanical.cpp28
-rw-r--r--engines/mohawk/myst_stacks/myst.cpp256
-rw-r--r--engines/mohawk/myst_stacks/preview.cpp12
-rw-r--r--engines/mohawk/myst_stacks/preview.h4
-rw-r--r--engines/mohawk/myst_stacks/selenitic.cpp48
-rw-r--r--engines/mohawk/myst_stacks/stoneship.cpp26
15 files changed, 344 insertions, 374 deletions
diff --git a/engines/mohawk/console.cpp b/engines/mohawk/console.cpp
index a25023cf39..877c1acd37 100644
--- a/engines/mohawk/console.cpp
+++ b/engines/mohawk/console.cpp
@@ -81,7 +81,7 @@ bool MystConsole::Cmd_ChangeCard(int argc, const char **argv) {
return true;
}
- _vm->_sound->stopSound();
+ _vm->_sound->stopEffect();
_vm->changeToCard((uint16)atoi(argv[1]), kTransitionCopy);
return false;
@@ -169,7 +169,7 @@ bool MystConsole::Cmd_ChangeStack(int argc, const char **argv) {
// We need to stop any playing sound when we change the stack
// as the next card could continue playing it if it.
- _vm->_sound->stopSound();
+ _vm->_sound->stopEffect();
uint16 card = 0;
if (argc == 3)
@@ -234,7 +234,7 @@ bool MystConsole::Cmd_PlaySound(int argc, const char **argv) {
return true;
}
- _vm->_sound->replaceSoundMyst((uint16)atoi(argv[1]));
+ _vm->_sound->playEffect((uint16) atoi(argv[1]));
return false;
}
@@ -242,7 +242,7 @@ bool MystConsole::Cmd_PlaySound(int argc, const char **argv) {
bool MystConsole::Cmd_StopSound(int argc, const char **argv) {
debugPrintf("Stopping Sound\n");
- _vm->_sound->stopSound();
+ _vm->_sound->stopEffect();
return true;
}
diff --git a/engines/mohawk/detection_tables.h b/engines/mohawk/detection_tables.h
index ba557012b9..ec72a63478 100644
--- a/engines/mohawk/detection_tables.h
+++ b/engines/mohawk/detection_tables.h
@@ -24,10 +24,10 @@ namespace Mohawk {
#define GAMEOPTION_PLAY_MYST_FLYBY GUIO_GAMEOPTIONS1
-#define GUI_OPTIONS_MYST GUIO3(GUIO_NOASPECT, GUIO_NOSUBTITLES, GUIO_NOMIDI)
-#define GUI_OPTIONS_MYST_ME GUIO4(GUIO_NOASPECT, GUIO_NOSUBTITLES, GUIO_NOMIDI, GAMEOPTION_PLAY_MYST_FLYBY)
+#define GUI_OPTIONS_MYST GUIO4(GUIO_NOASPECT, GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOMIDI)
+#define GUI_OPTIONS_MYST_ME GUIO5(GUIO_NOASPECT, GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOMIDI, GAMEOPTION_PLAY_MYST_FLYBY)
#define GUI_OPTIONS_MYST_DEMO GUIO4(GUIO_NOASPECT, GUIO_NOSUBTITLES, GUIO_NOMIDI, GUIO_NOLAUNCHLOAD)
-#define GUI_OPTIONS_MYST_MAKING_OF GUIO4(GUIO_NOASPECT, GUIO_NOSUBTITLES, GUIO_NOMIDI, GUIO_NOLAUNCHLOAD)
+#define GUI_OPTIONS_MYST_MAKING_OF GUIO5(GUIO_NOASPECT, GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOMIDI, GUIO_NOLAUNCHLOAD)
#define GUI_OPTIONS_RIVEN GUIO4(GUIO_NOASPECT, GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOMIDI)
#define GUI_OPTIONS_RIVEN_DEMO GUIO5(GUIO_NOASPECT, GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOMIDI, GUIO_NOLAUNCHLOAD)
diff --git a/engines/mohawk/myst.cpp b/engines/mohawk/myst.cpp
index 8d96780617..9ce38b92b5 100644
--- a/engines/mohawk/myst.cpp
+++ b/engines/mohawk/myst.cpp
@@ -275,11 +275,11 @@ void MohawkEngine_Myst::waitUntilMovieEnds(const VideoEntryPtr &video) {
_interactive = true;
}
-void MohawkEngine_Myst::playSoundBlocking(uint16 id, byte volume) {
+void MohawkEngine_Myst::playSoundBlocking(uint16 id) {
_interactive = false;
- _sound->playSound(id, volume);
+ _sound->playEffect(id);
- while (_sound->isPlaying() && !shouldQuit()) {
+ while (_sound->isEffectPlaying() && !shouldQuit()) {
doFrame();
}
_interactive = true;
@@ -472,8 +472,8 @@ void MohawkEngine_Myst::changeToStack(uint16 stack, uint16 card, uint16 linkSrcS
else
_gfx->clearScreenPalette();
- _sound->stopSound();
- _sound->stopBackgroundMyst();
+ _sound->stopEffect();
+ _sound->stopBackground();
_video->stopVideos();
if (linkSrcSound)
playSoundBlocking(linkSrcSound);
@@ -1220,7 +1220,7 @@ void MohawkEngine_Myst::dropPage() {
bool redPage = page - 7 < 6;
// Play drop page sound
- _sound->replaceSoundMyst(800);
+ _sound->playEffect(800);
// Drop page
_gameState->_globals.heldPage = 0;
@@ -1317,13 +1317,13 @@ void MohawkEngine_Myst::applySoundBlock(const MystSoundBlock &block) {
debug(2, "Continuing with current sound");
else if (soundAction == kMystSoundActionChangeVolume) {
debug(2, "Continuing with current sound, changing volume");
- _sound->changeBackgroundVolumeMyst(soundActionVolume);
+ _sound->changeBackgroundVolume(soundActionVolume);
} else if (soundAction == kMystSoundActionStop) {
debug(2, "Stopping sound");
- _sound->stopBackgroundMyst();
+ _sound->stopBackground();
} else if (soundAction > 0) {
debug(2, "Playing new sound %d", soundAction);
- _sound->replaceBackgroundMyst(soundAction, soundActionVolume);
+ _sound->playBackground(soundAction, soundActionVolume);
} else {
error("Unknown sound action %d", soundAction);
}
diff --git a/engines/mohawk/myst.h b/engines/mohawk/myst.h
index 39d96bb320..f9823e5291 100644
--- a/engines/mohawk/myst.h
+++ b/engines/mohawk/myst.h
@@ -232,7 +232,7 @@ public:
void playMovieBlockingCentered(const Common::String &filename);
void waitUntilMovieEnds(const VideoEntryPtr &video);
- void playSoundBlocking(uint16 id, byte volume = Audio::Mixer::kMaxChannelVolume);
+ void playSoundBlocking(uint16 id);
GUI::Debugger *getDebugger() override { return _console; }
diff --git a/engines/mohawk/myst_areas.cpp b/engines/mohawk/myst_areas.cpp
index 3bb6eb8653..61b0d8796b 100644
--- a/engines/mohawk/myst_areas.cpp
+++ b/engines/mohawk/myst_areas.cpp
@@ -640,7 +640,7 @@ void MystAreaSlider::updatePosition(const Common::Point &mouse) {
}
if (positionChanged && _dragSound)
- _vm->_sound->replaceSoundMyst(_dragSound);
+ _vm->_sound->playEffect(_dragSound);
}
MystAreaDrag::MystAreaDrag(MohawkEngine_Myst *vm, Common::SeekableReadStream *rlstStream, MystArea *parent) :
diff --git a/engines/mohawk/myst_scripts.cpp b/engines/mohawk/myst_scripts.cpp
index 9141f9f988..30d2c155df 100644
--- a/engines/mohawk/myst_scripts.cpp
+++ b/engines/mohawk/myst_scripts.cpp
@@ -630,12 +630,12 @@ void MystScriptParser::o_playSound(uint16 op, uint16 var, uint16 argc, uint16 *a
debugC(kDebugScript, "Opcode %d: playSound", op);
debugC(kDebugScript, "\tsoundId: %d", soundId);
- _vm->_sound->replaceSoundMyst(soundId);
+ _vm->_sound->playEffect(soundId);
}
void MystScriptParser::o_stopSoundBackground(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
debugC(kDebugScript, "Opcode %d: stopSoundBackground", op);
- _vm->_sound->stopBackgroundMyst();
+ _vm->_sound->stopBackground();
}
void MystScriptParser::o_playSoundBlocking(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
@@ -644,7 +644,7 @@ void MystScriptParser::o_playSoundBlocking(uint16 op, uint16 var, uint16 argc, u
debugC(kDebugScript, "Opcode %d: playSoundBlocking", op);
debugC(kDebugScript, "\tsoundId: %d", soundId);
- _vm->_sound->stopSound();
+ _vm->_sound->stopEffect();
_vm->playSoundBlocking(soundId);
}
@@ -729,13 +729,13 @@ void MystScriptParser::o_soundPlaySwitch(uint16 op, uint16 var, uint16 argc, uin
debugC(kDebugScript, "\tsoundId: %d", soundId);
if (soundId)
- _vm->_sound->replaceSoundMyst(soundId);
+ _vm->_sound->playEffect(soundId);
}
}
void MystScriptParser::o_soundResumeBackground(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
debugC(kDebugScript, "Opcode %d: soundResumeBackground", op);
- _vm->_sound->resumeBackgroundMyst();
+ _vm->_sound->resumeBackground();
}
void MystScriptParser::o_copyImageToScreen(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
@@ -838,7 +838,7 @@ void MystScriptParser::o_changeStack(uint16 op, uint16 var, uint16 argc, uint16
debugC(kDebugScript, "\tSource Stack Link Sound: %d", soundIdLinkSrc);
debugC(kDebugScript, "\tDestination Stack Link Sound: %d", soundIdLinkDst);
- _vm->_sound->stopSound();
+ _vm->_sound->stopEffect();
if (_vm->getFeatures() & GF_DEMO) {
// No need to have a table for just this data...
@@ -865,7 +865,7 @@ void MystScriptParser::o_changeCardPlaySoundDirectional(uint16 op, uint16 var, u
debugC(kDebugScript, "\tanimated update data size: %d", dataSize);
if (soundId)
- _vm->_sound->replaceSoundMyst(soundId);
+ _vm->_sound->playEffect(soundId);
_vm->changeToCard(cardId, kNoTransition);
@@ -884,7 +884,7 @@ void MystScriptParser::o_directionalUpdatePlaySound(uint16 op, uint16 var, uint1
debugC(kDebugScript, "\tanimated update data size: %d", dataSize);
if (soundId)
- _vm->_sound->replaceSoundMyst(soundId);
+ _vm->_sound->playEffect(soundId);
animatedUpdate(dataSize, &argv[3], delayBetweenSteps);
}
@@ -907,7 +907,7 @@ void MystScriptParser::o_soundWaitStop(uint16 op, uint16 var, uint16 argc, uint1
// Used when Button is pushed...
debugC(kDebugScript, "Opcode %d: Wait for foreground sound to finish", op);
- while (_vm->_sound->isPlaying())
+ while (_vm->_sound->isEffectPlaying())
_vm->doFrame();
}
diff --git a/engines/mohawk/myst_sound.cpp b/engines/mohawk/myst_sound.cpp
index f8cdc04e24..a0a167d3af 100644
--- a/engines/mohawk/myst_sound.cpp
+++ b/engines/mohawk/myst_sound.cpp
@@ -24,6 +24,7 @@
#include "mohawk/myst.h"
#include "mohawk/resource.h"
+#include "mohawk/sound.h"
#include "common/debug.h"
@@ -33,13 +34,15 @@
namespace Mohawk {
MystSound::MystSound(MohawkEngine_Myst *vm) :
- _vm(vm) {
- _mystBackgroundSound.type = kFreeHandle;
+ _vm(vm),
+ _effectId(0),
+ _speechSamplesPerSecond(0),
+ _backgroundId(0) {
}
MystSound::~MystSound() {
- stopSound();
- stopBackgroundMyst();
+ stopEffect();
+ stopBackground();
}
Audio::RewindableAudioStream *MystSound::makeAudioStream(uint16 id, CueList *cueList) {
@@ -49,111 +52,56 @@ Audio::RewindableAudioStream *MystSound::makeAudioStream(uint16 id, CueList *cue
return makeMohawkWaveStream(_vm->getResource(ID_MSND, id), cueList);
}
-Audio::SoundHandle *MystSound::playSound(uint16 id, byte volume, bool loop, CueList *cueList) {
- debug (0, "Playing sound %d", id);
-
- Audio::RewindableAudioStream *rewindStream = makeAudioStream(id, cueList);
-
- if (rewindStream) {
- SndHandle *handle = getHandle();
- handle->type = kUsedHandle;
- handle->id = id;
- handle->samplesPerSecond = rewindStream->getRate();
-
- // Set the stream to loop here if it's requested
- Audio::AudioStream *audStream = rewindStream;
- if (loop)
- audStream = Audio::makeLoopingAudioStream(rewindStream, 0);
-
- _vm->_mixer->playStream(Audio::Mixer::kPlainSoundType, &handle->handle, audStream, -1, volume);
- return &handle->handle;
- }
-
- return nullptr;
-}
-
-Audio::SoundHandle *MystSound::replaceSoundMyst(uint16 id, byte volume, bool loop) {
+void MystSound::playEffect(uint16 id, bool loop) {
debug (0, "Replacing sound %d", id);
// The original engine also forces looping for those sounds
switch (id) {
- case 2205:
- case 2207:
- case 5378:
- case 7220:
- case 9119: // Elevator engine sound in mechanical age is looping.
- case 9120:
- case 9327:
- loop = true;
- break;
+ case 2205:
+ case 2207:
+ case 5378:
+ case 7220:
+ case 9119: // Elevator engine sound in mechanical age is looping.
+ case 9120:
+ case 9327:
+ loop = true;
+ break;
+ default:
+ break;
}
- stopSound();
- return playSound(id, volume, loop);
-}
-
-SndHandle *MystSound::getHandle() {
- for (uint32 i = 0; i < _handles.size(); i++) {
- if (_handles[i].type == kFreeHandle)
- return &_handles[i];
+ stopEffect();
- if (!_vm->_mixer->isSoundHandleActive(_handles[i].handle)) {
- _handles[i].type = kFreeHandle;
- _handles[i].id = 0;
- return &_handles[i];
- }
+ Audio::RewindableAudioStream *rewindStream = makeAudioStream(id);
+ if (!rewindStream) {
+ warning("Unable to open sound '%d'", id);
+ return;
}
- // Let's add a new sound handle!
- SndHandle handle;
- handle.handle = Audio::SoundHandle();
- handle.type = kFreeHandle;
- handle.id = 0;
- _handles.push_back(handle);
+ _effectId = id;
- return &_handles[_handles.size() - 1];
-}
-
-void MystSound::stopSound() {
- for (uint32 i = 0; i < _handles.size(); i++)
- if (_handles[i].type == kUsedHandle) {
- _vm->_mixer->stopHandle(_handles[i].handle);
- _handles[i].type = kFreeHandle;
- _handles[i].id = 0;
- }
-}
+ // Set the stream to loop here if it's requested
+ Audio::AudioStream *audStream = rewindStream;
+ if (loop)
+ audStream = Audio::makeLoopingAudioStream(rewindStream, 0);
-void MystSound::stopSound(uint16 id) {
- for (uint32 i = 0; i < _handles.size(); i++)
- if (_handles[i].type == kUsedHandle && _handles[i].id == id) {
- _vm->_mixer->stopHandle(_handles[i].handle);
- _handles[i].type = kFreeHandle;
- _handles[i].id = 0;
- }
+ _vm->_mixer->playStream(Audio::Mixer::kSFXSoundType, &_effectHandle, audStream);
}
-bool MystSound::isPlaying(uint16 id) {
- for (uint32 i = 0; i < _handles.size(); i++)
- if (_handles[i].type == kUsedHandle && _handles[i].id == id)
- return _vm->_mixer->isSoundHandleActive(_handles[i].handle);
-
- return false;
+void MystSound::stopEffect() {
+ _vm->_mixer->stopHandle(_effectHandle);
+ _effectId = 0;
+ _effectHandle = Audio::SoundHandle();
}
-bool MystSound::isPlaying() {
- for (uint32 i = 0; i < _handles.size(); i++)
- if (_handles[i].type == kUsedHandle)
- if (_vm->_mixer->isSoundHandleActive(_handles[i].handle))
- return true;
-
- return false;
+bool MystSound::isEffectPlaying() {
+ return _vm->_mixer->isSoundHandleActive(_effectHandle);
}
-uint MystSound::getNumSamplesPlayed(uint16 id) {
- for (uint32 i = 0; i < _handles.size(); i++)
- if (_handles[i].type == kUsedHandle && _handles[i].id == id) {
- return (_vm->_mixer->getSoundElapsedTime(_handles[i].handle) * _handles[i].samplesPerSecond) / 1000;
- }
+uint MystSound::getSpeechNumSamplesPlayed() {
+ if (isSpeechPlaying()) {
+ return (_vm->_mixer->getSoundElapsedTime(_speechHandle) * _speechSamplesPerSecond) / 1000;
+ }
return 0;
}
@@ -173,10 +121,10 @@ uint16 MystSound::convertMystID(uint16 id) {
return id;
}
-void MystSound::replaceBackgroundMyst(uint16 id, uint16 volume) {
+void MystSound::playBackground(uint16 id, uint16 volume) {
debug(0, "Replacing background sound with %d", id);
- // TODO: The original engine does fading
+ stopEffect();
Common::String name = _vm->getResourceName(ID_MSND, convertMystID(id));
@@ -188,52 +136,69 @@ void MystSound::replaceBackgroundMyst(uint16 id, uint16 volume) {
prefix = name;
// Check if sound is already playing
- if (_mystBackgroundSound.type == kUsedHandle && _vm->_mixer->isSoundHandleActive(_mystBackgroundSound.handle)
- && _vm->getResourceName(ID_MSND, convertMystID(_mystBackgroundSound.id)).hasPrefix(prefix)) {
+ if (_vm->_mixer->isSoundHandleActive(_backgroundHandle)
+ && _vm->getResourceName(ID_MSND, convertMystID(_backgroundId)).hasPrefix(prefix)) {
// The sound is already playing, just change the volume
- changeBackgroundVolumeMyst(volume);
+ changeBackgroundVolume(volume);
return;
}
// Stop old background sound
- stopBackgroundMyst();
+ stopBackground();
// Play new sound
Audio::RewindableAudioStream *rewindStream = makeAudioStream(id);
if (rewindStream) {
- _mystBackgroundSound.type = kUsedHandle;
- _mystBackgroundSound.id = id;
- _mystBackgroundSound.samplesPerSecond = rewindStream->getRate();
+ _backgroundId = id;
// Set the stream to loop
Audio::AudioStream *audStream = Audio::makeLoopingAudioStream(rewindStream, 0);
- _vm->_mixer->playStream(Audio::Mixer::kPlainSoundType, &_mystBackgroundSound.handle, audStream, -1, volume >> 8);
+ _vm->_mixer->playStream(Audio::Mixer::kMusicSoundType, &_backgroundHandle, audStream, -1, volume >> 8);
}
}
-void MystSound::stopBackgroundMyst() {
- if (_mystBackgroundSound.type == kUsedHandle) {
- _vm->_mixer->stopHandle(_mystBackgroundSound.handle);
- _mystBackgroundSound.type = kFreeHandle;
- _mystBackgroundSound.id = 0;
- }
+void MystSound::stopBackground() {
+ _vm->_mixer->stopHandle(_backgroundHandle);
+ _backgroundId = 0;
+ _backgroundHandle = Audio::SoundHandle();
+}
+
+void MystSound::pauseBackground() {
+ _vm->_mixer->pauseHandle(_backgroundHandle, true);
+}
+
+void MystSound::resumeBackground() {
+ stopEffect();
+ _vm->_mixer->pauseHandle(_backgroundHandle, false);
}
-void MystSound::pauseBackgroundMyst() {
- if (_mystBackgroundSound.type == kUsedHandle)
- _vm->_mixer->pauseHandle(_mystBackgroundSound.handle, true);
+void MystSound::changeBackgroundVolume(uint16 volume) {
+ _vm->_mixer->setChannelVolume(_backgroundHandle, volume >> 8);
+}
+
+void MystSound::playSpeech(uint16 id, CueList *cueList) {
+ debug (0, "Playing speech %d", id);
+
+ Audio::RewindableAudioStream *rewindStream = makeAudioStream(id, cueList);
+ if (!rewindStream) {
+ warning("Unable to open sound '%d'", id);
+ return;
+ }
+
+ _speechSamplesPerSecond = rewindStream->getRate();
+ _vm->_mixer->playStream(Audio::Mixer::kSpeechSoundType, &_speechHandle, rewindStream);
}
-void MystSound::resumeBackgroundMyst() {
- if (_mystBackgroundSound.type == kUsedHandle)
- _vm->_mixer->pauseHandle(_mystBackgroundSound.handle, false);
+bool MystSound::isSpeechPlaying() {
+ return _vm->_mixer->isSoundHandleActive(_speechHandle);
}
-void MystSound::changeBackgroundVolumeMyst(uint16 vol) {
- if (_mystBackgroundSound.type == kUsedHandle)
- _vm->_mixer->setChannelVolume(_mystBackgroundSound.handle, vol >> 8);
+void MystSound::stopSpeech() {
+ _vm->_mixer->stopHandle(_speechHandle);
+ _speechHandle = Audio::SoundHandle();
+ _speechSamplesPerSecond = 0;
}
} // End of namespace Mohawk
diff --git a/engines/mohawk/myst_sound.h b/engines/mohawk/myst_sound.h
index d5cd5413d1..71df23df39 100644
--- a/engines/mohawk/myst_sound.h
+++ b/engines/mohawk/myst_sound.h
@@ -28,14 +28,13 @@
#include "audio/mixer.h"
-#include "mohawk/sound.h"
-
namespace Audio {
class RewindableAudioStream;
}
namespace Mohawk {
+struct CueList;
class MohawkEngine_Myst;
class MystSound {
@@ -43,32 +42,38 @@ public:
MystSound(MohawkEngine_Myst *vm);
~MystSound();
- // Generic sound functions
- Audio::SoundHandle *playSound(uint16 id, byte volume = Audio::Mixer::kMaxChannelVolume, bool loop = false, CueList *cueList = NULL);
- void stopSound();
- void stopSound(uint16 id);
- bool isPlaying(uint16 id);
- bool isPlaying();
- uint getNumSamplesPlayed(uint16 id);
-
- // Myst-specific sound functions
- Audio::SoundHandle *replaceSoundMyst(uint16 id, byte volume = Audio::Mixer::kMaxChannelVolume, bool loop = false);
- void replaceBackgroundMyst(uint16 id, uint16 volume = 0xFFFF);
- void pauseBackgroundMyst();
- void resumeBackgroundMyst();
- void stopBackgroundMyst();
- void changeBackgroundVolumeMyst(uint16 vol);
+ // Effect channel
+ void playEffect(uint16 id, bool loop = false);
+ void stopEffect();
+ bool isEffectPlaying();
+
+ // Background channel
+ void playBackground(uint16 id, uint16 volume = 0xFFFF);
+ void pauseBackground();
+ void resumeBackground();
+ void stopBackground();
+ void changeBackgroundVolume(uint16 volume);
+
+ // Speech channel
+ void playSpeech(uint16 id, CueList *cueList = nullptr);
+ bool isSpeechPlaying();
+ uint getSpeechNumSamplesPlayed();
+ void stopSpeech();
private:
MohawkEngine_Myst *_vm;
- Common::Array<SndHandle> _handles;
- SndHandle *getHandle();
- Audio::RewindableAudioStream *makeAudioStream(uint16 id, CueList *cueList = NULL);
+ Audio::RewindableAudioStream *makeAudioStream(uint16 id, CueList *cueList = nullptr);
uint16 convertMystID(uint16 id);
- // Myst-specific
- SndHandle _mystBackgroundSound;
+ Audio::SoundHandle _effectHandle;
+ int _speechSamplesPerSecond;
+ uint16 _effectId;
+
+ Audio::SoundHandle _backgroundHandle;
+ uint16 _backgroundId;
+
+ Audio::SoundHandle _speechHandle;
};
} // End of namespace Mohawk
diff --git a/engines/mohawk/myst_stacks/channelwood.cpp b/engines/mohawk/myst_stacks/channelwood.cpp
index fbe6b60e9e..a6e3e568a3 100644
--- a/engines/mohawk/myst_stacks/channelwood.cpp
+++ b/engines/mohawk/myst_stacks/channelwood.cpp
@@ -323,7 +323,7 @@ void Channelwood::o_pipeExtend(uint16 op, uint16 var, uint16 argc, uint16 *argv)
uint16 soundId = argv[0];
debugC(kDebugScript, "\tsoundId: %d", soundId);
- _vm->_sound->replaceSoundMyst(soundId);
+ _vm->_sound->playEffect(soundId);
VideoEntryPtr pipe = _vm->_video->playMovie(_vm->wrapMovieFilename("pipebrid", kChannelwoodStack));
if (!pipe)
error("Failed to open 'pipebrid' movie");
@@ -337,7 +337,7 @@ void Channelwood::o_pipeExtend(uint16 op, uint16 var, uint16 argc, uint16 *argv)
pipe->setBounds(Audio::Timestamp(0, 0, 600), Audio::Timestamp(0, 3040, 600));
_vm->waitUntilMovieEnds(pipe);
- _vm->_sound->resumeBackgroundMyst();
+ _vm->_sound->resumeBackground();
}
void Channelwood::o_drawImageChangeCardAndVolume(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
@@ -356,7 +356,7 @@ void Channelwood::o_drawImageChangeCardAndVolume(uint16 op, uint16 var, uint16 a
if (argc == 3) {
uint16 volume = argv[2];
- _vm->_sound->changeBackgroundVolumeMyst(volume);
+ _vm->_sound->changeBackgroundVolume(volume);
}
}
@@ -408,7 +408,7 @@ void Channelwood::o_leverMoveFail(uint16 op, uint16 var, uint16 argc, uint16 *ar
_leverPulled = true;
uint16 soundId = lever->getList2(0);
if (soundId)
- _vm->_sound->replaceSoundMyst(soundId);
+ _vm->_sound->playEffect(soundId);
}
} else {
_leverPulled = false;
@@ -426,13 +426,13 @@ void Channelwood::o_leverEndMove(uint16 op, uint16 var, uint16 argc, uint16 *arg
uint16 soundId = lever->getList3(0);
if (soundId)
- _vm->_sound->replaceSoundMyst(soundId);
+ _vm->_sound->playEffect(soundId);
_vm->checkCursorHints();
}
void Channelwood::o_leverEndMoveResumeBackground(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
- _vm->_sound->resumeBackgroundMyst();
+ _vm->_sound->resumeBackground();
o_leverEndMove(op, var, argc, argv);
}
@@ -442,7 +442,7 @@ void Channelwood::o_leverEndMoveWithSound(uint16 op, uint16 var, uint16 argc, ui
MystVideoInfo *lever = getInvokingResource<MystVideoInfo>();
uint16 soundId = lever->getList3(0);
if (soundId)
- _vm->_sound->replaceSoundMyst(soundId);
+ _vm->_sound->playEffect(soundId);
}
void Channelwood::o_leverElev3StartMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
@@ -455,7 +455,7 @@ void Channelwood::o_leverElev3EndMove(uint16 op, uint16 var, uint16 argc, uint16
o_leverEndMove(op, var, argc, argv);
_vm->_gfx->copyImageToScreen(3265, Common::Rect(544, 333));
_vm->doFrame();
- _vm->_sound->replaceSoundMyst(5265);
+ _vm->_sound->playEffect(5265);
}
void Channelwood::o_pumpLeverMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
@@ -465,10 +465,10 @@ void Channelwood::o_pumpLeverMove(uint16 op, uint16 var, uint16 argc, uint16 *ar
if (lever->pullLeverV()) {
uint16 soundId = lever->getList2(0);
- _vm->_sound->replaceBackgroundMyst(soundId, 38400);
+ _vm->_sound->playBackground(soundId, 38400);
} else {
uint16 soundId = lever->getList2(1);
- _vm->_sound->replaceBackgroundMyst(soundId, 36864);
+ _vm->_sound->playBackground(soundId, 36864);
}
}
@@ -478,7 +478,7 @@ void Channelwood::o_pumpLeverEndMove(uint16 op, uint16 var, uint16 argc, uint16
MystVideoInfo *lever = getInvokingResource<MystVideoInfo>();
uint16 soundId = lever->getList3(0);
if (soundId)
- _vm->_sound->replaceBackgroundMyst(soundId, 36864);
+ _vm->_sound->playBackground(soundId, 36864);
}
void Channelwood::o_stairsDoorToggle(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
@@ -519,7 +519,7 @@ void Channelwood::o_valveHandleMoveStart1(uint16 op, uint16 var, uint16 argc, ui
MystVideoInfo *handle = getInvokingResource<MystVideoInfo>();
uint16 soundId = handle->getList1(0);
if (soundId)
- _vm->_sound->replaceSoundMyst(soundId);
+ _vm->_sound->playEffect(soundId);
_vm->_cursor->setCursor(700);
o_valveHandleMove1(op, var, argc, argv);
@@ -539,7 +539,7 @@ void Channelwood::o_valveHandleMoveStop(uint16 op, uint16 var, uint16 argc, uint
// Play release sound
uint16 soundId = handle->getList3(0);
if (soundId)
- _vm->_sound->replaceSoundMyst(soundId);
+ _vm->_sound->playEffect(soundId);
// Redraw valve
_vm->redrawArea(_valveVar);
@@ -570,7 +570,7 @@ void Channelwood::o_valveHandleMoveStart2(uint16 op, uint16 var, uint16 argc, ui
MystVideoInfo *handle = getInvokingResource<MystVideoInfo>();
uint16 soundId = handle->getList1(0);
if (soundId)
- _vm->_sound->replaceSoundMyst(soundId);
+ _vm->_sound->playEffect(soundId);
_vm->_cursor->setCursor(700);
o_valveHandleMove2(op, var, argc, argv);
@@ -598,7 +598,7 @@ void Channelwood::o_valveHandleMoveStart3(uint16 op, uint16 var, uint16 argc, ui
MystVideoInfo *handle = getInvokingResource<MystVideoInfo>();
uint16 soundId = handle->getList1(0);
if (soundId)
- _vm->_sound->replaceSoundMyst(soundId);
+ _vm->_sound->playEffect(soundId);
_vm->_cursor->setCursor(700);
o_valveHandleMove3(op, var, argc, argv);
@@ -661,7 +661,7 @@ void Channelwood::o_drawerOpen(uint16 op, uint16 var, uint16 argc, uint16 *argv)
void Channelwood::o_hologramTemple(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
debugC(kDebugScript, "Opcode %d: Temple hologram", op);
- _vm->_sound->pauseBackgroundMyst();
+ _vm->_sound->pauseBackground();
// Used on Card 3333 (Temple Hologram)
switch (_state.holoprojectorSelection) {
@@ -682,7 +682,7 @@ void Channelwood::o_hologramTemple(uint16 op, uint16 var, uint16 argc, uint16 *a
break;
}
- _vm->_sound->resumeBackgroundMyst();
+ _vm->_sound->resumeBackground();
}
void Channelwood::o_executeMouseUp(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
@@ -745,9 +745,9 @@ void Channelwood::o_elevatorMovies(uint16 op, uint16 var, uint16 argc, uint16 *a
error("Unknown elevator state %d in o_elevatorMovies", elevator);
}
- _vm->_sound->pauseBackgroundMyst();
+ _vm->_sound->pauseBackground();
_vm->playMovieBlocking(movie, x, y);
- _vm->_sound->resumeBackgroundMyst();
+ _vm->_sound->resumeBackground();
}
void Channelwood::o_soundReplace(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
@@ -755,8 +755,8 @@ void Channelwood::o_soundReplace(uint16 op, uint16 var, uint16 argc, uint16 *arg
uint16 soundId = argv[0];
- if (!_vm->_sound->isPlaying()) {
- _vm->_sound->replaceSoundMyst(soundId);
+ if (!_vm->_sound->isEffectPlaying()) {
+ _vm->_sound->playEffect(soundId);
}
}
diff --git a/engines/mohawk/myst_stacks/mechanical.cpp b/engines/mohawk/myst_stacks/mechanical.cpp
index 09a876e107..5a1b5e04ae 100644
--- a/engines/mohawk/myst_stacks/mechanical.cpp
+++ b/engines/mohawk/myst_stacks/mechanical.cpp
@@ -283,7 +283,7 @@ void Mechanical::o_birdCrankStart(uint16 op, uint16 var, uint16 argc, uint16 *ar
MystAreaDrag *crank = getInvokingResource<MystAreaDrag>();
uint16 crankSoundId = crank->getList2(0);
- _vm->_sound->replaceSoundMyst(crankSoundId, Audio::Mixer::kMaxChannelVolume, true);
+ _vm->_sound->playEffect(crankSoundId, true);
_birdSingEndTime = 0;
_birdCrankStartTime = _vm->_system->getMillis();
@@ -301,7 +301,7 @@ void Mechanical::o_birdCrankStop(uint16 op, uint16 var, uint16 argc, uint16 *arg
crankMovie->pauseMovie(true);
uint16 crankSoundId = crank->getList2(1);
- _vm->_sound->replaceSoundMyst(crankSoundId);
+ _vm->_sound->playEffect(crankSoundId);
_birdSingEndTime = 2 * _vm->_system->getMillis() - _birdCrankStartTime;
_birdSinging = true;
@@ -343,7 +343,7 @@ void Mechanical::o_elevatorRotationStart(uint16 op, uint16 var, uint16 argc, uin
_elevatorRotationLeverMoving = true;
_elevatorRotationSpeed = 0;
- _vm->_sound->stopBackgroundMyst();
+ _vm->_sound->stopBackground();
_vm->_cursor->setCursor(700);
}
@@ -407,7 +407,7 @@ void Mechanical::o_elevatorRotationStop(uint16 op, uint16 var, uint16 argc, uint
// Increment position
_state.elevatorRotation = (_state.elevatorRotation + 1) % 10;
- _vm->_sound->replaceSoundMyst(_elevatorRotationSoundId);
+ _vm->_sound->playEffect(_elevatorRotationSoundId);
_vm->redrawArea(11);
}
@@ -626,17 +626,17 @@ void Mechanical::elevatorGoMiddle_run() {
_vm->_cursor->hideCursor();
_vm->playSoundBlocking(11120);
_vm->_gfx->copyImageToBackBuffer(6118, Common::Rect(544, 333));
- _vm->_sound->replaceSoundMyst(12120);
+ _vm->_sound->playEffect(12120);
_vm->_gfx->runTransition(kTransitionSlideToLeft, Common::Rect(177, 0, 370, 333), 25, 0);
_vm->playSoundBlocking(13120);
- _vm->_sound->replaceSoundMyst(8120);
+ _vm->_sound->playEffect(8120);
_vm->_gfx->copyImageToBackBuffer(6327, Common::Rect(544, 333));
_vm->wait(500);
- _vm->_sound->replaceSoundMyst(9120);
+ _vm->_sound->playEffect(9120);
static uint16 moviePos[2] = { 3540, 5380 };
o_elevatorWindowMovie(121, 0, 2, moviePos);
_vm->_gfx->copyBackBufferToScreen(Common::Rect(544, 333));
- _vm->_sound->replaceSoundMyst(10120);
+ _vm->_sound->playEffect(10120);
_vm->_cursor->showCursor();
_elevatorPosition = 1;
@@ -754,7 +754,7 @@ void Mechanical::birdSing_run() {
uint32 time = _vm->_system->getMillis();
if (_birdSingEndTime < time) {
_bird->pauseMovie(true);
- _vm->_sound->stopSound();
+ _vm->_sound->stopEffect();
_birdSinging = false;
}
}
@@ -784,7 +784,7 @@ void Mechanical::elevatorRotation_run() {
_state.elevatorRotation = (_state.elevatorRotation + 1) % 10;
- _vm->_sound->replaceSoundMyst(_elevatorRotationSoundId);
+ _vm->_sound->playEffect(_elevatorRotationSoundId);
_vm->redrawArea(11);
_vm->wait(100);
}
@@ -910,15 +910,15 @@ void Mechanical::o_fortressRotation_init(uint16 op, uint16 var, uint16 argc, uin
void Mechanical::fortressSimulation_run() {
if (_fortressSimulationInit) {
// Init sequence
- _vm->_sound->replaceBackgroundMyst(_fortressSimulationStartSound1, 65535);
+ _vm->_sound->playBackground(_fortressSimulationStartSound1, 65535);
_vm->wait(5000, true);
VideoEntryPtr startup = _fortressSimulationStartup->playMovie();
_vm->playSoundBlocking(_fortressSimulationStartSound2);
- _vm->_sound->replaceBackgroundMyst(_fortressSimulationStartSound1, 65535);
+ _vm->_sound->playBackground(_fortressSimulationStartSound1, 65535);
_vm->waitUntilMovieEnds(startup);
- _vm->_sound->stopBackgroundMyst();
- _vm->_sound->replaceSoundMyst(_fortressSimulationStartSound2);
+ _vm->_sound->stopBackground();
+ _vm->_sound->playEffect(_fortressSimulationStartSound2);
Common::Rect src = Common::Rect(0, 0, 176, 176);
diff --git a/engines/mohawk/myst_stacks/myst.cpp b/engines/mohawk/myst_stacks/myst.cpp
index f98fee07d4..71747fa158 100644
--- a/engines/mohawk/myst_stacks/myst.cpp
+++ b/engines/mohawk/myst_stacks/myst.cpp
@@ -825,9 +825,9 @@ void Myst::o_libraryBookPageTurnLeft(uint16 op, uint16 var, uint16 argc, uint16
_vm->_gfx->copyImageToScreen(_libraryBookBaseImage + _libraryBookPage, rect);
if (_vm->_rnd->getRandomBit())
- _vm->_sound->replaceSoundMyst(_libraryBookSound1);
+ _vm->_sound->playEffect(_libraryBookSound1);
else
- _vm->_sound->replaceSoundMyst(_libraryBookSound2);
+ _vm->_sound->playEffect(_libraryBookSound2);
}
}
@@ -841,9 +841,9 @@ void Myst::o_libraryBookPageTurnRight(uint16 op, uint16 var, uint16 argc, uint16
_vm->_gfx->copyImageToScreen(_libraryBookBaseImage + _libraryBookPage, rect);
if (_vm->_rnd->getRandomBit())
- _vm->_sound->replaceSoundMyst(_libraryBookSound1);
+ _vm->_sound->playEffect(_libraryBookSound1);
else
- _vm->_sound->replaceSoundMyst(_libraryBookSound2);
+ _vm->_sound->playEffect(_libraryBookSound2);
}
}
@@ -918,7 +918,7 @@ void Myst::o_towerRotationStart(uint16 op, uint16 var, uint16 argc, uint16 *argv
towerRotationMapComputeAngle();
towerRotationMapDrawLine(center, end);
- _vm->_sound->replaceSoundMyst(5378, Audio::Mixer::kMaxChannelVolume, true);
+ _vm->_sound->playEffect(5378, true);
}
void Myst::o_towerRotationEnd(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
@@ -943,7 +943,7 @@ void Myst::o_towerRotationEnd(uint16 op, uint16 var, uint16 argc, uint16 *argv)
_state.towerRotationAngle = 152;
}
- _vm->_sound->replaceSoundMyst(6378);
+ _vm->_sound->playEffect(6378);
_towerRotationBlinkLabel = true;
_towerRotationBlinkLabelCount = 0;
@@ -998,7 +998,7 @@ void Myst::o_dockVaultOpen(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
else
_dockVaultState = 1;
- _vm->_sound->replaceSoundMyst(soundId);
+ _vm->_sound->playEffect(soundId);
_vm->redrawArea(41, false);
animatedUpdate(directionalUpdateDataSize, &argv[3], delay);
}
@@ -1025,7 +1025,7 @@ void Myst::o_dockVaultClose(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
if (_dockVaultState == 1 || _dockVaultState == 2)
_dockVaultState = 0;
- _vm->_sound->replaceSoundMyst(soundId);
+ _vm->_sound->playEffect(soundId);
_vm->redrawArea(41, false);
animatedUpdate(directionalUpdateDataSize, &argv[3], delay);
}
@@ -1129,7 +1129,7 @@ void Myst::o_clockWheelsExecute(uint16 op, uint16 var, uint16 argc, uint16 *argv
&& _state.clockTowerMinutePosition == 40;
if (!_state.clockTowerBridgeOpen && correctTime) {
- _vm->_sound->replaceSoundMyst(soundId);
+ _vm->_sound->playEffect(soundId);
_vm->wait(500);
// Gears rise up
@@ -1144,7 +1144,7 @@ void Myst::o_clockWheelsExecute(uint16 op, uint16 var, uint16 argc, uint16 *argv
_state.clockTowerBridgeOpen = 1;
_vm->redrawArea(12);
} else if (_state.clockTowerBridgeOpen && !correctTime) {
- _vm->_sound->replaceSoundMyst(soundId);
+ _vm->_sound->playEffect(soundId);
_vm->wait(500);
// Gears sink down
@@ -1167,7 +1167,7 @@ void Myst::o_imagerPlayButton(uint16 op, uint16 var, uint16 argc, uint16 *argv)
uint16 video = getVar(51);
// Press button
- _vm->_sound->replaceSoundMyst(4698);
+ _vm->_sound->playEffect(4698);
Common::Rect src = Common::Rect(0, 0, 32, 75);
Common::Rect dest = Common::Rect(261, 257, 293, 332);
@@ -1183,7 +1183,7 @@ void Myst::o_imagerPlayButton(uint16 op, uint16 var, uint16 argc, uint16 *argv)
// Play selected video
if (!_state.imagerActive && video != 3)
- _vm->_sound->replaceSoundMyst(argv[0]);
+ _vm->_sound->playEffect(argv[0]);
switch (video) {
case 0: // Nothing
@@ -1220,7 +1220,7 @@ void Myst::o_imagerPlayButton(uint16 op, uint16 var, uint16 argc, uint16 *argv)
_imagerMovie->setBlocking(false);
if (_state.imagerActive) {
- _vm->_sound->replaceSoundMyst(argv[1]);
+ _vm->_sound->playEffect(argv[1]);
// Water disappearing
VideoEntryPtr water = _imagerMovie->playMovie();
@@ -1301,11 +1301,11 @@ void Myst::imagerValidation_run() {
_imagerRedButton->drawConditionalDataToScreen(1);
if (_imagerValidationStep < 6)
- _vm->_sound->replaceSoundMyst(_imagerSound[0]);
+ _vm->_sound->playEffect(_imagerSound[0]);
else if (_imagerValidationStep < 10)
- _vm->_sound->replaceSoundMyst(_imagerSound[1]);
+ _vm->_sound->playEffect(_imagerSound[1]);
else if (_imagerValidationStep == 10)
- _vm->_sound->replaceSoundMyst(_imagerSound[2]);
+ _vm->_sound->playEffect(_imagerSound[2]);
_imagerValidationStep++;
@@ -1328,8 +1328,8 @@ void Myst::o_towerElevatorAnimation(uint16 op, uint16 var, uint16 argc, uint16 *
_treeStopped = true;
_vm->_cursor->hideCursor();
- _vm->_sound->stopSound();
- _vm->_sound->pauseBackgroundMyst();
+ _vm->_sound->stopEffect();
+ _vm->_sound->pauseBackground();
switch (argv[0]) {
case 0:
@@ -1342,7 +1342,7 @@ void Myst::o_towerElevatorAnimation(uint16 op, uint16 var, uint16 argc, uint16 *
break;
}
- _vm->_sound->resumeBackgroundMyst();
+ _vm->_sound->resumeBackground();
_vm->_cursor->showCursor();
_treeStopped = false;
}
@@ -1366,17 +1366,17 @@ void Myst::o_generatorButtonPressed(uint16 op, uint16 var, uint16 argc, uint16 *
_state.generatorVoltage -= value;
if (_state.generatorVoltage)
- _vm->_sound->replaceSoundMyst(8297);
+ _vm->_sound->playEffect(8297);
else {
- _vm->_sound->replaceSoundMyst(9297);
- _vm->_sound->stopBackgroundMyst();
+ _vm->_sound->playEffect(9297);
+ _vm->_sound->stopBackground();
}
} else {
if (_generatorVoltage)
- _vm->_sound->replaceSoundMyst(6297);
+ _vm->_sound->playEffect(6297);
else {
- _vm->_sound->replaceSoundMyst(7297);
- _vm->_sound->replaceBackgroundMyst(4297);
+ _vm->_sound->playBackground(4297);
+ _vm->_sound->playEffect(7297);
}
_state.generatorButtons |= mask;
@@ -1482,13 +1482,13 @@ void Myst::o_cabinSafeHandleMove(uint16 op, uint16 var, uint16 argc, uint16 *arg
if (_tempVar == 0) {
uint16 soundId = handle->getList2(0);
if (soundId)
- _vm->_sound->replaceSoundMyst(soundId);
+ _vm->_sound->playEffect(soundId);
}
// Combination is right
if (_state.cabinSafeCombination == 724) {
uint16 soundId = handle->getList2(1);
if (soundId)
- _vm->_sound->replaceSoundMyst(soundId);
+ _vm->_sound->playEffect(soundId);
_vm->changeToCard(4103, kNoTransition);
@@ -1513,7 +1513,7 @@ void Myst::o_cabinSafeHandleEndMove(uint16 op, uint16 var, uint16 argc, uint16 *
void Myst::o_observatoryMonthChangeStart(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
debugC(kDebugScript, "Opcode %d: Observatory month change start", op);
- _vm->_sound->pauseBackgroundMyst();
+ _vm->_sound->pauseBackground();
if (op == 129 || op == 131) {
// Increase
@@ -1561,7 +1561,7 @@ void Myst::observatoryIncrementMonth(int16 increment) {
_state.observatoryMonthSlider = _observatoryMonthSlider->_pos.y;
}
- _vm->_sound->replaceSoundMyst(8500);
+ _vm->_sound->playEffect(8500);
}
void Myst::observatoryMonthChange_run() {
@@ -1572,7 +1572,7 @@ void Myst::observatoryMonthChange_run() {
void Myst::o_observatoryDayChangeStart(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
debugC(kDebugScript, "Opcode %d: Observatory day change start", op);
- _vm->_sound->pauseBackgroundMyst();
+ _vm->_sound->pauseBackground();
if (op == 129 || op == 131) {
// Increase
@@ -1621,7 +1621,7 @@ void Myst::observatoryIncrementDay(int16 increment) {
_state.observatoryDaySlider = _observatoryDaySlider->_pos.y;
}
- _vm->_sound->replaceSoundMyst(8500);
+ _vm->_sound->playEffect(8500);
}
void Myst::observatoryDayChange_run() {
@@ -1632,7 +1632,7 @@ void Myst::observatoryDayChange_run() {
void Myst::o_observatoryYearChangeStart(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
debugC(kDebugScript, "Opcode %d: Observatory year change start", op);
- _vm->_sound->pauseBackgroundMyst();
+ _vm->_sound->pauseBackground();
if (op == 196) {
// Increase
@@ -1675,7 +1675,7 @@ void Myst::observatoryIncrementYear(int16 increment) {
_state.observatoryYearSlider = _observatoryYearSlider->_pos.y;
}
- _vm->_sound->replaceSoundMyst(8500);
+ _vm->_sound->playEffect(8500);
}
void Myst::observatoryYearChange_run() {
@@ -1686,7 +1686,7 @@ void Myst::observatoryYearChange_run() {
void Myst::o_observatoryTimeChangeStart(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
debugC(kDebugScript, "Opcode %d: Observatory time change start", op);
- _vm->_sound->pauseBackgroundMyst();
+ _vm->_sound->pauseBackground();
if (op == 192) {
// Increase
@@ -1734,7 +1734,7 @@ void Myst::observatoryIncrementTime(int16 increment) {
_state.observatoryTimeSlider = _observatoryTimeSlider->_pos.y;
}
- _vm->_sound->replaceSoundMyst(8500);
+ _vm->_sound->playEffect(8500);
}
void Myst::observatoryTimeChange_run() {
@@ -1751,7 +1751,7 @@ void Myst::o_observatoryGoButton(uint16 op, uint16 var, uint16 argc, uint16 *arg
|| _state.observatoryYearTarget != _state.observatoryYearSetting
|| _state.observatoryTimeTarget != _state.observatoryTimeSetting) {
uint16 soundId = argv[0];
- _vm->_sound->replaceSoundMyst(soundId);
+ _vm->_sound->playEffect(soundId);
int16 distance = _state.observatoryYearTarget - _state.observatoryYearSetting;
uint32 end = _vm->_system->getMillis() + 32 * ABS(distance) / 50 + 800;
@@ -1764,7 +1764,7 @@ void Myst::o_observatoryGoButton(uint16 op, uint16 var, uint16 argc, uint16 *arg
_vm->redrawResource(_observatoryVisualizer);
}
- _vm->_sound->resumeBackgroundMyst();
+ _vm->_sound->resumeBackground();
// Redraw visualizer
observatorySetTargetToSetting();
@@ -1832,11 +1832,11 @@ void Myst::o_circuitBreakerMove(uint16 op, uint16 var, uint16 argc, uint16 *argv
if (_state.generatorVoltage > 59 || _state.generatorBreakers != 1) {
uint16 soundId = breaker->getList2(1);
if (soundId)
- _vm->_sound->replaceSoundMyst(soundId);
+ _vm->_sound->playEffect(soundId);
} else {
uint16 soundId = breaker->getList2(0);
if (soundId)
- _vm->_sound->replaceSoundMyst(soundId);
+ _vm->_sound->playEffect(soundId);
// Reset breaker state
_state.generatorBreakers = 0;
@@ -1846,11 +1846,11 @@ void Myst::o_circuitBreakerMove(uint16 op, uint16 var, uint16 argc, uint16 *argv
if (_state.generatorVoltage > 59 || _state.generatorBreakers != 2) {
uint16 soundId = breaker->getList2(1);
if (soundId)
- _vm->_sound->replaceSoundMyst(soundId);
+ _vm->_sound->playEffect(soundId);
} else {
uint16 soundId = breaker->getList2(0);
if (soundId)
- _vm->_sound->replaceSoundMyst(soundId);
+ _vm->_sound->playEffect(soundId);
// Reset breaker state
_state.generatorBreakers = 0;
@@ -1873,7 +1873,7 @@ void Myst::o_boilerIncreasePressureStart(uint16 op, uint16 var, uint16 argc, uin
_treeStopped = true;
if (_state.cabinValvePosition < 25)
- _vm->_sound->stopBackgroundMyst();
+ _vm->_sound->stopBackground();
_boilerPressureIncreasing = true;
}
@@ -1892,7 +1892,7 @@ void Myst::o_boilerLightPilot(uint16 op, uint16 var, uint16 argc, uint16 *argv)
_matchGoOutTime = _vm->_system->getMillis();
if (_state.cabinValvePosition > 0)
- _vm->_sound->replaceBackgroundMyst(8098, 49152);
+ _vm->_sound->playBackground(8098, 49152);
if (_state.cabinValvePosition > 12) {
// Compute the speed of the gauge to synchronize it with the next tree move
@@ -1949,7 +1949,7 @@ void Myst::o_boilerIncreasePressureStop(uint16 op, uint16 var, uint16 argc, uint
if (_state.cabinPilotLightLit == 1) {
if (_state.cabinValvePosition > 0)
- _vm->_sound->replaceBackgroundMyst(8098, 49152);
+ _vm->_sound->playBackground(8098, 49152);
if (_cabinGaugeMovie && !_cabinGaugeMovie->endOfVideo()) {
uint16 delay = treeNextMoveDelay(_state.cabinValvePosition);
@@ -1958,12 +1958,12 @@ void Myst::o_boilerIncreasePressureStop(uint16 op, uint16 var, uint16 argc, uint
}
} else if (_state.cabinValvePosition > 0)
- _vm->_sound->replaceBackgroundMyst(4098, _state.cabinValvePosition << 10);
+ _vm->_sound->playBackground(4098, _state.cabinValvePosition << 10);
}
void Myst::boilerPressureIncrease_run() {
// Allow increasing pressure if sound has stopped
- if (!_vm->_sound->isPlaying(5098) && _state.cabinValvePosition < 25) {
+ if (!_vm->_sound->isEffectPlaying() && _state.cabinValvePosition < 25) {
_state.cabinValvePosition++;
if (_state.cabinValvePosition == 1) {
// Set fire to high
@@ -1973,13 +1973,13 @@ void Myst::boilerPressureIncrease_run() {
_vm->redrawArea(305);
} else if (_state.cabinValvePosition == 25) {
if (_state.cabinPilotLightLit == 1)
- _vm->_sound->replaceBackgroundMyst(8098, 49152);
+ _vm->_sound->playBackground(8098, 49152);
else
- _vm->_sound->replaceBackgroundMyst(4098, 25600);
+ _vm->_sound->playBackground(4098, 25600);
}
// Pressure increasing sound
- _vm->_sound->replaceSoundMyst(5098);
+ _vm->_sound->playEffect(5098);
// Redraw wheel
_vm->redrawArea(99);
@@ -1988,7 +1988,7 @@ void Myst::boilerPressureIncrease_run() {
void Myst::boilerPressureDecrease_run() {
// Allow decreasing pressure if sound has stopped
- if (!_vm->_sound->isPlaying(5098) && _state.cabinValvePosition > 0) {
+ if (!_vm->_sound->isEffectPlaying() && _state.cabinValvePosition > 0) {
_state.cabinValvePosition--;
if (_state.cabinValvePosition == 0) {
// Set fire to low
@@ -1999,7 +1999,7 @@ void Myst::boilerPressureDecrease_run() {
}
// Pressure increasing sound
- _vm->_sound->replaceSoundMyst(5098);
+ _vm->_sound->playEffect(5098);
// Redraw wheel
_vm->redrawArea(99);
@@ -2010,7 +2010,7 @@ void Myst::o_boilerDecreasePressureStart(uint16 op, uint16 var, uint16 argc, uin
debugC(kDebugScript, "Opcode %d: Boiler decrease pressure start", op);
_treeStopped = true;
- _vm->_sound->stopBackgroundMyst();
+ _vm->_sound->stopBackground();
_boilerPressureDecreasing = true;
}
@@ -2024,7 +2024,7 @@ void Myst::o_boilerDecreasePressureStop(uint16 op, uint16 var, uint16 argc, uint
if (_state.cabinPilotLightLit == 1) {
if (_state.cabinValvePosition > 0)
- _vm->_sound->replaceBackgroundMyst(8098, 49152);
+ _vm->_sound->playBackground(8098, 49152);
if (_cabinGaugeMovie && !_cabinGaugeMovie->endOfVideo()) {
uint16 delay = treeNextMoveDelay(_state.cabinValvePosition);
@@ -2034,7 +2034,7 @@ void Myst::o_boilerDecreasePressureStop(uint16 op, uint16 var, uint16 argc, uint
} else {
if (_state.cabinValvePosition > 0)
- _vm->_sound->replaceBackgroundMyst(4098, _state.cabinValvePosition << 10);
+ _vm->_sound->playBackground(4098, _state.cabinValvePosition << 10);
}
}
@@ -2055,11 +2055,11 @@ void Myst::o_basementIncreasePressureStop(uint16 op, uint16 var, uint16 argc, ui
void Myst::basementPressureIncrease_run() {
// Allow increasing pressure if sound has stopped
- if (!_vm->_sound->isPlaying(4642) && _state.cabinValvePosition < 25) {
+ if (!_vm->_sound->isEffectPlaying() && _state.cabinValvePosition < 25) {
_state.cabinValvePosition++;
// Pressure increasing sound
- _vm->_sound->replaceSoundMyst(4642);
+ _vm->_sound->playEffect(4642);
// Redraw wheel
_vm->redrawArea(99);
@@ -2068,11 +2068,11 @@ void Myst::basementPressureIncrease_run() {
void Myst::basementPressureDecrease_run() {
// Allow decreasing pressure if sound has stopped
- if (!_vm->_sound->isPlaying(4642) && _state.cabinValvePosition > 0) {
+ if (!_vm->_sound->isEffectPlaying() && _state.cabinValvePosition > 0) {
_state.cabinValvePosition--;
// Pressure decreasing sound
- _vm->_sound->replaceSoundMyst(4642);
+ _vm->_sound->playEffect(4642);
// Redraw wheel
_vm->redrawArea(99);
@@ -2117,18 +2117,18 @@ void Myst::tree_run() {
// Tree movement
if (goingDown) {
_state.treePosition--;
- _vm->_sound->replaceSoundMyst(2);
+ _vm->_sound->playEffect(2);
} else {
_state.treePosition++;
- _vm->_sound->replaceSoundMyst(1);
+ _vm->_sound->playEffect(1);
}
// Stop background music if going up from book room
if (_vm->getCurCard() == 4630) {
if (_state.treePosition > 0)
- _vm->_sound->stopBackgroundMyst();
+ _vm->_sound->stopBackground();
else
- _vm->_sound->replaceBackgroundMyst(4630, 24576);
+ _vm->_sound->playBackground(4630, 24576);
}
// Redraw tree
@@ -2168,7 +2168,7 @@ void Myst::o_rocketSoundSliderStartMove(uint16 op, uint16 var, uint16 argc, uint
_rocketSliderSound = 0;
_vm->_cursor->setCursor(700);
- _vm->_sound->pauseBackgroundMyst();
+ _vm->_sound->pauseBackground();
rocketSliderMove();
}
@@ -2184,7 +2184,7 @@ void Myst::o_rocketSoundSliderEndMove(uint16 op, uint16 var, uint16 argc, uint16
_vm->checkCursorHints();
if (_state.generatorVoltage == 59 && !_state.generatorBreakers && _rocketSliderSound)
- _vm->_sound->stopSound();
+ _vm->_sound->stopEffect();
if (getInvokingResource<MystArea>() == _rocketSlider1)
_state.rocketSliderPosition[0] = _rocketSlider1->_pos.y;
@@ -2197,7 +2197,7 @@ void Myst::o_rocketSoundSliderEndMove(uint16 op, uint16 var, uint16 argc, uint16
else if (getInvokingResource<MystArea>() == _rocketSlider5)
_state.rocketSliderPosition[4] = _rocketSlider5->_pos.y;
- _vm->_sound->resumeBackgroundMyst();
+ _vm->_sound->resumeBackground();
}
void Myst::rocketSliderMove() {
@@ -2207,7 +2207,7 @@ void Myst::rocketSliderMove() {
uint16 soundId = rocketSliderGetSound(slider->_pos.y);
if (soundId != _rocketSliderSound) {
_rocketSliderSound = soundId;
- _vm->_sound->replaceSoundMyst(soundId, Audio::Mixer::kMaxChannelVolume, true);
+ _vm->_sound->playEffect(soundId, true);
}
}
}
@@ -2223,41 +2223,41 @@ void Myst::rocketCheckSolution() {
bool solved = true;
soundId = rocketSliderGetSound(_rocketSlider1->_pos.y);
- _vm->_sound->replaceSoundMyst(soundId);
+ _vm->_sound->playEffect(soundId);
_rocketSlider1->drawConditionalDataToScreen(2);
_vm->wait(250);
if (soundId != 9558)
solved = false;
soundId = rocketSliderGetSound(_rocketSlider2->_pos.y);
- _vm->_sound->replaceSoundMyst(soundId);
+ _vm->_sound->playEffect(soundId);
_rocketSlider2->drawConditionalDataToScreen(2);
_vm->wait(250);
if (soundId != 9546)
solved = false;
soundId = rocketSliderGetSound(_rocketSlider3->_pos.y);
- _vm->_sound->replaceSoundMyst(soundId);
+ _vm->_sound->playEffect(soundId);
_rocketSlider3->drawConditionalDataToScreen(2);
_vm->wait(250);
if (soundId != 9543)
solved = false;
soundId = rocketSliderGetSound(_rocketSlider4->_pos.y);
- _vm->_sound->replaceSoundMyst(soundId);
+ _vm->_sound->playEffect(soundId);
_rocketSlider4->drawConditionalDataToScreen(2);
_vm->wait(250);
if (soundId != 9553)
solved = false;
soundId = rocketSliderGetSound(_rocketSlider5->_pos.y);
- _vm->_sound->replaceSoundMyst(soundId);
+ _vm->_sound->playEffect(soundId);
_rocketSlider5->drawConditionalDataToScreen(2);
_vm->wait(250);
if (soundId != 9560)
solved = false;
- _vm->_sound->stopSound();
+ _vm->_sound->stopEffect();
if (solved) {
// Reset lever position
@@ -2313,9 +2313,9 @@ void Myst::o_rocketPianoStart(uint16 op, uint16 var, uint16 argc, uint16 *argv)
// Play note
_rocketPianoSound = 0;
if (_state.generatorVoltage == 59 && !_state.generatorBreakers) {
- _vm->_sound->pauseBackgroundMyst();
+ _vm->_sound->pauseBackground();
_rocketPianoSound = key->getList1(0);
- _vm->_sound->replaceSoundMyst(_rocketPianoSound, Audio::Mixer::kMaxChannelVolume, true);
+ _vm->_sound->playEffect(_rocketPianoSound, true);
}
}
@@ -2355,13 +2355,13 @@ void Myst::o_rocketPianoMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
uint16 soundId = key->getList1(0);
if (soundId != _rocketPianoSound) {
_rocketPianoSound = soundId;
- _vm->_sound->replaceSoundMyst(soundId, Audio::Mixer::kMaxChannelVolume, true);
+ _vm->_sound->playEffect(soundId, true);
}
}
} else {
// Not pressing a key anymore
- _vm->_sound->stopSound();
- _vm->_sound->resumeBackgroundMyst();
+ _vm->_sound->stopEffect();
+ _vm->_sound->resumeBackground();
}
}
}
@@ -2379,8 +2379,8 @@ void Myst::o_rocketPianoStop(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
// Draw unpressed piano key
_vm->_gfx->copyImageSectionToScreen(key->getSubImage(0).wdib, src, dest);
- _vm->_sound->stopSound();
- _vm->_sound->resumeBackgroundMyst();
+ _vm->_sound->stopEffect();
+ _vm->_sound->resumeBackground();
}
void Myst::o_rocketLeverStartMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
@@ -2422,7 +2422,7 @@ void Myst::o_rocketLeverMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
uint16 soundId = lever->getList2(0);
if (soundId)
- _vm->_sound->replaceSoundMyst(soundId);
+ _vm->_sound->playEffect(soundId);
// If rocket correctly powered
if (_state.generatorVoltage == 59 && !_state.generatorBreakers)
@@ -2484,7 +2484,7 @@ void Myst::o_observatoryMonthSliderStartMove(uint16 op, uint16 var, uint16 argc,
debugC(kDebugScript, "Opcode %d: Month slider start move", op);
_vm->_cursor->setCursor(700);
- _vm->_sound->pauseBackgroundMyst();
+ _vm->_sound->pauseBackground();
observatoryUpdateMonth();
}
@@ -2493,7 +2493,7 @@ void Myst::o_observatoryMonthSliderEndMove(uint16 op, uint16 var, uint16 argc, u
debugC(kDebugScript, "Opcode %d: Month slider end move", op);
_vm->checkCursorHints();
- _vm->_sound->resumeBackgroundMyst();
+ _vm->_sound->resumeBackground();
observatoryUpdateMonth();
}
@@ -2504,7 +2504,7 @@ void Myst::observatoryUpdateMonth() {
if (month != _state.observatoryMonthSetting) {
_state.observatoryMonthSetting = month;
_state.observatoryMonthSlider = _observatoryMonthSlider->_pos.y;
- _vm->_sound->replaceSoundMyst(8500);
+ _vm->_sound->playEffect(8500);
// Redraw digits
_vm->redrawArea(73);
@@ -2515,7 +2515,7 @@ void Myst::o_observatoryDaySliderStartMove(uint16 op, uint16 var, uint16 argc, u
debugC(kDebugScript, "Opcode %d: Day slider start move", op);
_vm->_cursor->setCursor(700);
- _vm->_sound->pauseBackgroundMyst();
+ _vm->_sound->pauseBackground();
observatoryUpdateDay();
}
@@ -2524,7 +2524,7 @@ void Myst::o_observatoryDaySliderEndMove(uint16 op, uint16 var, uint16 argc, uin
debugC(kDebugScript, "Opcode %d: Day slider end move", op);
_vm->checkCursorHints();
- _vm->_sound->resumeBackgroundMyst();
+ _vm->_sound->resumeBackground();
observatoryUpdateDay();
}
@@ -2535,7 +2535,7 @@ void Myst::observatoryUpdateDay() {
if (day != _state.observatoryDaySetting) {
_state.observatoryDaySetting = day;
_state.observatoryDaySlider = _observatoryDaySlider->_pos.y;
- _vm->_sound->replaceSoundMyst(8500);
+ _vm->_sound->playEffect(8500);
// Redraw digits
_vm->redrawArea(75);
@@ -2547,7 +2547,7 @@ void Myst::o_observatoryYearSliderStartMove(uint16 op, uint16 var, uint16 argc,
debugC(kDebugScript, "Opcode %d: Year slider start move", op);
_vm->_cursor->setCursor(700);
- _vm->_sound->pauseBackgroundMyst();
+ _vm->_sound->pauseBackground();
observatoryUpdateYear();
}
@@ -2556,7 +2556,7 @@ void Myst::o_observatoryYearSliderEndMove(uint16 op, uint16 var, uint16 argc, ui
debugC(kDebugScript, "Opcode %d: Year slider end move", op);
_vm->checkCursorHints();
- _vm->_sound->resumeBackgroundMyst();
+ _vm->_sound->resumeBackground();
observatoryUpdateYear();
}
@@ -2567,7 +2567,7 @@ void Myst::observatoryUpdateYear() {
if (year != _state.observatoryYearSetting) {
_state.observatoryYearSetting = year;
_state.observatoryYearSlider = _observatoryYearSlider->_pos.y;
- _vm->_sound->replaceSoundMyst(8500);
+ _vm->_sound->playEffect(8500);
// Redraw digits
_vm->redrawArea(79);
@@ -2581,7 +2581,7 @@ void Myst::o_observatoryTimeSliderStartMove(uint16 op, uint16 var, uint16 argc,
debugC(kDebugScript, "Opcode %d: Time slider start move", op);
_vm->_cursor->setCursor(700);
- _vm->_sound->pauseBackgroundMyst();
+ _vm->_sound->pauseBackground();
observatoryUpdateTime();
}
@@ -2590,7 +2590,7 @@ void Myst::o_observatoryTimeSliderEndMove(uint16 op, uint16 var, uint16 argc, ui
debugC(kDebugScript, "Opcode %d: Time slider end move", op);
_vm->checkCursorHints();
- _vm->_sound->resumeBackgroundMyst();
+ _vm->_sound->resumeBackground();
observatoryUpdateTime();
}
@@ -2601,7 +2601,7 @@ void Myst::observatoryUpdateTime() {
if (time != _state.observatoryTimeSetting) {
_state.observatoryTimeSetting = time;
_state.observatoryTimeSlider = _observatoryTimeSlider->_pos.y;
- _vm->_sound->replaceSoundMyst(8500);
+ _vm->_sound->playEffect(8500);
// Redraw digits
_vm->redrawArea(80);
@@ -2622,7 +2622,7 @@ void Myst::o_libraryCombinationBookStop(uint16 op, uint16 var, uint16 argc, uint
void Myst::o_cabinMatchLight(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
if (!_cabinMatchState) {
- _vm->_sound->replaceSoundMyst(4103);
+ _vm->_sound->playEffect(4103);
// Match is lit
_cabinMatchState = 1;
@@ -2662,7 +2662,7 @@ void Myst::matchBurn_run() {
void Myst::o_courtyardBoxEnter(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
debugC(kDebugScript, "Opcode %d: Mouse enters courtyard box", op);
_tempVar = 1;
- _vm->_sound->playSound(_courtyardBoxSound);
+ _vm->_sound->playEffect(_courtyardBoxSound);
_vm->redrawArea(var);
}
@@ -2714,7 +2714,7 @@ void Myst::clockWheelStartTurn(uint16 wheel) {
uint16 soundId = resource->getList1(0);
if (soundId)
- _vm->_sound->replaceSoundMyst(soundId);
+ _vm->_sound->playEffect(soundId);
// Turn wheel one step
if (wheel == 1)
@@ -2775,9 +2775,9 @@ void Myst::libraryCombinationBookTurnLeft() {
_vm->_gfx->copyImageToScreen(_libraryBookBaseImage + _libraryBookPage, rect);
if (_vm->_rnd->getRandomBit())
- _vm->_sound->replaceSoundMyst(_libraryBookSound1);
+ _vm->_sound->playEffect(_libraryBookSound1);
else
- _vm->_sound->replaceSoundMyst(_libraryBookSound2);
+ _vm->_sound->playEffect(_libraryBookSound2);
}
}
@@ -2799,9 +2799,9 @@ void Myst::libraryCombinationBookTurnRight() {
_vm->_gfx->copyImageToScreen(_libraryBookBaseImage + _libraryBookPage, rect);
if (_vm->_rnd->getRandomBit())
- _vm->_sound->replaceSoundMyst(_libraryBookSound1);
+ _vm->_sound->playEffect(_libraryBookSound1);
else
- _vm->_sound->replaceSoundMyst(_libraryBookSound2);
+ _vm->_sound->playEffect(_libraryBookSound2);
}
}
@@ -2834,7 +2834,7 @@ void Myst::o_observatoryChangeSettingStop(uint16 op, uint16 var, uint16 argc, ui
_vm->redrawResource(_observatoryCurrentSlider);
_observatoryCurrentSlider = nullptr;
}
- _vm->_sound->resumeBackgroundMyst();
+ _vm->_sound->resumeBackground();
}
void Myst::o_dockVaultForceClose(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
@@ -2850,12 +2850,12 @@ void Myst::o_dockVaultForceClose(uint16 op, uint16 var, uint16 argc, uint16 *arg
if (_dockVaultState) {
// Open switch
_state.dockMarkerSwitch = 1;
- _vm->_sound->replaceSoundMyst(4143);
+ _vm->_sound->playEffect(4143);
_vm->redrawArea(4);
// Close vault
_dockVaultState = 0;
- _vm->_sound->replaceSoundMyst(soundId);
+ _vm->_sound->playEffect(soundId);
_vm->redrawArea(41, false);
animatedUpdate(directionalUpdateDataSize, &argv[3], delay);
}
@@ -2885,7 +2885,7 @@ void Myst::o_clockLeverMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
if (lever->pullLeverV()) {
// Start videos for first step
if (_clockWeightPosition < 2214) {
- _vm->_sound->replaceSoundMyst(5113);
+ _vm->_sound->playEffect(5113);
clockGearForwardOneStep(1);
// Left lever
@@ -2947,7 +2947,7 @@ void Myst::clockWeightDownOneStep() {
void Myst::clockGears_run() {
if (!_vm->_video->isVideoPlaying() && _clockWeightPosition < 2214) {
_clockMiddleGearMovedAlone = true;
- _vm->_sound->replaceSoundMyst(5113);
+ _vm->_sound->playEffect(5113);
clockGearForwardOneStep(1);
clockWeightDownOneStep();
}
@@ -2968,7 +2968,7 @@ void Myst::o_clockLeverEndMove(uint16 op, uint16 var, uint16 argc, uint16 *argv)
}
if (_clockMiddleGearMovedAlone)
- _vm->_sound->replaceSoundMyst(8113);
+ _vm->_sound->playEffect(8113);
// Release lever
MystVideoInfo *lever = getInvokingResource<MystVideoInfo>();
@@ -2987,7 +2987,7 @@ void Myst::clockGearsCheckSolution() {
&& !_state.gearsOpen) {
// Make weight go down
- _vm->_sound->replaceSoundMyst(9113);
+ _vm->_sound->playEffect(9113);
_clockWeightVideo = _vm->_video->playMovie(_vm->wrapMovieFilename("cl1wlfch", kMystStack));
if (!_clockWeightVideo)
error("Failed to open cl1wlfch movie");
@@ -2999,16 +2999,16 @@ void Myst::clockGearsCheckSolution() {
_vm->waitUntilMovieEnds(_clockWeightVideo);
_clockWeightPosition = 2214;
- _vm->_sound->replaceSoundMyst(6113);
+ _vm->_sound->playEffect(6113);
_vm->wait(1000);
- _vm->_sound->replaceSoundMyst(7113);
+ _vm->_sound->playEffect(7113);
// Gear opening video
_vm->playMovieBlocking(_vm->wrapMovieFilename("cl1wggat", kMystStack), 195, 225);
_state.gearsOpen = 1;
_vm->redrawArea(40);
- _vm->_sound->replaceBackgroundMyst(4113, 16384);
+ _vm->_sound->playBackground(4113, 16384);
}
}
@@ -3035,8 +3035,8 @@ void Myst::clockReset() {
_vm->_cursor->hideCursor();
- _vm->_sound->stopBackgroundMyst();
- _vm->_sound->replaceSoundMyst(5113);
+ _vm->_sound->stopBackground();
+ _vm->_sound->playEffect(5113);
// Play reset videos
clockResetWeight();
@@ -3051,13 +3051,13 @@ void Myst::clockReset() {
_vm->waitUntilMovieEnds(handle);
}
- _vm->_sound->replaceSoundMyst(10113);
+ _vm->_sound->playEffect(10113);
// Close gear
if (_state.gearsOpen) {
- _vm->_sound->replaceSoundMyst(6113);
+ _vm->_sound->playEffect(6113);
_vm->wait(1000);
- _vm->_sound->replaceSoundMyst(7113);
+ _vm->_sound->playEffect(7113);
// Gear closing movie
VideoEntryPtr handle = _vm->_video->playMovie(_vm->wrapMovieFilename("cl1wggat", kMystStack));
@@ -3078,7 +3078,7 @@ void Myst::clockReset() {
}
void Myst::clockResetWeight() {
- _vm->_sound->replaceSoundMyst(9113);
+ _vm->_sound->playEffect(9113);
_clockWeightVideo = _vm->_video->playMovie(_vm->wrapMovieFilename("cl1wlfch", kMystStack));
if (!_clockWeightVideo)
@@ -3145,7 +3145,7 @@ void Myst::o_courtyardBox_init(uint16 op, uint16 var, uint16 argc, uint16 *argv)
void Myst::towerRotationMap_run() {
if (!_towerRotationMapInitialized) {
_towerRotationMapInitialized = true;
- _vm->_sound->replaceSoundMyst(4378);
+ _vm->_sound->playEffect(4378);
towerRotationDrawBuildings();
@@ -3159,7 +3159,7 @@ void Myst::towerRotationMap_run() {
towerRotationMapRotate();
_startTime = time + 100;
} else if (_towerRotationBlinkLabel
- && _vm->_sound->isPlaying(6378)) {
+ && _vm->_sound->isEffectPlaying()) {
// Blink tower rotation label while sound is playing
_towerRotationBlinkLabelCount = (_towerRotationBlinkLabelCount + 1) % 14;
@@ -3350,19 +3350,19 @@ void Myst::libraryBookcaseTransform_run(void) {
_vm->_cursor->hideCursor();
// Play transform sound and video
- _vm->_sound->replaceSoundMyst(_libraryBookcaseSoundId);
+ _vm->_sound->playEffect(_libraryBookcaseSoundId);
_libraryBookcaseMovie->playMovie();
if (_state.libraryBookcaseDoor) {
_vm->_gfx->copyImageSectionToBackBuffer(11179, Common::Rect(0, 0, 106, 81), Common::Rect(0, 72, 106, 153));
_vm->_gfx->runTransition(kTransitionBottomToTop, Common::Rect(0, 72, 106, 153), 5, 10);
_vm->playSoundBlocking(7348);
- _vm->_sound->replaceBackgroundMyst(4348, 16384);
+ _vm->_sound->playBackground(4348, 16384);
} else {
_vm->_gfx->copyImageSectionToBackBuffer(11178, Common::Rect(0, 0, 107, 67), Common::Rect(437, 84, 544, 151));
_vm->_gfx->copyBackBufferToScreen(Common::Rect(437, 84, 544, 151));
_vm->playSoundBlocking(7348);
- _vm->_sound->replaceBackgroundMyst(4334, 16384);
+ _vm->_sound->playBackground(4334, 16384);
}
_vm->_cursor->showCursor();
@@ -3529,33 +3529,33 @@ void Myst::observatory_run() {
// Make sliders "initialize"
if (observatoryIsDDMMYYYY2400()) {
- _vm->_sound->replaceSoundMyst(8500);
+ _vm->_sound->playEffect(8500);
_observatoryDaySlider->drawConditionalDataToScreen(2);
_vm->wait(200);
_vm->redrawResource(_observatoryDaySlider);
- _vm->_sound->replaceSoundMyst(8500);
+ _vm->_sound->playEffect(8500);
_observatoryMonthSlider->drawConditionalDataToScreen(2);
_vm->wait(200);
_vm->redrawResource(_observatoryMonthSlider);
} else {
- _vm->_sound->replaceSoundMyst(8500);
+ _vm->_sound->playEffect(8500);
_observatoryMonthSlider->drawConditionalDataToScreen(2);
_vm->wait(200);
_vm->redrawResource(_observatoryMonthSlider);
- _vm->_sound->replaceSoundMyst(8500);
+ _vm->_sound->playEffect(8500);
_observatoryDaySlider->drawConditionalDataToScreen(2);
_vm->wait(200);
_vm->redrawResource(_observatoryDaySlider);
}
- _vm->_sound->replaceSoundMyst(8500);
+ _vm->_sound->playEffect(8500);
_observatoryYearSlider->drawConditionalDataToScreen(2);
_vm->wait(200);
_vm->redrawResource(_observatoryYearSlider);
- _vm->_sound->replaceSoundMyst(8500);
+ _vm->_sound->playEffect(8500);
_observatoryTimeSlider->drawConditionalDataToScreen(2);
_vm->wait(200);
_vm->redrawResource(_observatoryTimeSlider);
@@ -3747,8 +3747,8 @@ void Myst::greenBook_run() {
}
if (_tempVar == 1) {
- _vm->_sound->stopSound();
- _vm->_sound->pauseBackgroundMyst();
+ _vm->_sound->stopEffect();
+ _vm->_sound->pauseBackground();
VideoEntryPtr book = _vm->_video->playMovie(file);
if (!book)
diff --git a/engines/mohawk/myst_stacks/preview.cpp b/engines/mohawk/myst_stacks/preview.cpp
index aa36ef7743..3a2524d59a 100644
--- a/engines/mohawk/myst_stacks/preview.cpp
+++ b/engines/mohawk/myst_stacks/preview.cpp
@@ -87,9 +87,7 @@ void Preview::o_fadeToBlack(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
void Preview::o_fadeFromBlack(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
debugC(kDebugScript, "Opcode %d: Fade from black", op);
- // FIXME: This glitches when enabled. The backbuffer is drawn to screen,
- // and then the fading occurs, causing the background to appear for one frame.
- // _vm->_gfx->fadeFromBlack();
+ _vm->_gfx->fadeFromBlack();
}
void Preview::o_stayHere(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
@@ -103,18 +101,18 @@ void Preview::o_stayHere(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
void Preview::o_speechStop(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
debugC(kDebugScript, "Opcode %d: Speech stop", op);
- _vm->_sound->stopSound(3001);
+ _vm->_sound->stopSpeech();
_speechRunning = false;
_globals.currentAge = 2;
}
void Preview::speechUpdateCue() {
// This is a callback in the original, handling audio events.
- if (!_vm->_sound->isPlaying(3001)) {
+ if (!_vm->_sound->isSpeechPlaying()) {
return;
}
- uint samples = _vm->_sound->getNumSamplesPlayed(3001);
+ uint samples = _vm->_sound->getSpeechNumSamplesPlayed();
for (int16 i = 0; i < _cueList.pointCount; i++) {
if (_cueList.points[i].sampleFrame > samples)
return;
@@ -134,7 +132,7 @@ void Preview::speech_run() {
switch (_speechStep) {
case 0: // Start Voice Over... which controls book opening
_currentCue = 0;
- _vm->_sound->playSound(3001, Audio::Mixer::kMaxChannelVolume, false, &_cueList);
+ _vm->_sound->playSpeech(3001, &_cueList);
_speechStep++;
break;
diff --git a/engines/mohawk/myst_stacks/preview.h b/engines/mohawk/myst_stacks/preview.h
index 9d833b35e2..7a818a182c 100644
--- a/engines/mohawk/myst_stacks/preview.h
+++ b/engines/mohawk/myst_stacks/preview.h
@@ -23,9 +23,11 @@
#ifndef MYST_SCRIPTS_PREVIEW_H
#define MYST_SCRIPTS_PREVIEW_H
+#include "mohawk/sound.h"
+#include "mohawk/myst_stacks/myst.h"
+
#include "common/scummsys.h"
#include "common/util.h"
-#include "mohawk/myst_stacks/myst.h"
namespace Mohawk {
diff --git a/engines/mohawk/myst_stacks/selenitic.cpp b/engines/mohawk/myst_stacks/selenitic.cpp
index 47e7a56d27..774efcd0b7 100644
--- a/engines/mohawk/myst_stacks/selenitic.cpp
+++ b/engines/mohawk/myst_stacks/selenitic.cpp
@@ -561,7 +561,7 @@ void Selenitic::mazeRunnerPlaySoundHelp() {
soundId = 2191;
if (soundId)
- _vm->_sound->replaceSoundMyst(soundId);
+ _vm->_sound->playEffect(soundId);
_mazeRunnerLight->drawConditionalDataToScreen(0);
}
@@ -603,17 +603,17 @@ void Selenitic::o_soundReceiverSigma(uint16 op, uint16 var, uint16 argc, uint16
}
_soundReceiverPosition = &_state.soundReceiverPositions[source];
- _vm->_sound->stopBackgroundMyst();
- _vm->_sound->replaceSoundMyst(2287);
+ _vm->_sound->stopBackground();
+ _vm->_sound->playEffect(2287);
soundReceiverDrawView();
uint16 soundId = soundReceiverCurrentSound(source, *_soundReceiverPosition);
- _vm->_sound->replaceBackgroundMyst(soundId);
+ _vm->_sound->playBackground(soundId);
_vm->wait(1000);
}
_soundReceiverPosition = oldPosition;
_soundReceiverSigmaPressed = true;
- _vm->_sound->stopBackgroundMyst();
+ _vm->_sound->stopBackground();
_soundReceiverSources[_state.soundReceiverCurrentSource]->drawConditionalDataToScreen(1);
@@ -652,7 +652,7 @@ void Selenitic::soundReceiverLeftRight(uint direction) {
else
_soundReceiverLeftButton->drawConditionalDataToScreen(1);
- _vm->_sound->stopSound();
+ _vm->_sound->stopEffect();
_soundReceiverDirection = direction;
_soundReceiverSpeed = 1;
@@ -717,11 +717,11 @@ void Selenitic::o_soundReceiverSource(uint16 op, uint16 var, uint16 argc, uint16
_soundReceiverPosition = &_state.soundReceiverPositions[pressedButton];
_soundReceiverCurrentSource = _soundReceiverSources[pressedButton];
- _vm->_sound->stopSound();
+ _vm->_sound->stopEffect();
uint16 soundId = argv[0];
- _vm->_sound->stopBackgroundMyst();
- _vm->_sound->replaceSoundMyst(soundId);
+ _vm->_sound->stopBackground();
+ _vm->_sound->playEffect(soundId);
_soundReceiverCurrentSource->drawConditionalDataToScreen(1);
@@ -738,11 +738,11 @@ void Selenitic::o_mazeRunnerDoorButton(uint16 op, uint16 var, uint16 argc, uint1
if (_mazeRunnerPosition == 288) {
_vm->changeToCard(cardIdEntry, kNoTransition);
- _vm->_sound->replaceSoundMyst(cardIdEntry);
+ _vm->_sound->playEffect(cardIdEntry);
animatedUpdate(argv[2], &argv[3], 10);
} else if (_mazeRunnerPosition == 289) {
_vm->changeToCard(cardIdExit, kNoTransition);
- _vm->_sound->replaceSoundMyst(cardIdExit);
+ _vm->_sound->playEffect(cardIdExit);
animatedUpdate(argv[2], &argv[3], 10);
}
}
@@ -803,7 +803,7 @@ void Selenitic::o_soundLockMove(uint16 op, uint16 var, uint16 argc, uint16 *argv
uint16 soundId = soundLockCurrentSound(slider->_pos.y, true);
if (_soundLockSoundId != soundId) {
_soundLockSoundId = soundId;
- _vm->_sound->replaceSoundMyst(soundId, Audio::Mixer::kMaxChannelVolume, true);
+ _vm->_sound->playEffect(soundId, true);
}
}
@@ -813,10 +813,10 @@ void Selenitic::o_soundLockStartMove(uint16 op, uint16 var, uint16 argc, uint16
MystAreaSlider *slider = soundLockSliderFromVar(var);
_vm->_cursor->setCursor(700);
- _vm->_sound->pauseBackgroundMyst();
+ _vm->_sound->pauseBackground();
_soundLockSoundId = soundLockCurrentSound(slider->_pos.y, true);
- _vm->_sound->replaceSoundMyst(_soundLockSoundId, Audio::Mixer::kMaxChannelVolume, true);
+ _vm->_sound->playEffect(_soundLockSoundId, true);
}
void Selenitic::o_soundLockEndMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
@@ -861,21 +861,21 @@ void Selenitic::o_soundLockEndMove(uint16 op, uint16 var, uint16 argc, uint16 *a
uint16 soundId = slider->getList3(0);
if (soundId)
- _vm->_sound->replaceSoundMyst(soundId);
+ _vm->_sound->playEffect(soundId);
- _vm->_sound->resumeBackgroundMyst();
+ _vm->_sound->resumeBackground();
}
void Selenitic::soundLockCheckSolution(MystAreaSlider *slider, uint16 value, uint16 solution, bool &solved) {
slider->drawConditionalDataToScreen(2);
- _vm->_sound->replaceSoundMyst(soundLockCurrentSound(value / 12, false));
+ _vm->_sound->playEffect(soundLockCurrentSound(value / 12, false));
_vm->wait(1500);
if (value / 12 != solution)
solved = false;
slider->drawConditionalDataToScreen(1);
- _vm->_sound->stopSound();
+ _vm->_sound->stopEffect();
}
void Selenitic::o_soundLockButton(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
@@ -883,8 +883,8 @@ void Selenitic::o_soundLockButton(uint16 op, uint16 var, uint16 argc, uint16 *ar
bool solved = true;
- _vm->_sound->pauseBackgroundMyst();
- _vm->_sound->replaceSoundMyst(1147);
+ _vm->_sound->pauseBackground();
+ _vm->_sound->playEffect(1147);
_soundLockButton->drawConditionalDataToScreen(1);
_vm->_cursor->hideCursor();
@@ -894,8 +894,8 @@ void Selenitic::o_soundLockButton(uint16 op, uint16 var, uint16 argc, uint16 *ar
soundLockCheckSolution(_soundLockSlider4, _state.soundLockSliderPositions[3], 6, solved);
soundLockCheckSolution(_soundLockSlider5, _state.soundLockSliderPositions[4], 7, solved);
- _vm->_sound->replaceSoundMyst(1148);
- _vm->_sound->resumeBackgroundMyst();
+ _vm->_sound->playEffect(1148);
+ _vm->_sound->resumeBackground();
if (solved) {
_soundLockButton->drawConditionalDataToScreen(2);
@@ -906,7 +906,7 @@ void Selenitic::o_soundLockButton(uint16 op, uint16 var, uint16 argc, uint16 *ar
_vm->changeToCard(cardIdClosed, kTransitionDissolve);
_vm->changeToCard(cardIdOpen, kNoTransition);
- _vm->_sound->replaceSoundMyst(argv[2]);
+ _vm->_sound->playEffect(argv[2]);
animatedUpdate(argv[4], &argv[5], argv[3]);
} else {
@@ -982,7 +982,7 @@ void Selenitic::soundReceiverIncreaseSpeed() {
void Selenitic::soundReceiverUpdateSound() {
uint16 soundId = soundReceiverCurrentSound(_state.soundReceiverCurrentSource, *_soundReceiverPosition);
- _vm->_sound->replaceBackgroundMyst(soundId);
+ _vm->_sound->playBackground(soundId);
}
uint16 Selenitic::soundReceiverCurrentSound(uint16 source, uint16 position) {
diff --git a/engines/mohawk/myst_stacks/stoneship.cpp b/engines/mohawk/myst_stacks/stoneship.cpp
index 2062bb99ac..706bd72163 100644
--- a/engines/mohawk/myst_stacks/stoneship.cpp
+++ b/engines/mohawk/myst_stacks/stoneship.cpp
@@ -494,7 +494,7 @@ void Stoneship::o_generatorStart(uint16 op, uint16 var, uint16 argc, uint16 *arg
uint16 soundId = handle->getList1(0);
if (soundId)
- _vm->_sound->replaceSoundMyst(soundId);
+ _vm->_sound->playEffect(soundId);
if (_state.generatorDuration)
_state.generatorDuration -= _vm->_system->getMillis() - _state.generatorDepletionTime;
@@ -510,7 +510,7 @@ void Stoneship::o_generatorStart(uint16 op, uint16 var, uint16 argc, uint16 *arg
soundId = handle->getList2(0);
if (soundId)
- _vm->_sound->replaceSoundMyst(soundId, Audio::Mixer::kMaxChannelVolume, true);
+ _vm->_sound->playEffect(soundId, true);
}
void Stoneship::o_generatorStop(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
@@ -537,7 +537,7 @@ void Stoneship::o_generatorStop(uint16 op, uint16 var, uint16 argc, uint16 *argv
uint16 soundId = handle->getList3(0);
if (soundId)
- _vm->_sound->replaceSoundMyst(soundId);
+ _vm->_sound->playEffect(soundId);
}
void Stoneship::chargeBattery_run() {
@@ -674,7 +674,7 @@ void Stoneship::o_chestValveVideos(uint16 op, uint16 var, uint16 argc, uint16 *a
Common::String movie = _vm->wrapMovieFilename("ligspig", kStoneshipStack);
- _vm->_sound->playSound(2132);
+ _vm->_sound->playEffect(2132);
if (_state.chestValveState) {
// Valve closing
@@ -695,7 +695,7 @@ void Stoneship::o_chestValveVideos(uint16 op, uint16 var, uint16 argc, uint16 *a
valve->setBounds(Audio::Timestamp(0, 350, 600), Audio::Timestamp(0, 650, 600));
_vm->waitUntilMovieEnds(valve);
- _vm->_sound->playSound(3132);
+ _vm->_sound->playEffect(3132);
for (uint i = 0; i < 25; i++) {
valve = _vm->_video->playMovie(movie);
@@ -707,7 +707,7 @@ void Stoneship::o_chestValveVideos(uint16 op, uint16 var, uint16 argc, uint16 *a
_vm->waitUntilMovieEnds(valve);
}
- _vm->_sound->resumeBackgroundMyst();
+ _vm->_sound->resumeBackground();
} else {
// Valve opening
VideoEntryPtr valve = _vm->_video->playMovie(movie);
@@ -745,7 +745,7 @@ void Stoneship::o_trapLockOpen(uint16 op, uint16 var, uint16 argc, uint16 *argv)
lock->setBounds(Audio::Timestamp(0, 0, 600), Audio::Timestamp(0, 750, 600));
_vm->waitUntilMovieEnds(lock);
- _vm->_sound->playSound(2143);
+ _vm->_sound->playEffect(2143);
lock = _vm->_video->playMovie(movie);
if (!lock)
@@ -756,7 +756,7 @@ void Stoneship::o_trapLockOpen(uint16 op, uint16 var, uint16 argc, uint16 *argv)
_vm->waitUntilMovieEnds(lock);
if (_state.pumpState != 4)
- _vm->_sound->playSound(4143);
+ _vm->_sound->playEffect(4143);
}
void Stoneship::o_sideDoorsMovies(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
@@ -767,7 +767,7 @@ void Stoneship::o_sideDoorsMovies(uint16 op, uint16 var, uint16 argc, uint16 *ar
debugC(kDebugScript, "\tmovieId: %d", movieId);
_vm->_cursor->hideCursor();
- _vm->_sound->pauseBackgroundMyst();
+ _vm->_sound->pauseBackground();
switch (movieId) {
case 0:
@@ -791,14 +791,14 @@ void Stoneship::o_sideDoorsMovies(uint16 op, uint16 var, uint16 argc, uint16 *ar
break;
}
- _vm->_sound->resumeBackgroundMyst();
+ _vm->_sound->resumeBackground();
_vm->_cursor->showCursor();
}
void Stoneship::o_cloudOrbEnter(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
debugC(kDebugScript, "Opcode %d: Cloud orb enter", op);
- _vm->_sound->replaceSoundMyst(_cloudOrbSound, Audio::Mixer::kMaxChannelVolume, true);
+ _vm->_sound->playEffect(_cloudOrbSound, true);
_cloudOrbMovie->playMovie();
}
@@ -806,7 +806,7 @@ void Stoneship::o_cloudOrbLeave(uint16 op, uint16 var, uint16 argc, uint16 *argv
debugC(kDebugScript, "Opcode %d: Cloud orb leave", op);
_cloudOrbMovie->pauseMovie(true);
- _vm->_sound->replaceSoundMyst(_cloudOrbStopSound);
+ _vm->_sound->playEffect(_cloudOrbStopSound);
_vm->_gfx->runTransition(kTransitionTopToBottom, getInvokingResource<MystArea>()->getRect(), 4, 0);
}
@@ -920,7 +920,7 @@ void Stoneship::tunnel_run() {
_vm->_gfx->copyImageToScreen(_tunnelImages[1], Common::Rect(544, 333));
}
- _vm->_sound->replaceSoundMyst(_tunnelAlarmSound);
+ _vm->_sound->playEffect(_tunnelAlarmSound);
// Draw tunnel dark
if (_tunnelImagesCount) {