diff options
author | Max Horn | 2007-02-24 23:19:53 +0000 |
---|---|---|
committer | Max Horn | 2007-02-24 23:19:53 +0000 |
commit | 65b30d84a805a7b22322474970a219d5628997d5 (patch) | |
tree | 71a3b15d15d59eb4802982ad7dc3a549b1bf2070 /sound/audiocd.cpp | |
parent | d6467f79a29cf053370d20960697c9a60f71f81e (diff) | |
download | scummvm-rg350-65b30d84a805a7b22322474970a219d5628997d5.tar.gz scummvm-rg350-65b30d84a805a7b22322474970a219d5628997d5.tar.bz2 scummvm-rg350-65b30d84a805a7b22322474970a219d5628997d5.zip |
Added numLoops parameter to DigitalTrackInfo::play
svn-id: r25836
Diffstat (limited to 'sound/audiocd.cpp')
-rw-r--r-- | sound/audiocd.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/sound/audiocd.cpp b/sound/audiocd.cpp index 8ae811ef10..09713eaf0f 100644 --- a/sound/audiocd.cpp +++ b/sound/audiocd.cpp @@ -91,7 +91,13 @@ void AudioCDManager::play(int track, int numLoops, int startFrame, int duration) if (index >= 0) { _mixer->stopHandle(_cd.handle); _cd.playing = true; - _trackInfo[index]->play(_mixer, &_cd.handle, _cd.start, _cd.duration); + /* + FIXME: Seems numLoops == 0 and numLoops == 1 both indicate a single repetition, + while all other positive numbers indicate precisely the number of desired + repetitions. Finally, -1 means infinitely many + */ + numLoops = (numLoops < 1) ? numLoops + 1 : numLoops; + _trackInfo[index]->play(_mixer, &_cd.handle, numLoops, _cd.start, _cd.duration); } else { g_system->playCD(track, numLoops, startFrame, duration); _cd.playing = false; @@ -114,19 +120,13 @@ bool AudioCDManager::isPlaying() const { void AudioCDManager::updateCD() { if (_cd.playing) { - // If the sound handle is 0, then playback stopped. + // Check whether the audio track stopped playback if (!_mixer->isSoundHandleActive(_cd.handle)) { - // If playback just stopped, check if the current track is supposed - // to be repeated, and if that's the case, play it again. Else, stop - // the CD explicitly. - if (_cd.numLoops == -1 || --_cd.numLoops > 0) { - int index = getCachedTrack(_cd.track); - assert(index >= 0); - _trackInfo[index]->play(_mixer, &_cd.handle, _cd.start, _cd.duration); - } else { - _mixer->stopHandle(_cd.handle); - _cd.playing = false; - } + // FIXME: We do not update the numLoops parameter here (and in fact, + // currently can't do that). Luckily, only one engine ever checks + // this part of the AudioCD status, namely the SCUMM engine; and it + // only checks + _cd.playing = false; } } else { g_system->updateCD(); |