diff options
author | Martin Kiewitz | 2009-12-30 21:22:00 +0000 |
---|---|---|
committer | Martin Kiewitz | 2009-12-30 21:22:00 +0000 |
commit | c71fc9130d9a9dff8161f72063a2b152b937281b (patch) | |
tree | fc59bed38d388048a704163296f770e2cc190dc5 /engines/sci/sfx | |
parent | a108df30a753bc062d2e2c041c70a4477f08b671 (diff) | |
download | scummvm-rg350-c71fc9130d9a9dff8161f72063a2b152b937281b.tar.gz scummvm-rg350-c71fc9130d9a9dff8161f72063a2b152b937281b.tar.bz2 scummvm-rg350-c71fc9130d9a9dff8161f72063a2b152b937281b.zip |
SCI/newmusic: fix loop logic
svn-id: r46774
Diffstat (limited to 'engines/sci/sfx')
-rw-r--r-- | engines/sci/sfx/midiparser.cpp | 6 | ||||
-rw-r--r-- | engines/sci/sfx/music.h | 2 | ||||
-rw-r--r-- | engines/sci/sfx/soundcmd.cpp | 13 |
3 files changed, 11 insertions, 10 deletions
diff --git a/engines/sci/sfx/midiparser.cpp b/engines/sci/sfx/midiparser.cpp index c9d9fbe30b..8d44cf0a5a 100644 --- a/engines/sci/sfx/midiparser.cpp +++ b/engines/sci/sfx/midiparser.cpp @@ -200,9 +200,12 @@ void MidiParser_SCI::parseNextEvent(EventInfo &info) { info.ext.data = _position._play_pos; _position._play_pos += info.length; if (info.ext.type == 0x2F) {// end of track reached + if (_pSnd->loop) + _pSnd->loop--; + PUT_SEL32V(segMan, _pSnd->soundObj, loop, _pSnd->loop); if (_pSnd->loop) { + // We need to play it again... jumpToTick(_loopTick); - _pSnd->loop--; } else { _pSnd->status = kSoundStopped; PUT_SEL32V(segMan, _pSnd->soundObj, signal, 0xFFFF); @@ -210,7 +213,6 @@ void MidiParser_SCI::parseNextEvent(EventInfo &info) { PUT_SEL32V(segMan, _pSnd->soundObj, state, kSoundStopped); debugC(2, kDebugLevelSound, "signal EOT"); } - PUT_SEL32V(segMan, _pSnd->soundObj, loop, _pSnd->loop); } break; default: diff --git a/engines/sci/sfx/music.h b/engines/sci/sfx/music.h index 3fe136f48f..8145de8fb8 100644 --- a/engines/sci/sfx/music.h +++ b/engines/sci/sfx/music.h @@ -73,7 +73,7 @@ public: uint16 dataInc; uint16 ticker; byte prio; - byte loop; + uint16 loop; int16 volume; int16 pauseCounter; diff --git a/engines/sci/sfx/soundcmd.cpp b/engines/sci/sfx/soundcmd.cpp index a135d88a2b..43f6d762df 100644 --- a/engines/sci/sfx/soundcmd.cpp +++ b/engines/sci/sfx/soundcmd.cpp @@ -297,7 +297,7 @@ void SoundCommandParser::cmdInitHandle(reg_t obj, int16 value) { if (number && _resMan->testResource(ResourceId(kResourceTypeSound, number))) newSound->soundRes = new SoundResource(number, _resMan, _soundVersion); newSound->soundObj = obj; - newSound->loop = GET_SEL32V(_segMan, obj, loop) == 0xFFFF ? 1 : 0; + newSound->loop = GET_SEL32V(_segMan, obj, loop); newSound->prio = GET_SEL32V(_segMan, obj, pri) & 0xFF; newSound->volume = CLIP<int>(GET_SEL32V(_segMan, obj, vol), 0, Audio::Mixer::kMaxChannelVolume); @@ -420,7 +420,7 @@ void SoundCommandParser::cmdPlayHandle(reg_t obj, int16 value) { PUT_SEL32V(_segMan, obj, state, kSoundPlaying); } - musicSlot->loop = GET_SEL32V(_segMan, obj, loop) == 0xFFFF ? 1 : 0; + 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) @@ -676,7 +676,7 @@ void SoundCommandParser::cmdUpdateHandle(reg_t obj, int16 value) { return; } - musicSlot->loop = (GET_SEL32V(_segMan, obj, loop) == 0xFFFF ? 1 : 0); + musicSlot->loop = GET_SEL32V(_segMan, obj, loop); int16 objVol = CLIP<int>(GET_SEL32V(_segMan, obj, vol), 0, 255); if (objVol != musicSlot->volume) _music->soundSetVolume(musicSlot, objVol); @@ -894,12 +894,11 @@ void SoundCommandParser::cmdSetHandleLoop(reg_t obj, int16 value) { return; } if (value == -1) { - musicSlot->loop = 1; - PUT_SEL32V(_segMan, obj, loop, 0xFFFF); + musicSlot->loop = 0xFFFF; } else { - musicSlot->loop = 0; - PUT_SEL32V(_segMan, obj, loop, 1); + musicSlot->loop = 1; // actually plays the music once } + PUT_SEL32V(_segMan, obj, loop, musicSlot->loop); #endif } |