mirror of https://github.com/mgba-emu/mgba.git
GB Audio: Fix write behavior on channel 3
This commit is contained in:
parent
94ff4f7c4e
commit
ed94288902
|
@ -281,7 +281,8 @@ void GBAudioWriteNR34(struct GBAudio* audio, uint8_t value) {
|
|||
if (audio->nextEvent == INT_MAX) {
|
||||
audio->eventDiff = 0;
|
||||
}
|
||||
audio->nextCh3 = audio->eventDiff + audio->p->cpu->cycles + 2 + 2 * (2048 - audio->ch3.rate);
|
||||
// TODO: Where does this cycle delay come from?
|
||||
audio->nextCh3 = audio->eventDiff + audio->p->cpu->cycles + 4 + 2 * (2048 - audio->ch3.rate);
|
||||
audio->ch3.readable = false;
|
||||
audio->nextEvent = audio->p->cpu->cycles;
|
||||
if (audio->p) {
|
||||
|
|
|
@ -243,8 +243,10 @@ void GBIOWrite(struct GB* gb, unsigned address, uint8_t value) {
|
|||
case REG_WAVE_D:
|
||||
case REG_WAVE_E:
|
||||
case REG_WAVE_F:
|
||||
if (!gb->audio.playingCh3 || gb->audio.ch3.readable) {
|
||||
if (!gb->audio.playingCh3) {
|
||||
gb->audio.ch3.wavedata8[address - REG_WAVE_0] = value;
|
||||
} else if(gb->audio.ch3.readable) {
|
||||
gb->audio.ch3.wavedata8[gb->audio.ch3.window >> 1] = value;
|
||||
}
|
||||
break;
|
||||
case REG_JOYP:
|
||||
|
|
Loading…
Reference in New Issue