[Scummvm-git-logs] scummvm master -> 95699a6edca96f35bf69a7a0e1981cfbc1ec8748
sev-
noreply at scummvm.org
Sun Jun 21 23:51:26 UTC 2026
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
95699a6edc Revert "AUDIO: Don't clamp muted channels"
Commit: 95699a6edca96f35bf69a7a0e1981cfbc1ec8748
https://github.com/scummvm/scummvm/commit/95699a6edca96f35bf69a7a0e1981cfbc1ec8748
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-06-22T01:49:37+02:00
Commit Message:
Revert "AUDIO: Don't clamp muted channels"
This reverts commit 995c360cfc03ce037959ddaaab00c5b5b224f630.
Changed paths:
audio/mixer.cpp
diff --git a/audio/mixer.cpp b/audio/mixer.cpp
index cbb47186ae6..0f6ab5298e9 100644
--- a/audio/mixer.cpp
+++ b/audio/mixer.cpp
@@ -143,11 +143,6 @@ public:
*/
uint8 getFaderR() const;
- /**
- * Queries whether the channel is silent, i.e. will produce no audio output.
- */
- bool isSilent() const { return _volL == 0 && _volR == 0; }
-
/**
* Set the channel's sample rate.
*
@@ -351,13 +346,15 @@ int MixerImpl::mixCallback(byte *samples, uint len) {
// Since the mixer callback has been called, the mixer must be ready...
_mixerReady = true;
+ // zero the sample buffer
+ memset(samples, 0, len);
+
// we store samples of size defined by the backend
const uint bytesPerFrame = _outBytesPerSample * (_stereo ? 2 : 1);
assert(len % bytesPerFrame == 0);
- const uint numFrames = len / bytesPerFrame;
+ len /= bytesPerFrame;
- // mix all channels, zeroing the buffer lazily on first non-silent channel
- bool zeroed = false;
+ // mix all channels
int res = 0, tmp;
for (int i = 0; i != NUM_CHANNELS; i++)
if (_channels[i]) {
@@ -365,19 +362,14 @@ int MixerImpl::mixCallback(byte *samples, uint len) {
delete _channels[i];
_channels[i] = nullptr;
} else if (!_channels[i]->isPaused()) {
- if (!_channels[i]->isSilent() && !zeroed) {
- memset(samples, 0, len);
- zeroed = true;
- }
- tmp = _channels[i]->mix(samples, numFrames);
+ tmp = _channels[i]->mix(samples, len);
if (tmp > res)
res = tmp;
}
}
- // optimisation: let the caller know that there's nothing to clamp
- return (!_clamp && !zeroed) ? 0 : res;
+ return res;
}
void MixerImpl::stopAll() {
More information about the Scummvm-git-logs
mailing list