[Scummvm-tracker] [ScummVM :: Bugs] #15886: SCUMM: Bug when restoring CD audio sound in some games

ScummVM :: Bugs trac at scummvm.org
Mon Apr 21 20:21:54 UTC 2025


#15886: SCUMM: Bug when restoring CD audio sound in some games
----------------------------+---------------------------
Reporter:  eriktorbjorn     |      Owner:  (none)
    Type:  defect           |     Status:  new
Priority:  normal           |  Component:  Engine: SCUMM
 Version:                   |   Keywords:
    Game:  Monkey Island 1  |
----------------------------+---------------------------
 This is something I noticed while playing the Sega CD version of The
 Secret of Monkey Island, but I assume it also happens in other, less
 obscure, games. When loading certain savegames, there is a warning like
 this:

 {{{
 WARNING: makeLoopingAudioStream: start (159733) >= end (159173)!
 WARNING: stream is 0!
 }}}

 The problem seems to happen if you save in a room that's playing looping
 CD audio, and it's played it played for long enough for it to loop back to
 the beginning again. As far as I can tell, this is almost certainly a bug
 in `SoundCD::restoreAfterLoad()`:

 {{{
         } else if (_vm->_game.platform != Common::kPlatformFMTowns) {
                 trackNr = getCDTrackIdFromSoundId(_currentCDSound, loops,
 start, end);
                 if (trackNr != -1)
                         g_system->getAudioCDManager()->play(trackNr,
 loops, start + _vm->VAR(_vm->VAR_MUSIC_TIMER), 0, true);
         }
 }}}

 Apparently, `VAR_MUSIC_TIMER` does not reset when the track loops (should
 it?), so when it adds that to `start` it tries to start the track from a
 point beyond the end of it.

 Also, doesn't this mean that if, say, you save five seconds from the end
 of the song, it will loop only that final five seconds?

 Finally, it seems rather inexact when restoring the current position of
 the track. Can we really just add `VAR_MUSIC_TIMER` like that? It seems to
 work much better in VGA Loom, but that apparently does it differently.

 I suppose restoring the position is only really necessary for tracks that
 play once (where the action may be timed to the music), so the quick-and-
 dirty solution would be to just play from the beginning if the track
 loops.
-- 
Ticket URL: <https://bugs.scummvm.org/ticket/15886>
ScummVM :: Bugs <https://bugs.scummvm.org>
ScummVM


More information about the Scummvm-tracker mailing list