[Scummvm-cvs-logs] SF.net SVN: scummvm:[46643] scummvm/trunk/engines/sci
thebluegr at users.sourceforge.net
thebluegr at users.sourceforge.net
Sun Dec 27 15:11:26 CET 2009
Revision: 46643
http://scummvm.svn.sourceforge.net/scummvm/?rev=46643&view=rev
Author: thebluegr
Date: 2009-12-27 14:11:26 +0000 (Sun, 27 Dec 2009)
Log Message:
-----------
SCI/new music code:
- Implemented sound muting
- Now saving/loading the master music volume
Modified Paths:
--------------
scummvm/trunk/engines/sci/engine/savegame.cpp
scummvm/trunk/engines/sci/engine/savegame.h
scummvm/trunk/engines/sci/sfx/music.cpp
scummvm/trunk/engines/sci/sfx/music.h
scummvm/trunk/engines/sci/sfx/soundcmd.cpp
Modified: scummvm/trunk/engines/sci/engine/savegame.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/savegame.cpp 2009-12-27 14:09:10 UTC (rev 46642)
+++ scummvm/trunk/engines/sci/engine/savegame.cpp 2009-12-27 14:11:26 UTC (rev 46643)
@@ -622,6 +622,24 @@
_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);
Modified: scummvm/trunk/engines/sci/engine/savegame.h
===================================================================
--- scummvm/trunk/engines/sci/engine/savegame.h 2009-12-27 14:09:10 UTC (rev 46642)
+++ scummvm/trunk/engines/sci/engine/savegame.h 2009-12-27 14:11:26 UTC (rev 46643)
@@ -36,7 +36,7 @@
struct EngineState;
enum {
- CURRENT_SAVEGAME_VERSION = 14,
+ CURRENT_SAVEGAME_VERSION = 15,
MINIMUM_SAVEGAME_VERSION = 9
};
Modified: scummvm/trunk/engines/sci/sfx/music.cpp
===================================================================
--- scummvm/trunk/engines/sci/sfx/music.cpp 2009-12-27 14:09:10 UTC (rev 46642)
+++ scummvm/trunk/engines/sci/sfx/music.cpp 2009-12-27 14:11:26 UTC (rev 46643)
@@ -41,7 +41,7 @@
}
SciMusic::SciMusic(SciVersion soundVersion)
- : _soundVersion(soundVersion) {
+ : _soundVersion(soundVersion), _soundOn(true) {
// Reserve some space in the playlist, to avoid expensive insertion
// operations
Modified: scummvm/trunk/engines/sci/sfx/music.h
===================================================================
--- scummvm/trunk/engines/sci/sfx/music.h 2009-12-27 14:09:10 UTC (rev 46642)
+++ scummvm/trunk/engines/sci/sfx/music.h 2009-12-27 14:11:26 UTC (rev 46643)
@@ -114,10 +114,13 @@
void soundSetPriority(MusicEntry *pSnd, byte prio);
uint16 soundGetMasterVolume();
void soundSetMasterVolume(uint16 vol);
+ uint16 soundGetSoundOn() { return _soundOn; }
+ void soundSetSoundOn(bool soundOnFlag) {
+ _soundOn = soundOnFlag;
+ _pMidiDrv->playSwitch(soundOnFlag);
+ }
uint16 soundGetVoices();
- uint32 soundGetTempo() {
- return _dwTempo;
- }
+ uint32 soundGetTempo() { return _dwTempo; }
MusicEntry *getSlot(reg_t obj) {
_mutex.lock();
@@ -169,6 +172,7 @@
static void miditimerCallback(void *p);
MusicList _playList;
+ bool _soundOn;
};
} // end of namespace
Modified: scummvm/trunk/engines/sci/sfx/soundcmd.cpp
===================================================================
--- scummvm/trunk/engines/sci/sfx/soundcmd.cpp 2009-12-27 14:09:10 UTC (rev 46642)
+++ scummvm/trunk/engines/sci/sfx/soundcmd.cpp 2009-12-27 14:11:26 UTC (rev 46643)
@@ -547,20 +547,11 @@
}
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) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list