aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Kiewitz2010-01-03 23:30:23 +0000
committerMartin Kiewitz2010-01-03 23:30:23 +0000
commit8fb870b0e385a888585b00f4a38e19a3c37cd901 (patch)
tree9d3711a8a694ee0c947b98392cf58eab17d03846
parent9182c37a06fcbc7b6518da257ced5ff8a23b3883 (diff)
downloadscummvm-rg350-8fb870b0e385a888585b00f4a38e19a3c37cd901.tar.gz
scummvm-rg350-8fb870b0e385a888585b00f4a38e19a3c37cd901.tar.bz2
scummvm-rg350-8fb870b0e385a888585b00f4a38e19a3c37cd901.zip
SCI/newmusic: support for SCI0 fading, doesnt work yet because channels[] is currently not correctly filled out inside SoundResource class - because it wasnt previously needed
svn-id: r46963
-rw-r--r--engines/sci/sfx/soundcmd.cpp25
-rw-r--r--engines/sci/sfx/soundcmd.h1
2 files changed, 22 insertions, 4 deletions
diff --git a/engines/sci/sfx/soundcmd.cpp b/engines/sci/sfx/soundcmd.cpp
index 3fa9e91a86..e22d24fa18 100644
--- a/engines/sci/sfx/soundcmd.cpp
+++ b/engines/sci/sfx/soundcmd.cpp
@@ -209,6 +209,7 @@ reg_t SoundCommandParser::parseCommand(int argc, reg_t *argv, reg_t acc) {
reg_t obj = (argc > 1) ? argv[1] : NULL_REG;
int16 value = (argc > 2) ? argv[2].toSint16() : 0;
_acc = acc;
+ _argc = argc;
_argv = argv;
// cmdMuteSound and cmdMasterVolume do not operate on an object, but need the number of
@@ -655,10 +656,26 @@ void SoundCommandParser::cmdFadeSound(reg_t obj, int16 value) {
}
int volume = musicSlot->volume;
- musicSlot->fadeTo = CLIP<uint16>(_argv[2].toUint16(), 0, MUSIC_VOLUME_MAX);
- musicSlot->fadeStep = volume > _argv[2].toUint16() ? -_argv[4].toUint16() : _argv[4].toUint16();
- musicSlot->fadeTickerStep = _argv[3].toUint16() * 16667 / _music->soundGetTempo();
- musicSlot->fadeTicker = 0;
+
+ switch (_argc) {
+ case 2: // SCI0
+ musicSlot->fadeTo = 0;
+ musicSlot->fadeStep = -5;
+ musicSlot->fadeTickerStep = 0x10 * 16667 / _music->soundGetTempo();
+ musicSlot->fadeTicker = 0;
+ break;
+
+ case 5: // Possibly SCI1?!
+ case 6: // SCI 1.1 TODO: find out what additional parameter is
+ musicSlot->fadeTo = CLIP<uint16>(_argv[2].toUint16(), 0, MUSIC_VOLUME_MAX);
+ musicSlot->fadeStep = volume > _argv[2].toUint16() ? -_argv[4].toUint16() : _argv[4].toUint16();
+ musicSlot->fadeTickerStep = _argv[3].toUint16() * 16667 / _music->soundGetTempo();
+ musicSlot->fadeTicker = 0;
+ break;
+
+ default:
+ error("cmdFadeSound: unsupported argc %d", _argc);
+ }
debugC(2, kDebugLevelSound, "cmdFadeSound: to %d, step %d, ticker %d", musicSlot->fadeTo, musicSlot->fadeStep, musicSlot->fadeTickerStep);
#endif
diff --git a/engines/sci/sfx/soundcmd.h b/engines/sci/sfx/soundcmd.h
index 62a09647ed..20ddc077a3 100644
--- a/engines/sci/sfx/soundcmd.h
+++ b/engines/sci/sfx/soundcmd.h
@@ -83,6 +83,7 @@ private:
#endif
AudioPlayer *_audio;
SciVersion _soundVersion;
+ int _argc;
reg_t *_argv; // for cmdFadeSound
uint32 _midiCommand; // for cmdSendMidi
reg_t _acc;