mirror of https://github.com/mgba-emu/mgba.git
GB Audio: Fix some channel 4 timing edge cases
This commit is contained in:
parent
47728c7a8d
commit
3ca82b64af
1
CHANGES
1
CHANGES
|
@ -29,6 +29,7 @@ Emulation fixes:
|
|||
- GB: Downgrade DMG-only ROMs from CGB mode even without boot ROM
|
||||
- GB: Fix marking BIOS as unmapped when skipping BIOS (fixes mgba.io/i/2061)
|
||||
- GB Audio: Fix serializing sweep time
|
||||
- GB Audio: Fix some channel 4 timing edge cases
|
||||
- GB MBC: Fix MBC1 mode changing behavior
|
||||
- GB MBC: Fix some MBC3 bit masking
|
||||
- GB Video: Fix state after skipping BIOS (fixes mgba.io/i/1715 and mgba.io/i/1716)
|
||||
|
|
|
@ -390,6 +390,7 @@ void GBAudioWriteNR44(struct GBAudio* audio, uint8_t value) {
|
|||
}
|
||||
}
|
||||
if (audio->playingCh4 && audio->ch4.envelope.dead != 2) {
|
||||
audio->ch4.lastEvent = mTimingCurrentTime(audio->timing);
|
||||
mTimingDeschedule(audio->timing, &audio->ch4Event);
|
||||
mTimingSchedule(audio->timing, &audio->ch4Event, 0);
|
||||
}
|
||||
|
@ -581,16 +582,18 @@ void GBAudioUpdateFrame(struct GBAudio* audio, struct mTiming* timing) {
|
|||
if (audio->playingCh4 && !audio->ch4.envelope.dead) {
|
||||
--audio->ch4.envelope.nextStep;
|
||||
if (audio->ch4.envelope.nextStep == 0) {
|
||||
int8_t sample = audio->ch4.sample > 0;
|
||||
audio->ch4.samples -= audio->ch4.sample;
|
||||
int8_t sample = audio->ch4.sample;
|
||||
_updateEnvelope(&audio->ch4.envelope);
|
||||
if (audio->ch4.envelope.dead == 2) {
|
||||
mTimingDeschedule(timing, &audio->ch4Event);
|
||||
}
|
||||
audio->ch4.sample = sample * audio->ch4.envelope.currentVolume;
|
||||
audio->ch4.sample = (sample > 0) * audio->ch4.envelope.currentVolume;
|
||||
if (audio->ch4.nSamples) {
|
||||
audio->ch4.samples -= sample;
|
||||
audio->ch4.samples += audio->ch4.sample;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue