[Scummvm-git-logs] scummvm master -> 928e22e5b3fb6f5dc88c3203c55b47a249430145
AndywinXp
noreply at scummvm.org
Sat Jun 21 10:03:10 UTC 2025
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:
928e22e5b3 LASTEXPRESS: Tame audio buffer underruns
Commit: 928e22e5b3fb6f5dc88c3203c55b47a249430145
https://github.com/scummvm/scummvm/commit/928e22e5b3fb6f5dc88c3203c55b47a249430145
Author: AndywinXp (andywinxp at gmail.com)
Date: 2025-06-21T12:03:00+02:00
Commit Message:
LASTEXPRESS: Tame audio buffer underruns
Changed paths:
engines/lastexpress/sound/driver.cpp
diff --git a/engines/lastexpress/sound/driver.cpp b/engines/lastexpress/sound/driver.cpp
index 2017a8281fc..b68ff2e89ac 100644
--- a/engines/lastexpress/sound/driver.cpp
+++ b/engines/lastexpress/sound/driver.cpp
@@ -33,13 +33,24 @@ void SoundManager::soundDriverInit() {
&_channelHandle,
_stream,
-1,
- Audio::Mixer::kMaxChannelVolume);
+ Audio::Mixer::kMaxChannelVolume
+ );
+
+ // The following is a way to adapt the amount of buffers to the current device capabilities.
+ // Re-adapted from my own code found within the Digital iMUSE subsystem from the SCUMM engine.
+ _maxQueuedStreams = (uint32)ceil((_mixer->getOutputBufSize() / 1470) / ((float)_mixer->getOutputRate() / 44100));
+
+ if (_mixer->getOutputRate() % 44100) {
+ _maxQueuedStreams++;
+ }
+
+ _maxQueuedStreams = MAX<uint32>(4, _maxQueuedStreams);
}
void SoundManager::soundDriverCopyBuffersToDevice() {
_sound30HzCounter++;
- while (_stream->numQueuedStreams() < 4) {
+ while (_stream->numQueuedStreams() < _maxQueuedStreams) {
byte *ptr = (byte *)malloc(1470 * sizeof(int16));
assert(ptr);
More information about the Scummvm-git-logs
mailing list