[Scummvm-git-logs] scummvm master -> fcc68c031c11529e2b89e8c495462bf5b55c4afb
sev-
noreply at scummvm.org
Fri Feb 21 19:15:08 UTC 2025
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:
fcc68c031c DIRECTOR: Fix sound channels handling
Commit: fcc68c031c11529e2b89e8c495462bf5b55c4afb
https://github.com/scummvm/scummvm/commit/fcc68c031c11529e2b89e8c495462bf5b55c4afb
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2025-02-21T20:14:15+01:00
Commit Message:
DIRECTOR: Fix sound channels handling
Take into account that it is a HashMap and avoid unnecessary copying
Changed paths:
engines/director/sound.cpp
diff --git a/engines/director/sound.cpp b/engines/director/sound.cpp
index 3464fa2c23c..65f01a82a41 100644
--- a/engines/director/sound.cpp
+++ b/engines/director/sound.cpp
@@ -64,7 +64,7 @@ DirectorSound::~DirectorSound() {
this->stopSound();
unloadSampleSounds();
delete _speaker;
- for (auto it : _channels)
+ for (auto &it : _channels)
delete it._value;
}
@@ -455,7 +455,7 @@ void DirectorSound::playExternalSound(uint16 menu, uint16 submenu, uint8 soundCh
}
void DirectorSound::changingMovie() {
- for (auto it : _channels) {
+ for (auto &it : _channels) {
it._value->movieChanged = true;
if (isChannelPuppet(it._key)) {
setPuppetSound(SoundID(), it._key); // disable puppet sound
@@ -508,7 +508,7 @@ void DirectorSound::stopSound(uint8 soundChannel) {
void DirectorSound::stopSound() {
debugC(5, kDebugSound, "DirectorSound::stopSound(): stopping all channels");
- for (auto it : _channels) {
+ for (auto &it : _channels) {
if (!it._value)
continue;
@@ -665,8 +665,8 @@ void DirectorSound::setChannelVolume(int channel, uint8 volume) {
setChannelVolumeInternal(channel, volume);
} else {
debugC(5, kDebugSound, "DirectorSound::setChannelVolume: setting all channels to volume %d", volume);
- for (uint i = 0; i < _channels.size(); i++)
- setChannelVolumeInternal(i + 1, volume);
+ for (auto &it : _channels)
+ setChannelVolumeInternal(it._key, volume);
}
}
More information about the Scummvm-git-logs
mailing list