aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/sound/soundcmd.h
diff options
context:
space:
mode:
authorColin Snover2017-01-26 13:18:41 -0600
committerColin Snover2017-04-21 19:00:27 -0500
commit3303a881397beff1753fba237a5da735de03edb5 (patch)
tree8c3a682ee12840bfeaa9cb8e80967440d2aad26e /engines/sci/sound/soundcmd.h
parentc2e9fee93264468d89de66eccdc0cc712cdb76fe (diff)
downloadscummvm-rg350-3303a881397beff1753fba237a5da735de03edb5.tar.gz
scummvm-rg350-3303a881397beff1753fba237a5da735de03edb5.tar.bz2
scummvm-rg350-3303a881397beff1753fba237a5da735de03edb5.zip
SCI: Improve audio volume & settings sync code
This patch includes enhancements to the ScummVM integration with SCI engine, with particular focus on SCI32 support. 1. Fixes audio volumes syncing erroneously to ScummVM in games that modify the audio volume without user action (e.g. SCI1.1 talkies that reduce music volume during speech playback). Now, volumes will only be synchronised when the user interacts with the game's audio settings. This mechanism works by looking for a known volume control object in the stack, and only syncing when the control object is present. (Ports and planes were researched and found unreliable.) 2. Fixes audio syncing in SCI32 games that do not set game volumes through kDoSoundMasterVolume/kDoAudioVolume, like GK1, GK2, Phant1, and Torin. 3. Fixes speech/subtitles syncing in SCI32 games that do not use global 90, like LSL6hires. 4. Fixes in-game volume controls in SCI32 games reflecting outdated audio volumes when a change is made during the game from the ScummVM launcher. 5. Fixes SCI32 games that would restore volumes from save games or reset volumes on startup, which caused game volumes to be out-of-sync with ScummVM when started. 6. ScummVM integration code for audio sync has been abstracted into a new GuestAdditions class. This keeps the ScummVM- specific code all in one place, with only small hooks into the engine code. ScummVM integrated save/load code should probably also go here in the future. Fixes Trac#9700.
Diffstat (limited to 'engines/sci/sound/soundcmd.h')
-rw-r--r--engines/sci/sound/soundcmd.h51
1 files changed, 27 insertions, 24 deletions
diff --git a/engines/sci/sound/soundcmd.h b/engines/sci/sound/soundcmd.h
index 5bb7cf2cb1..928c9b1acb 100644
--- a/engines/sci/sound/soundcmd.h
+++ b/engines/sci/sound/soundcmd.h
@@ -46,7 +46,7 @@ public:
SoundCommandParser(ResourceManager *resMan, SegManager *segMan, Kernel *kernel, AudioPlayer *audio, SciVersion soundVersion);
~SoundCommandParser();
- //reg_t parseCommand(int argc, reg_t *argv, reg_t acc);
+ //reg_t parseCommand(EngineState *s, int argc, reg_t *argv);
// Functions used for game state loading
void clearPlayList();
@@ -56,6 +56,9 @@ public:
// Functions used for the ScummVM menus
void setMasterVolume(int vol);
void pauseAll(bool pause);
+#ifdef ENABLE_SCI32
+ void setVolume(const reg_t obj, const int vol);
+#endif
// Debug console functions
void startNewSound(int number);
@@ -78,29 +81,29 @@ public:
*/
void updateSci0Cues();
- reg_t kDoSoundInit(int argc, reg_t *argv, reg_t acc);
- reg_t kDoSoundPlay(int argc, reg_t *argv, reg_t acc);
- reg_t kDoSoundRestore(int argc, reg_t *argv, reg_t acc);
- reg_t kDoSoundMute(int argc, reg_t *argv, reg_t acc);
- reg_t kDoSoundPause(int argc, reg_t *argv, reg_t acc);
- reg_t kDoSoundResumeAfterRestore(int argc, reg_t *argv, reg_t acc);
- reg_t kDoSoundStop(int argc, reg_t *argv, reg_t acc);
- reg_t kDoSoundStopAll(int argc, reg_t *argv, reg_t acc);
- reg_t kDoSoundDispose(int argc, reg_t *argv, reg_t acc);
- reg_t kDoSoundMasterVolume(int argc, reg_t *argv, reg_t acc);
- reg_t kDoSoundFade(int argc, reg_t *argv, reg_t acc);
- reg_t kDoSoundGetPolyphony(int argc, reg_t *argv, reg_t acc);
- reg_t kDoSoundUpdate(int argc, reg_t *argv, reg_t acc);
- reg_t kDoSoundUpdateCues(int argc, reg_t *argv, reg_t acc);
- reg_t kDoSoundSendMidi(int argc, reg_t *argv, reg_t acc);
- reg_t kDoSoundGlobalReverb(int argc, reg_t *argv, reg_t acc);
- reg_t kDoSoundSetHold(int argc, reg_t *argv, reg_t acc);
- reg_t kDoSoundDummy(int argc, reg_t *argv, reg_t acc);
- reg_t kDoSoundGetAudioCapability(int argc, reg_t *argv, reg_t acc);
- reg_t kDoSoundSetVolume(int argc, reg_t *argv, reg_t acc);
- reg_t kDoSoundSetPriority(int argc, reg_t *argv, reg_t acc);
- reg_t kDoSoundSetLoop(int argc, reg_t *argv, reg_t acc);
- reg_t kDoSoundSuspend(int argc, reg_t *argv, reg_t acc);
+ reg_t kDoSoundInit(EngineState *s, int argc, reg_t *argv);
+ reg_t kDoSoundPlay(EngineState *s, int argc, reg_t *argv);
+ reg_t kDoSoundRestore(EngineState *s, int argc, reg_t *argv);
+ reg_t kDoSoundMute(EngineState *s, int argc, reg_t *argv);
+ reg_t kDoSoundPause(EngineState *s, int argc, reg_t *argv);
+ reg_t kDoSoundResumeAfterRestore(EngineState *s, int argc, reg_t *argv);
+ reg_t kDoSoundStop(EngineState *s, int argc, reg_t *argv);
+ reg_t kDoSoundStopAll(EngineState *s, int argc, reg_t *argv);
+ reg_t kDoSoundDispose(EngineState *s, int argc, reg_t *argv);
+ reg_t kDoSoundMasterVolume(EngineState *s, int argc, reg_t *argv);
+ reg_t kDoSoundFade(EngineState *s, int argc, reg_t *argv);
+ reg_t kDoSoundGetPolyphony(EngineState *s, int argc, reg_t *argv);
+ reg_t kDoSoundUpdate(EngineState *s, int argc, reg_t *argv);
+ reg_t kDoSoundUpdateCues(EngineState *s, int argc, reg_t *argv);
+ reg_t kDoSoundSendMidi(EngineState *s, int argc, reg_t *argv);
+ reg_t kDoSoundGlobalReverb(EngineState *s, int argc, reg_t *argv);
+ reg_t kDoSoundSetHold(EngineState *s, int argc, reg_t *argv);
+ reg_t kDoSoundDummy(EngineState *s, int argc, reg_t *argv);
+ reg_t kDoSoundGetAudioCapability(EngineState *s, int argc, reg_t *argv);
+ reg_t kDoSoundSetVolume(EngineState *s, int argc, reg_t *argv);
+ reg_t kDoSoundSetPriority(EngineState *s, int argc, reg_t *argv);
+ reg_t kDoSoundSetLoop(EngineState *s, int argc, reg_t *argv);
+ reg_t kDoSoundSuspend(EngineState *s, int argc, reg_t *argv);
private:
//typedef Common::Array<MusicEntryCommand *> SoundCommandContainer;