aboutsummaryrefslogtreecommitdiff
path: root/engines/illusions
diff options
context:
space:
mode:
Diffstat (limited to 'engines/illusions')
-rw-r--r--engines/illusions/sound.cpp32
-rw-r--r--engines/illusions/sound.h8
-rw-r--r--engines/illusions/threads/talkthread.cpp4
-rw-r--r--engines/illusions/threads/talkthread_duckman.cpp4
4 files changed, 33 insertions, 15 deletions
diff --git a/engines/illusions/sound.cpp b/engines/illusions/sound.cpp
index 1e8ca49f88..d8b03169ea 100644
--- a/engines/illusions/sound.cpp
+++ b/engines/illusions/sound.cpp
@@ -229,7 +229,7 @@ void MidiPlayer::endOfTrack() {
// VoicePlayer
-VoicePlayer::VoicePlayer() {
+VoicePlayer::VoicePlayer() : _wasPlaying(false), _isPaused(false) {
}
VoicePlayer::~VoicePlayer() {
@@ -267,6 +267,22 @@ void VoicePlayer::stop() {
_voiceName.clear();
}
+void VoicePlayer::pause() {
+ if (!_isPaused) {
+ _isPaused = true;
+ _wasPlaying = isPlaying();
+ g_system->getMixer()->pauseHandle(_soundHandle, true);
+ }
+}
+
+void VoicePlayer::unpause() {
+ if (_isPaused) {
+ _isPaused = false;
+ if (_wasPlaying)
+ g_system->getMixer()->pauseHandle(_soundHandle, false);
+ }
+}
+
bool VoicePlayer::isPlaying() {
return g_system->getMixer()->isSoundHandleActive(_soundHandle);
}
@@ -280,12 +296,6 @@ bool VoicePlayer::isCued() {
return _voiceStatus == 2;
}
-void VoicePlayer::pause(bool paused) {
- if (isPlaying()) {
- g_system->getMixer()->pauseHandle(_soundHandle, paused);
- }
-}
-
// Sound
Sound::Sound(uint32 soundEffectId, uint32 soundGroupId, bool looping)
@@ -394,8 +404,12 @@ void SoundMan::stopVoice() {
_voicePlayer->stop();
}
-void SoundMan::pauseVoice(bool paused) {
- _voicePlayer->pause(paused);
+void SoundMan::pauseVoice() {
+ _voicePlayer->pause();
+}
+
+void SoundMan::unpauseVoice() {
+ _voicePlayer->unpause();
}
bool SoundMan::isVoicePlaying() {
diff --git a/engines/illusions/sound.h b/engines/illusions/sound.h
index 8d5f21eed9..2669102b69 100644
--- a/engines/illusions/sound.h
+++ b/engines/illusions/sound.h
@@ -80,8 +80,9 @@ public:
bool cue(const char *voiceName);
void stopCueing();
void start(int16 volume, int16 pan);
- void pause(bool paused);
void stop();
+ void pause();
+ void unpause();
bool isPlaying();
bool isEnabled();
bool isCued();
@@ -89,6 +90,8 @@ protected:
Audio::SoundHandle _soundHandle;
Common::String _voiceName;
uint _voiceStatus;
+ bool _wasPlaying;
+ bool _isPaused;
};
class Sound {
@@ -134,7 +137,8 @@ public:
void stopCueingVoice();
void startVoice(int16 volume, int16 pan);
void stopVoice();
- void pauseVoice(bool paused);
+ void pauseVoice();
+ void unpauseVoice();
bool isVoicePlaying();
bool isVoiceEnabled();
bool isVoiceCued();
diff --git a/engines/illusions/threads/talkthread.cpp b/engines/illusions/threads/talkthread.cpp
index 7c2e01276e..c7f7a67b0e 100644
--- a/engines/illusions/threads/talkthread.cpp
+++ b/engines/illusions/threads/talkthread.cpp
@@ -282,7 +282,7 @@ void TalkThread::onPause() {
case 6:
case 7:
if (!(_flags & 4)) {
- // TODO audvocPauseVoice();
+ _vm->_soundMan->pauseVoice();
}
if (!(_flags & 8)) {
_textDurationElapsed = getDurationElapsed(_textStartTime, _textEndTime);
@@ -313,7 +313,7 @@ void TalkThread::onUnpause() {
break;
case 6:
if (!(_flags & 4)) {
- // TODO audvocUnpauseVoice();
+ _vm->_soundMan->unpauseVoice();
}
if (!(_flags & 8)) {
_textStartTime = getCurrentTime();
diff --git a/engines/illusions/threads/talkthread_duckman.cpp b/engines/illusions/threads/talkthread_duckman.cpp
index 36911597ff..2b1294c846 100644
--- a/engines/illusions/threads/talkthread_duckman.cpp
+++ b/engines/illusions/threads/talkthread_duckman.cpp
@@ -206,7 +206,7 @@ int TalkThread_Duckman::onUpdate() {
void TalkThread_Duckman::onPause() {
if (_status == 5) {
if (!(_flags & 4)) {
- _vm->_soundMan->pauseVoice(true);
+ _vm->_soundMan->pauseVoice();
}
if (!(_flags & 8))
_textDurationElapsed = getDurationElapsed(_textStartTime, _textEndTime);
@@ -220,7 +220,7 @@ void TalkThread_Duckman::onUnpause() {
_vm->_soundMan->cueVoice((char*)talkEntry->_voiceName);
} else if (_status == 5) {
if (!(_flags & 4)) {
- _vm->_soundMan->pauseVoice(false);
+ _vm->_soundMan->unpauseVoice();
}
if (!(_flags & 8)) {
_textStartTime = getCurrentTime();