Fix Freeboy noise channel playback (#4538)

Writing the enable bit to `FF23` causes the noise oscillator to start outputting samples and writing the other registers (including the one for the SRW value) during the time the oscillator is active has undefined behaviour.
In order for `GB_apu` to correctly generate samples when the LSFR width is
set to `7`, the trigger write to `0xff23` must happen after all other
writes.
This commit is contained in:
Ivo Wetzel
2018-08-16 05:05:50 +02:00
committed by Hyunjin Song
parent 2ecc8bb4fa
commit 0cddc469bc

View File

@@ -276,9 +276,6 @@ void papuInstrument::playNote( NotePlayHandle * _n,
data += m_ch4SweepStepLengthModel.value();
papu->write_register( 0xff21, data );
//channel 4 init
papu->write_register( 0xff23, 128 );
_n->m_pluginData = papu;
}
@@ -380,6 +377,10 @@ void papuInstrument::playNote( NotePlayHandle * _n,
data = data << 3;
data += ropt;
papu->write_register( 0xff22, data );
//channel 4 init
papu->write_register( 0xff23, 128 );
}
int const buf_size = 2048;