Skip to content

Commit

Permalink
#368 GBA sound buffer switch optimization (one MUL, minor)
Browse files Browse the repository at this point in the history
  • Loading branch information
XProger committed Nov 28, 2022
1 parent 590c7cf commit 0d8cae5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/platform/gba/asm/sndPCM.s
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ tmp .req ampA
.macro clamp amp
// Vanadium's clamp trick (-128..127)
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
.endm

Expand Down
6 changes: 3 additions & 3 deletions src/platform/gba/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -497,14 +497,14 @@ void soundInit()

void soundFill()
{
if (curSoundBuffer == 1) {
if (curSoundBuffer) {
REG_DMA1CNT = 0;
REG_DMA1SAD = (u32)soundBuffer;
REG_DMA1CNT = DMA_DST_FIXED | DMA_REPEAT | DMA_16 | DMA_AT_FIFO | DMA_ENABLE;
}

sndFill(soundBuffer + curSoundBuffer * SND_SAMPLES, SND_SAMPLES);
curSoundBuffer ^= 1;
sndFill(soundBuffer + curSoundBuffer, SND_SAMPLES);
curSoundBuffer ^= SND_SAMPLES;
}

void vblank()
Expand Down

0 comments on commit 0d8cae5

Please sign in to comment.