Fix NSF player to support N163 waveform lengths like the real thing

CQTexperiment
Christopher Snowhill 2020-03-24 01:11:02 -07:00
parent b7487e2ad2
commit 5fbf722f29
2 changed files with 4 additions and 8 deletions

View File

@ -36,7 +36,6 @@ void Nes_Namco_Apu::reset()
Namco_Osc& osc = oscs [i];
osc.delay = 0;
osc.last_amp = 0;
osc.wave_pos = 0;
}
}
@ -109,19 +108,17 @@ void Nes_Namco_Apu::run_until( blip_time_t nes_end_time )
blip_resampled_time_t period =
output->resampled_duration( lowest_freq_period / 8 ) / freq * 8 * active_oscs;
int wave_size = 32 - (osc_reg [4] >> 2 & 7) * 4;
if ( !wave_size )
continue;
int wave_size = 256 - (osc_reg [4] & 0xFC);
int last_amp = osc.last_amp;
int wave_pos = osc.wave_pos;
int wave_pos = osc_reg [5] % wave_size;
output->set_modified();
do
{
// read wave sample
int addr = wave_pos + osc_reg [6];
int addr = (wave_pos + osc_reg [6]) & 0xFF;
int sample = reg [addr >> 1] >> (addr << 2 & 4);
wave_pos++;
sample = (sample & 15) * volume;
@ -141,7 +138,7 @@ void Nes_Namco_Apu::run_until( blip_time_t nes_end_time )
}
while ( time < end_time );
osc.wave_pos = wave_pos;
((BOOST::uint8_t*)osc_reg)[5] = wave_pos;
osc.last_amp = last_amp;
}
osc.delay = time - end_time;

View File

@ -45,7 +45,6 @@ private:
int delay;
Blip_Buffer* output;
short last_amp;
short wave_pos;
};
Namco_Osc oscs [osc_count];