all repos — mgba @ f600c7c317fcf374cc3f82beb5d0205849dfa749

mGBA Game Boy Advance Emulator

GB Audio: Remove redundant timing argument to GBAudioUpdateFrame
Vicki Pfau vi@endrift.com
Mon, 15 Mar 2021 21:39:27 -0700
commit

f600c7c317fcf374cc3f82beb5d0205849dfa749

parent

3ca82b64afa0ffd66fba1f0facb3b82176fa4381

3 files changed, 12 insertions(+), 12 deletions(-)

jump to
M include/mgba/internal/gb/audio.hinclude/mgba/internal/gb/audio.h

@@ -239,7 +239,7 @@ void GBAudioWriteNR50(struct GBAudio* audio, uint8_t);

void GBAudioWriteNR51(struct GBAudio* audio, uint8_t); void GBAudioWriteNR52(struct GBAudio* audio, uint8_t); -void GBAudioUpdateFrame(struct GBAudio* audio, struct mTiming* timing); +void GBAudioUpdateFrame(struct GBAudio* audio); void GBAudioSamplePSG(struct GBAudio* audio, int16_t* left, int16_t* right);
M src/gb/audio.csrc/gb/audio.c

@@ -486,13 +486,13 @@ }

void _updateFrame(struct mTiming* timing, void* user, uint32_t cyclesLate) { struct GBAudio* audio = user; - GBAudioUpdateFrame(audio, timing); + GBAudioUpdateFrame(audio); if (audio->style == GB_AUDIO_GBA) { mTimingSchedule(timing, &audio->frameEvent, audio->timingFactor * FRAME_CYCLES - cyclesLate); } } -void GBAudioUpdateFrame(struct GBAudio* audio, struct mTiming* timing) { +void GBAudioUpdateFrame(struct GBAudio* audio) { if (!audio->enable) { return; }

@@ -523,7 +523,7 @@ case 4:

if (audio->ch1.control.length && audio->ch1.control.stop) { --audio->ch1.control.length; if (audio->ch1.control.length == 0) { - mTimingDeschedule(timing, &audio->ch1Event); + mTimingDeschedule(audio->timing, &audio->ch1Event); audio->playingCh1 = 0; *audio->nr52 &= ~0x0001; }

@@ -532,7 +532,7 @@

if (audio->ch2.control.length && audio->ch2.control.stop) { --audio->ch2.control.length; if (audio->ch2.control.length == 0) { - mTimingDeschedule(timing, &audio->ch2Event); + mTimingDeschedule(audio->timing, &audio->ch2Event); audio->playingCh2 = 0; *audio->nr52 &= ~0x0002; }

@@ -541,7 +541,7 @@

if (audio->ch3.length && audio->ch3.stop) { --audio->ch3.length; if (audio->ch3.length == 0) { - mTimingDeschedule(timing, &audio->ch3Event); + mTimingDeschedule(audio->timing, &audio->ch3Event); audio->playingCh3 = 0; *audio->nr52 &= ~0x0004; }

@@ -550,7 +550,7 @@

if (audio->ch4.length && audio->ch4.stop) { --audio->ch4.length; if (audio->ch4.length == 0) { - mTimingDeschedule(timing, &audio->ch4Event); + mTimingDeschedule(audio->timing, &audio->ch4Event); audio->playingCh4 = 0; *audio->nr52 &= ~0x0008; }

@@ -562,7 +562,7 @@ --audio->ch1.envelope.nextStep;

if (audio->ch1.envelope.nextStep == 0) { _updateEnvelope(&audio->ch1.envelope); if (audio->ch1.envelope.dead == 2) { - mTimingDeschedule(timing, &audio->ch1Event); + mTimingDeschedule(audio->timing, &audio->ch1Event); } _updateSquareSample(&audio->ch1); }

@@ -573,7 +573,7 @@ --audio->ch2.envelope.nextStep;

if (audio->ch2.envelope.nextStep == 0) { _updateEnvelope(&audio->ch2.envelope); if (audio->ch2.envelope.dead == 2) { - mTimingDeschedule(timing, &audio->ch2Event); + mTimingDeschedule(audio->timing, &audio->ch2Event); } _updateSquareSample(&audio->ch2); }

@@ -585,7 +585,7 @@ if (audio->ch4.envelope.nextStep == 0) {

int8_t sample = audio->ch4.sample; _updateEnvelope(&audio->ch4.envelope); if (audio->ch4.envelope.dead == 2) { - mTimingDeschedule(timing, &audio->ch4Event); + mTimingDeschedule(audio->timing, &audio->ch4Event); } audio->ch4.sample = (sample > 0) * audio->ch4.envelope.currentVolume; if (audio->ch4.nSamples) {
M src/gb/timer.csrc/gb/timer.c

@@ -33,7 +33,7 @@ }

} unsigned timingFactor = 0x1FF; if ((timer->internalDiv & timingFactor) == timingFactor) { - GBAudioUpdateFrame(&timer->p->audio, &timer->p->timing); + GBAudioUpdateFrame(&timer->p->audio); } ++timer->internalDiv; timer->p->memory.io[GB_REG_DIV] = timer->internalDiv >> 4;

@@ -83,7 +83,7 @@ mTimingSchedule(&timer->p->timing, &timer->irq, (7 - (timer->p->cpu->executionState & 3)) * tMultiplier);

} } if (timer->internalDiv & 0x200) { - GBAudioUpdateFrame(&timer->p->audio, &timer->p->timing); + GBAudioUpdateFrame(&timer->p->audio); } timer->p->memory.io[GB_REG_DIV] = 0; timer->internalDiv = 0;