all repos — mgba @ 6364cabce3ff683c7557c8e622152b897ea87928

mGBA Game Boy Advance Emulator

GBA Audio: Default to emulated mixing for XCMD
Vicki Pfau vi@endrift.com
Sat, 18 May 2019 18:38:40 -0700
commit

6364cabce3ff683c7557c8e622152b897ea87928

parent

6fd97ce3de40a83a12c51622c58570dd7ecdd2e4

1 files changed, 8 insertions(+), 5 deletions(-)

jump to
M src/gba/extra/audio-mixer.csrc/gba/extra/audio-mixer.c

@@ -237,6 +237,10 @@ track->track.patternStack[2] = memory->load32(cpu, base + offsetof(struct GBAMP2kMusicPlayerTrack, patternStack[2]), 0);

} else { memset(&track->track, 0, sizeof(track->track)); } + if (track->track.runningStatus == 0xCD) { + // XCMD isn't supported + mixer->p->externalMixing = false; + } } }

@@ -253,9 +257,6 @@ return true;

} void _mp2kStep(struct GBAAudioMixer* mixer) { - if (!mixer->p->externalMixing) { - return; - } mixer->frame += mixer->p->sampleInterval; while (mixer->frame >= VIDEO_TOTAL_LENGTH / mixer->tempo) {

@@ -288,8 +289,10 @@ sample.left += value;

CircleBufferRead16(&mixer->activeTracks[track].buffer, &value); sample.right += value; } - blip_add_delta(mixer->p->psg.left, mixer->p->clock + i * interval, sample.left - mixer->last.left); - blip_add_delta(mixer->p->psg.right, mixer->p->clock + i * interval, sample.left - mixer->last.left); + if (mixer->p->externalMixing) { + blip_add_delta(mixer->p->psg.left, mixer->p->clock + i * interval, sample.left - mixer->last.left); + blip_add_delta(mixer->p->psg.right, mixer->p->clock + i * interval, sample.left - mixer->last.left); + } mixer->last = sample; } }