[Scummvm-git-logs] scummvm master -> c71fa02bf5c6a154d4d3a029664769e870d3394f
bgK
bastien.bouclet at gmail.com
Sun Oct 20 17:07:10 CEST 2019
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
650da9eb5b 3DS: Don't immediately update the screen when enabling the overlay
c71fa02bf5 3DS: Change the audio thread to wait for the audio buffers to complete
Commit: 650da9eb5bfa8960a6eea1baa0158465311b0960
https://github.com/scummvm/scummvm/commit/650da9eb5bfa8960a6eea1baa0158465311b0960
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2019-10-20T17:06:33+02:00
Commit Message:
3DS: Don't immediately update the screen when enabling the overlay
Fixes the overlay dirty buffer being visible for a frame when opening
the GUI while in-game.
Changed paths:
backends/platform/3ds/osystem-graphics.cpp
diff --git a/backends/platform/3ds/osystem-graphics.cpp b/backends/platform/3ds/osystem-graphics.cpp
index 8e7ae89..2bad1f5 100644
--- a/backends/platform/3ds/osystem-graphics.cpp
+++ b/backends/platform/3ds/osystem-graphics.cpp
@@ -397,13 +397,11 @@ void OSystem_3DS::updateFocus() {
void OSystem_3DS::showOverlay() {
_overlayVisible = true;
updateSize();
- updateScreen();
}
void OSystem_3DS::hideOverlay() {
_overlayVisible = false;
updateSize();
- updateScreen();
}
Graphics::PixelFormat OSystem_3DS::getOverlayFormat() const {
@@ -446,7 +444,7 @@ bool OSystem_3DS::showMouse(bool visible) {
void OSystem_3DS::warpMouse(int x, int y) {
_cursorX = x;
_cursorY = y;
- warning("x:%d y:%d", x, y);
+
// TODO: adjust for _cursorScalable ?
int offsetx = 0;
int offsety = 0;
Commit: c71fa02bf5c6a154d4d3a029664769e870d3394f
https://github.com/scummvm/scummvm/commit/c71fa02bf5c6a154d4d3a029664769e870d3394f
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2019-10-20T17:06:33+02:00
Commit Message:
3DS: Change the audio thread to wait for the audio buffers to complete
Fixes the regular pop sounds caused by buffer underruns / clobbering of
the previous implementation.
Changed paths:
backends/platform/3ds/osystem-audio.cpp
diff --git a/backends/platform/3ds/osystem-audio.cpp b/backends/platform/3ds/osystem-audio.cpp
index 5826237..043aaf1 100644
--- a/backends/platform/3ds/osystem-audio.cpp
+++ b/backends/platform/3ds/osystem-audio.cpp
@@ -31,18 +31,16 @@ static void audioThreadFunc(void *arg) {
Audio::MixerImpl *mixer = (Audio::MixerImpl *)arg;
OSystem_3DS *osys = (OSystem_3DS *)g_system;
- int i;
const int channel = 0;
int bufferIndex = 0;
- const int bufferCount = 3;
- const int bufferSize = 80000; // Can't be too small, based on delayMillis duration
+ const int bufferCount = 2;
const int sampleRate = mixer->getOutputRate();
- int sampleLen = 0;
- uint32 lastTime = osys->getMillis(true);
- uint32 time = lastTime;
+ const int bufferSamples = 1024;
+ const int bufferSize = bufferSamples * 4;
+
ndspWaveBuf buffers[bufferCount];
- for (i = 0; i < bufferCount; ++i) {
+ for (int i = 0; i < bufferCount; ++i) {
memset(&buffers[i], 0, sizeof(ndspWaveBuf));
buffers[i].data_vaddr = linearAlloc(bufferSize);
buffers[i].looping = false;
@@ -55,27 +53,25 @@ static void audioThreadFunc(void *arg) {
ndspChnSetFormat(channel, NDSP_FORMAT_STEREO_PCM16);
while (!osys->exiting) {
- osys->delayMillis(100); // Note: Increasing the delay requires a bigger buffer
-
- time = osys->getMillis(true);
- sampleLen = (time - lastTime) * 22 * 4; // sampleRate / 1000 * channelCount * sizeof(int16);
- lastTime = time;
+ svcSleepThread(5000 * 1000); // Wake up the thread every 5 ms
- if (!osys->sleeping && sampleLen > 0) {
- bufferIndex++;
- bufferIndex %= bufferCount;
- ndspWaveBuf *buf = &buffers[bufferIndex];
+ if (osys->sleeping) continue;
- buf->nsamples = mixer->mixCallback(buf->data_adpcm, sampleLen);
+ ndspWaveBuf *buf = &buffers[bufferIndex];
+ if (buf->status == NDSP_WBUF_FREE || buf->status == NDSP_WBUF_DONE) {
+ buf->nsamples = mixer->mixCallback(buf->data_adpcm, bufferSize);
if (buf->nsamples > 0) {
DSP_FlushDataCache(buf->data_vaddr, bufferSize);
ndspChnWaveBufAdd(channel, buf);
}
+
+ bufferIndex++;
+ bufferIndex %= bufferCount;
}
}
- for (i = 0; i < bufferCount; ++i)
- linearFree(buffers[i].data_pcm8);
+ for (int i = 0; i < bufferCount; ++i)
+ linearFree(buffers[i].data_pcm16);
}
void OSystem_3DS::initAudio() {
More information about the Scummvm-git-logs
mailing list