From 46551fd4b53fc8bf4bbdd3a59aeed56f6f9b53e5 Mon Sep 17 00:00:00 2001 From: Colin Snover Date: Fri, 18 Mar 2016 22:55:56 -0500 Subject: SCI32: Rewrite digital audio engine This provides a complete implementation of kDoAudio through SCI2.1mid, plus partial implementation of SCI3 features. Digital audio calls shunted through kDoSound have also been updated to go through the SCI32 audio mixer, though these shunts are a bit hacky because the ScummVM implementation of kDoSound does not currently match how SSCI kDoSound is designed. It is probably possible in the future to just replace the SCI1.1 audio code (audio.cpp) with the new SCI32 code, since the major differences seem to be that (1) SCI1.1 only supported one digital audio playback channel (this is configurable already), (2) it had extra commands for CD audio playback and queued sample playback. --- engines/sci/sci.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'engines/sci/sci.cpp') diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp index 8c23d322e7..6244c43764 100644 --- a/engines/sci/sci.cpp +++ b/engines/sci/sci.cpp @@ -68,6 +68,7 @@ #include "sci/graphics/palette32.h" #include "sci/graphics/text32.h" #include "sci/graphics/frameout.h" +#include "sci/sound/audio32.h" #include "sci/video/robot_decoder.h" #endif @@ -88,6 +89,9 @@ SciEngine::SciEngine(OSystem *syst, const ADGameDescription *desc, SciGameId gam _audio = 0; _sync = nullptr; +#ifdef ENABLE_SCI32 + _audio32 = nullptr; +#endif _features = 0; _resMan = 0; _gamestate = 0; @@ -167,6 +171,7 @@ SciEngine::~SciEngine() { delete _robotDecoder; delete _gfxFrameout; delete _gfxRemap32; + delete _audio32; #endif delete _gfxMenu; delete _gfxControls16; @@ -269,7 +274,13 @@ Common::Error SciEngine::run() { // Also, XMAS1990 apparently had a parser too. Refer to http://forums.scummvm.org/viewtopic.php?t=9135 if (getGameId() == GID_CHRISTMAS1990) _vocabulary = new Vocabulary(_resMan, false); - _audio = new AudioPlayer(_resMan); + +#ifdef ENABLE_SCI32 + if (getSciVersion() >= SCI_VERSION_2_1_EARLY) { + _audio32 = new Audio32(_resMan); + } else +#endif + _audio = new AudioPlayer(_resMan); _sync = new Sync(_resMan, segMan); _gamestate = new EngineState(segMan); _eventMan = new EventManager(_resMan->detectFontExtended()); @@ -805,7 +816,9 @@ void SciEngine::runGame() { void SciEngine::exitGame() { if (_gamestate->abortScriptProcessing != kAbortLoadGame) { _gamestate->_executionStack.clear(); - _audio->stopAllAudio(); + if (_audio) { + _audio->stopAllAudio(); + } _sync->stop(); _soundCmd->clearPlayList(); } -- cgit v1.2.3