aboutsummaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorMax Horn2007-06-30 21:02:58 +0000
committerMax Horn2007-06-30 21:02:58 +0000
commit93b1a53c72f1c181439b7dcd43c94d911a2e30ee (patch)
tree52ee7df65cb9d6514a3cca096f6fad91382af515 /sound
parentfed38a794f8cd810e7b50f59d71b4c0fc581d6fc (diff)
downloadscummvm-rg350-93b1a53c72f1c181439b7dcd43c94d911a2e30ee.tar.gz
scummvm-rg350-93b1a53c72f1c181439b7dcd43c94d911a2e30ee.tar.bz2
scummvm-rg350-93b1a53c72f1c181439b7dcd43c94d911a2e30ee.zip
Changed semantics of Mixer::pause*() methods -- if you pause n times, you have to unpause n times before the sound resumes (this means pauseAll works correct in engines which selectively pause/resume single sounds)
svn-id: r27798
Diffstat (limited to 'sound')
-rw-r--r--sound/mixer.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/sound/mixer.cpp b/sound/mixer.cpp
index cc353d58b4..4ca7b4c897 100644
--- a/sound/mixer.cpp
+++ b/sound/mixer.cpp
@@ -54,7 +54,7 @@ private:
bool _permanent;
byte _volume;
int8 _balance;
- bool _paused;
+ int _pauseLevel;
int _id;
uint32 _samplesConsumed;
uint32 _samplesDecoded;
@@ -77,10 +77,15 @@ public:
return _input->endOfStream();
}
void pause(bool paused) {
- _paused = paused;
+ assert((paused && _pauseLevel >= 0) || (!paused && _pauseLevel));
+
+ if (paused)
+ _pauseLevel++;
+ else
+ _pauseLevel--;
}
bool isPaused() {
- return _paused;
+ return _pauseLevel != 0;
}
void setVolume(const byte volume) {
_volume = volume;
@@ -375,7 +380,7 @@ int Mixer::getVolumeForSoundType(SoundType type) const {
Channel::Channel(Mixer *mixer, Mixer::SoundType type, AudioStream *input,
bool autofreeStream, bool reverseStereo, int id, bool permanent)
: _type(type), _mixer(mixer), _autofreeStream(autofreeStream),
- _volume(Mixer::kMaxChannelVolume), _balance(0), _paused(false), _id(id), _samplesConsumed(0),
+ _volume(Mixer::kMaxChannelVolume), _balance(0), _pauseLevel(0), _id(id), _samplesConsumed(0),
_samplesDecoded(0), _mixerTimeStamp(0), _converter(0), _input(input), _permanent(permanent) {
assert(mixer);
assert(input);