From c0e11a431dd5c4a82ab754c3f94bb95ee46de792 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Tue, 29 Sep 2015 01:11:17 -0400 Subject: SCI: Ensure openCD() is called --- engines/sci/sound/audio.cpp | 9 ++++++++- engines/sci/sound/audio.h | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'engines/sci/sound') diff --git a/engines/sci/sound/audio.cpp b/engines/sci/sound/audio.cpp index 57f0415285..5e5e8b0466 100644 --- a/engines/sci/sound/audio.cpp +++ b/engines/sci/sound/audio.cpp @@ -28,6 +28,7 @@ #include "backends/audiocd/audiocd.h" +#include "common/config-manager.h" #include "common/file.h" #include "common/memstream.h" #include "common/system.h" @@ -44,7 +45,7 @@ namespace Sci { AudioPlayer::AudioPlayer(ResourceManager *resMan) : _resMan(resMan), _audioRate(11025), - _syncResource(NULL), _syncOffset(0), _audioCdStart(0) { + _syncResource(NULL), _syncOffset(0), _audioCdStart(0), _initCD(false) { _mixer = g_system->getMixer(); _wPlayFlag = false; @@ -511,6 +512,12 @@ void AudioPlayer::stopSoundSync() { } int AudioPlayer::audioCdPlay(int track, int start, int duration) { + if (!_initCD) { + // Initialize CD mode if we haven't already + g_system->getAudioCDManager()->openCD(); + _initCD = true; + } + if (getSciVersion() == SCI_VERSION_1_1) { // King's Quest VI CD Audio format _audioCdStart = g_system->getMillis(); diff --git a/engines/sci/sound/audio.h b/engines/sci/sound/audio.h index 9e65d6e0c8..4a8b26567d 100644 --- a/engines/sci/sound/audio.h +++ b/engines/sci/sound/audio.h @@ -97,6 +97,7 @@ private: uint _syncOffset; uint32 _audioCdStart; bool _wPlayFlag; + bool _initCD; }; } // End of namespace Sci -- cgit v1.2.3