i was testing out the noise channel on my emulator using blarggs test_apu_timers/noise_pitch.nes test. the timer is right, all changes are at multiples of 0.00228 sec ( freq 15, look up table is 4068). the first few pulses are the same as test_apu_timers/noise_pitch.nes, but then its different like my shifter is not right.
then i looked at Nes_Snd_Emu-0.1.7/nes_apu/Nes_Oscs.cpp to see if i missed something with the shifter. blargg, if i read the code right ..
silenced:
if i am reading this right, you dont use the loop flag to determine the bit used, variable tap, when noise is silenced. i thought the timer would always clock the shift register, and the loop flag would always determine which bit is used.
above is the comment that says approximate. seems that it would be just as easy to do the same noise shifting for silenced or not silenced.
blargg, could you explain what you mean with "to do: precise muted noise cycling?"
if the noise pattern is 32767 bits long, then i should see that pattern in the wave, i tried to see if i could line up my output with the timer test, but found no match when shifted in time.
matt
then i looked at Nes_Snd_Emu-0.1.7/nes_apu/Nes_Oscs.cpp to see if i missed something with the shifter. blargg, if i read the code right ..
silenced:
Code:
// approximate noise cycling while muted, by shuffling up noise register
// to do: precise muted noise cycling?
if ( !(regs [2] & mode_flag) )
{
int feedback = (noise << 13) ^ (noise << 14);
noise = (feedback & 0x4000) | (noise >> 1);
}
not silenced// to do: precise muted noise cycling?
if ( !(regs [2] & mode_flag) )
{
int feedback = (noise << 13) ^ (noise << 14);
noise = (feedback & 0x4000) | (noise >> 1);
}
Code:
const int tap = (regs [2] & mode_flag ? 8 : 13);
do
{
int feedback = (noise << tap) ^ (noise << 14);
time += period;
if ( (noise + 1) & 2 ) {
// bits 0 and 1 of noise differ
delta = -delta;
synth.offset_resampled( rtime, delta, output );
}
rtime += rperiod;
noise = (feedback & 0x4000) | (noise >> 1);
}
while ( time < end_time );
do
{
int feedback = (noise << tap) ^ (noise << 14);
time += period;
if ( (noise + 1) & 2 ) {
// bits 0 and 1 of noise differ
delta = -delta;
synth.offset_resampled( rtime, delta, output );
}
rtime += rperiod;
noise = (feedback & 0x4000) | (noise >> 1);
}
while ( time < end_time );
if i am reading this right, you dont use the loop flag to determine the bit used, variable tap, when noise is silenced. i thought the timer would always clock the shift register, and the loop flag would always determine which bit is used.
above is the comment that says approximate. seems that it would be just as easy to do the same noise shifting for silenced or not silenced.
blargg, could you explain what you mean with "to do: precise muted noise cycling?"
if the noise pattern is 32767 bits long, then i should see that pattern in the wave, i tried to see if i could line up my output with the timer test, but found no match when shifted in time.
matt