diff options
author | Filippos Karapetis | 2009-12-27 14:11:26 +0000 |
---|---|---|
committer | Filippos Karapetis | 2009-12-27 14:11:26 +0000 |
commit | 9f37be314d29189a7709e400b2ded6afd0d1e3fa (patch) | |
tree | 8d86fbe59af0c779d1f989bc2d28c878fa1c132e /engines | |
parent | 69ba1ee04d537c95b5dfc4d57506f7278ebdc94e (diff) | |
download | scummvm-rg350-9f37be314d29189a7709e400b2ded6afd0d1e3fa.tar.gz scummvm-rg350-9f37be314d29189a7709e400b2ded6afd0d1e3fa.tar.bz2 scummvm-rg350-9f37be314d29189a7709e400b2ded6afd0d1e3fa.zip |
SCI/new music code:
- Implemented sound muting
- Now saving/loading the master music volume
svn-id: r46643
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sci/engine/savegame.cpp | 18 | ||||
-rw-r--r-- | engines/sci/engine/savegame.h | 2 | ||||
-rw-r--r-- | engines/sci/sfx/music.cpp | 2 | ||||
-rw-r--r-- | engines/sci/sfx/music.h | 10 | ||||
-rw-r--r-- | engines/sci/sfx/soundcmd.cpp | 19 |
5 files changed, 32 insertions, 19 deletions
diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp index 645d8d203f..7c0b33a6d6 100644 --- a/engines/sci/engine/savegame.cpp +++ b/engines/sci/engine/savegame.cpp @@ -622,6 +622,24 @@ void SciMusic::saveLoadWithSerializer(Common::Serializer &s) { _mutex.lock(); int songcount = 0; + byte masterVolume = soundGetMasterVolume(); + + if (s.isSaving()) { + s.syncAsByte(_soundOn); + s.syncAsByte(masterVolume); + } else if (s.isLoading()) { + if (s.getVersion() >= 15) { + s.syncAsByte(_soundOn); + s.syncAsByte(masterVolume); + } else { + _soundOn = true; + masterVolume = 15; + } + + soundSetSoundOn(_soundOn); + soundSetMasterVolume(masterVolume); + } + if (s.isSaving()) songcount = _playList.size(); s.syncAsUint32LE(songcount); diff --git a/engines/sci/engine/savegame.h b/engines/sci/engine/savegame.h index 8a4d8e7d3b..6f16546dfa 100644 --- a/engines/sci/engine/savegame.h +++ b/engines/sci/engine/savegame.h @@ -36,7 +36,7 @@ namespace Sci { struct EngineState; enum { - CURRENT_SAVEGAME_VERSION = 14, + CURRENT_SAVEGAME_VERSION = 15, MINIMUM_SAVEGAME_VERSION = 9 }; diff --git a/engines/sci/sfx/music.cpp b/engines/sci/sfx/music.cpp index 0b10b810f8..225192d382 100644 --- a/engines/sci/sfx/music.cpp +++ b/engines/sci/sfx/music.cpp @@ -41,7 +41,7 @@ static int f_compare(const void *arg1, const void *arg2) { } SciMusic::SciMusic(SciVersion soundVersion) - : _soundVersion(soundVersion) { + : _soundVersion(soundVersion), _soundOn(true) { // Reserve some space in the playlist, to avoid expensive insertion // operations diff --git a/engines/sci/sfx/music.h b/engines/sci/sfx/music.h index ff2c27e8d3..861ddf69e3 100644 --- a/engines/sci/sfx/music.h +++ b/engines/sci/sfx/music.h @@ -114,10 +114,13 @@ public: void soundSetPriority(MusicEntry *pSnd, byte prio); uint16 soundGetMasterVolume(); void soundSetMasterVolume(uint16 vol); - uint16 soundGetVoices(); - uint32 soundGetTempo() { - return _dwTempo; + uint16 soundGetSoundOn() { return _soundOn; } + void soundSetSoundOn(bool soundOnFlag) { + _soundOn = soundOnFlag; + _pMidiDrv->playSwitch(soundOnFlag); } + uint16 soundGetVoices(); + uint32 soundGetTempo() { return _dwTempo; } MusicEntry *getSlot(reg_t obj) { _mutex.lock(); @@ -169,6 +172,7 @@ private: static void miditimerCallback(void *p); MusicList _playList; + bool _soundOn; }; } // end of namespace diff --git a/engines/sci/sfx/soundcmd.cpp b/engines/sci/sfx/soundcmd.cpp index c39321ef34..ea6cca69b7 100644 --- a/engines/sci/sfx/soundcmd.cpp +++ b/engines/sci/sfx/soundcmd.cpp @@ -547,20 +547,11 @@ void SoundCommandParser::cmdResumeHandle(reg_t obj, int16 value) { } void SoundCommandParser::cmdMuteSound(reg_t obj, int16 value) { - //_acc = _music->SoundOn(argc > 1 ? argv[2] : 0xFF); - - // TODO - - /* if there's a parameter, we're setting it. Otherwise, we're querying it. */ - /*int param = UPARAM_OR_ALT(1,-1); - - if (param != -1) - s->acc = s->sound_server->command(s, SOUND_COMMAND_SET_MUTE, 0, param); - else - s->acc = s->sound_server->command(s, SOUND_COMMAND_GET_MUTE, 0, 0);*/ - - // TODO - warning("STUB: cmdMuteSound"); +#ifndef USE_OLD_MUSIC_FUNCTIONS + if (_argc > 0) + _music->soundSetSoundOn(_argv[0].toUint16()); + _acc = make_reg(0, _music->soundGetSoundOn()); +#endif } void SoundCommandParser::cmdVolume(reg_t obj, int16 value) { |