diff options
author | Willem Jan Palenstijn | 2009-01-24 01:23:04 +0000 |
---|---|---|
committer | Willem Jan Palenstijn | 2009-01-24 01:23:04 +0000 |
commit | de341291aa068d7ad2bb6e11c62b98f3e3120552 (patch) | |
tree | bc5a9cb2b9c974914e96c34526789cd15d015889 /sound | |
parent | 17b82253e9aeed06cbfb7051cb25ed6d0d2c4d88 (diff) | |
download | scummvm-rg350-de341291aa068d7ad2bb6e11c62b98f3e3120552.tar.gz scummvm-rg350-de341291aa068d7ad2bb6e11c62b98f3e3120552.tar.bz2 scummvm-rg350-de341291aa068d7ad2bb6e11c62b98f3e3120552.zip |
remove 'HACK': don't use _cd.playing to indicate emulation
svn-id: r36029
Diffstat (limited to 'sound')
-rw-r--r-- | sound/audiocd.cpp | 26 | ||||
-rw-r--r-- | sound/audiocd.h | 7 |
2 files changed, 16 insertions, 17 deletions
diff --git a/sound/audiocd.cpp b/sound/audiocd.cpp index 8fc9100926..b2c91234a4 100644 --- a/sound/audiocd.cpp +++ b/sound/audiocd.cpp @@ -43,6 +43,7 @@ AudioCDManager::AudioCDManager() { _cd.duration = 0; _cd.numLoops = 0; _mixer = g_system->getMixer(); + _emulating = false; assert(_mixer); } @@ -72,24 +73,23 @@ void AudioCDManager::play(int track, int numLoops, int startFrame, int duration) } // Stop any currently playing emulated track - _mixer->stopHandle(_cd.handle); + _mixer->stopHandle(_handle); - // HACK: We abuse _cd.playing to store whether we are playing a real or an emulated track. if (stream != 0) { - _cd.playing = true; - _mixer->playInputStream(Audio::Mixer::kMusicSoundType, &_cd.handle, stream); + _emulating = true; + _mixer->playInputStream(Audio::Mixer::kMusicSoundType, &_handle, stream); } else { - _cd.playing = false; + _emulating = false; g_system->playCD(track, numLoops, startFrame, duration); } } } void AudioCDManager::stop() { - if (_cd.playing) { + if (_emulating) { // Audio CD emulation - _mixer->stopHandle(_cd.handle); - _cd.playing = false; + _mixer->stopHandle(_handle); + _emulating = false; } else { // Real Audio CD g_system->stopCD(); @@ -97,9 +97,9 @@ void AudioCDManager::stop() { } bool AudioCDManager::isPlaying() const { - if (_cd.playing) { + if (_emulating) { // Audio CD emulation - return _mixer->isSoundHandleActive(_cd.handle); + return _mixer->isSoundHandleActive(_handle); } else { // Real Audio CD return g_system->pollCD(); @@ -107,15 +107,15 @@ bool AudioCDManager::isPlaying() const { } void AudioCDManager::updateCD() { - if (_cd.playing) { + if (_emulating) { // Check whether the audio track stopped playback - if (!_mixer->isSoundHandleActive(_cd.handle)) { + if (!_mixer->isSoundHandleActive(_handle)) { // 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 whether the track is currently set to infinite looping // or not. - _cd.playing = false; + _emulating = false; } } else { g_system->updateCD(); diff --git a/sound/audiocd.h b/sound/audiocd.h index 83b0374291..ced5410a1f 100644 --- a/sound/audiocd.h +++ b/sound/audiocd.h @@ -67,11 +67,10 @@ private: AudioCDManager(); /* used for emulated CD music */ - struct ExtStatus : Status { - SoundHandle handle; - }; - ExtStatus _cd; + SoundHandle _handle; + bool _emulating; + Status _cd; Mixer *_mixer; }; |