[Scummvm-cvs-logs] scummvm master -> 7d29e4017d37f7aee4035b3d7288c8c5478633be
digitall
digitall at scummvm.org
Tue Jun 5 02:05:55 CEST 2012
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
7d29e4017d DREAMWEB: Modify Sound code to better match original behaviour.
Commit: 7d29e4017d37f7aee4035b3d7288c8c5478633be
https://github.com/scummvm/scummvm/commit/7d29e4017d37f7aee4035b3d7288c8c5478633be
Author: D G Turner (digitall at scummvm.org)
Date: 2012-06-04T17:00:01-07:00
Commit Message:
DREAMWEB: Modify Sound code to better match original behaviour.
This fixes bug #3531635 - "DREAMWEB: doors don't play "open" sound when
opening".
In addition, the resultant code is simpler and should better match the
original behaviour and a basic playtest has not shown any regressions.
Changed paths:
engines/dreamweb/sound.cpp
engines/dreamweb/sound.h
diff --git a/engines/dreamweb/sound.cpp b/engines/dreamweb/sound.cpp
index 76c734e..570f76f 100644
--- a/engines/dreamweb/sound.cpp
+++ b/engines/dreamweb/sound.cpp
@@ -35,14 +35,12 @@ DreamWebSound::DreamWebSound(DreamWebEngine *vm) : _vm(vm) {
_vm->_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume"));
_vm->_mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, ConfMan.getInt("speech_volume"));
- _channel0 = 0;
- _channel1 = 0;
-
_currentSample = 0xff;
- _channel0Playing = 0;
+ _channel0Playing = 255;
_channel0Repeat = 0;
_channel0NewSound = false;
_channel1Playing = 255;
+ _channel1NewSound = false;
_volume = 0;
_volumeTo = 0;
@@ -82,13 +80,9 @@ void DreamWebSound::volumeAdjust() {
void DreamWebSound::playChannel0(uint8 index, uint8 repeat) {
debug(1, "playChannel0(index:%d, repeat:%d)", index, repeat);
- if (index == _channel0Playing) {
- warning("playChannel0(index: %d) already playing! Forcing restart...", index);
- _channel0NewSound = true;
- }
-
_channel0Playing = index;
_channel0Repeat = repeat;
+ _channel0NewSound = true;
}
void DreamWebSound::playChannel1(uint8 index) {
@@ -97,6 +91,7 @@ void DreamWebSound::playChannel1(uint8 index) {
return;
_channel1Playing = index;
+ _channel1NewSound = true;
}
void DreamWebSound::cancelCh0() {
@@ -186,10 +181,6 @@ void DreamWebSound::stopSound(uint8 channel) {
debug(1, "stopSound(%u)", channel);
assert(channel == 0 || channel == 1);
_vm->_mixer->stopHandle(_channelHandle[channel]);
- if (channel == 0)
- _channel0 = 0;
- else
- _channel1 = 0;
}
bool DreamWebSound::loadSpeech(const Common::String &filename) {
@@ -229,35 +220,24 @@ void DreamWebSound::soundHandler() {
volume = (8 - volume) * Audio::Mixer::kMaxChannelVolume / 8;
_vm->_mixer->setChannelVolume(_channelHandle[0], volume);
- uint8 ch0 = _channel0Playing;
- if (ch0 == 255)
- ch0 = 0;
- uint8 ch1 = _channel1Playing;
- if (ch1 == 255)
- ch1 = 0;
- uint8 ch0loop = _channel0Repeat;
-
- if (_channel0 != ch0 || _channel0NewSound) {
- _channel0 = ch0;
+ if (_channel0NewSound) {
_channel0NewSound = false;
- if (ch0) {
- playSound(0, ch0, ch0loop);
+ if (_channel0Playing != 255) {
+ playSound(0, _channel0Playing, _channel0Repeat);
}
}
- if (_channel1 != ch1) {
- _channel1 = ch1;
- if (ch1) {
- playSound(1, ch1, 1);
+ if (_channel1NewSound) {
+ _channel1NewSound = false;
+ if (_channel1Playing != 255) {
+ playSound(1, _channel1Playing, 1);
}
}
if (!_vm->_mixer->isSoundHandleActive(_channelHandle[0])) {
_channel0Playing = 255;
- _channel0 = 0;
}
if (!_vm->_mixer->isSoundHandleActive(_channelHandle[1])) {
_channel1Playing = 255;
- _channel1 = 0;
}
}
diff --git a/engines/dreamweb/sound.h b/engines/dreamweb/sound.h
index a38dbf3..1ab06dc 100644
--- a/engines/dreamweb/sound.h
+++ b/engines/dreamweb/sound.h
@@ -68,13 +68,12 @@ private:
Audio::SoundHandle _channelHandle[2];
- uint8 _channel0, _channel1;
-
uint8 _currentSample;
uint8 _channel0Playing;
uint8 _channel0Repeat;
bool _channel0NewSound;
uint8 _channel1Playing;
+ bool _channel1NewSound;
uint8 _volume;
uint8 _volumeTo;
More information about the Scummvm-git-logs
mailing list