1
0
mirror of https://github.com/XProger/OpenLara.git synced 2025-08-14 09:04:31 +02:00

#368 GBA sound buffer switch optimization (one MUL, minor)

This commit is contained in:
XProger
2022-11-28 03:36:37 +03:00
parent 590c7cf1e3
commit 0d8cae5a53
2 changed files with 4 additions and 4 deletions

View File

@@ -19,7 +19,7 @@ tmp .req ampA
.macro clamp amp .macro clamp amp
// Vanadium's clamp trick (-128..127) // Vanadium's clamp trick (-128..127)
mov tmp, \amp, asr #31 // tmp <- 0xffffffff mov tmp, \amp, asr #31 // tmp <- 0xffffffff
cmp tmp, \amp, asr #7 // not equal cmp tmp, \amp, asr #7 // not equal
eorne \amp, tmp, #0x7F // amp <- 0xffffff80 eorne \amp, tmp, #0x7F // amp <- 0xffffff80
.endm .endm

View File

@@ -497,14 +497,14 @@ void soundInit()
void soundFill() void soundFill()
{ {
if (curSoundBuffer == 1) { if (curSoundBuffer) {
REG_DMA1CNT = 0; REG_DMA1CNT = 0;
REG_DMA1SAD = (u32)soundBuffer; REG_DMA1SAD = (u32)soundBuffer;
REG_DMA1CNT = DMA_DST_FIXED | DMA_REPEAT | DMA_16 | DMA_AT_FIFO | DMA_ENABLE; REG_DMA1CNT = DMA_DST_FIXED | DMA_REPEAT | DMA_16 | DMA_AT_FIFO | DMA_ENABLE;
} }
sndFill(soundBuffer + curSoundBuffer * SND_SAMPLES, SND_SAMPLES); sndFill(soundBuffer + curSoundBuffer, SND_SAMPLES);
curSoundBuffer ^= 1; curSoundBuffer ^= SND_SAMPLES;
} }
void vblank() void vblank()