From 513a56cd5e6aaa06f1b88d94c4284a808c99c992 Mon Sep 17 00:00:00 2001 From: Martin Kiewitz Date: Sat, 2 Jan 2010 08:15:01 +0000 Subject: SCI/newmusic: set default volume on MusicEntry creation, use volume selector sci1late (soundversion) only svn-id: r46875 --- engines/sci/sfx/music.cpp | 2 +- engines/sci/sfx/music.h | 2 +- engines/sci/sfx/soundcmd.cpp | 13 ++++--------- 3 files changed, 6 insertions(+), 11 deletions(-) (limited to 'engines/sci/sfx') diff --git a/engines/sci/sfx/music.cpp b/engines/sci/sfx/music.cpp index 065d4f101a..1a98a58a02 100644 --- a/engines/sci/sfx/music.cpp +++ b/engines/sci/sfx/music.cpp @@ -524,7 +524,7 @@ MusicEntry::MusicEntry() { signal = 0; prio = 0; loop = 0; - volume = 0; + volume = MUSIC_VOLUME_DEFAULT; hold = 0; pauseCounter = 0; diff --git a/engines/sci/sfx/music.h b/engines/sci/sfx/music.h index a1458b234c..6087202cb0 100644 --- a/engines/sci/sfx/music.h +++ b/engines/sci/sfx/music.h @@ -56,7 +56,7 @@ enum SoundStatus { kSoundPlaying = 3 }; -#define MUSIC_VOLUME_FOR_SCI0 127 +#define MUSIC_VOLUME_DEFAULT 127 #define MUSIC_VOLUME_MAX 127 class MidiParser_SCI; diff --git a/engines/sci/sfx/soundcmd.cpp b/engines/sci/sfx/soundcmd.cpp index 7b4a74ec10..467aa6f8bf 100644 --- a/engines/sci/sfx/soundcmd.cpp +++ b/engines/sci/sfx/soundcmd.cpp @@ -280,7 +280,8 @@ void SoundCommandParser::cmdInitSound(reg_t obj, int16 value) { newSound->soundObj = obj; newSound->loop = GET_SEL32V(_segMan, obj, loop); newSound->prio = GET_SEL32V(_segMan, obj, pri) & 0xFF; - newSound->volume = CLIP(GET_SEL32V(_segMan, obj, vol), 0, MUSIC_VOLUME_MAX); + if (_soundVersion >= SCI_VERSION_1_LATE) + newSound->volume = CLIP(GET_SEL32V(_segMan, obj, vol), 0, MUSIC_VOLUME_MAX); // Check if a track with the same sound object is already playing MusicEntry *oldSound = _music->getSlot(obj); @@ -418,10 +419,7 @@ void SoundCommandParser::cmdPlaySound(reg_t obj, int16 value) { musicSlot->loop = GET_SEL32V(_segMan, obj, loop); musicSlot->prio = GET_SEL32V(_segMan, obj, priority); - // vol selector doesnt get used before sci1late - if (_soundVersion < SCI_VERSION_1_LATE) - musicSlot->volume = MUSIC_VOLUME_FOR_SCI0; - else + if (_soundVersion >= SCI_VERSION_1_LATE) musicSlot->volume = GET_SEL32V(_segMan, obj, vol); _music->soundPlay(musicSlot); @@ -641,7 +639,6 @@ void SoundCommandParser::cmdFadeSound(reg_t obj, int16 value) { } int volume = musicSlot->volume; - PUT_SEL32V(_segMan, musicSlot->soundObj, vol, volume); musicSlot->fadeTo = _argv[2].toUint16(); musicSlot->fadeStep = volume > _argv[2].toUint16() ? -_argv[4].toUint16() : _argv[4].toUint16(); musicSlot->fadeTickerStep = _argv[3].toUint16() * 16667 / _music->soundGetTempo(); @@ -1018,10 +1015,8 @@ void SoundCommandParser::reconstructPlayList(int savegame_version) { (*i)->dataInc = GET_SEL32V(_segMan, (*i)->soundObj, dataInc); (*i)->signal = GET_SEL32V(_segMan, (*i)->soundObj, signal); - if (_soundVersion >= SCI_VERSION_1_EARLY) + if (_soundVersion >= SCI_VERSION_1_LATE) (*i)->volume = GET_SEL32V(_segMan, (*i)->soundObj, vol); - else - (*i)->volume = MUSIC_VOLUME_FOR_SCI0; } (*i)->soundRes = new SoundResource((*i)->resnum, _resMan, _soundVersion); -- cgit v1.2.3