If you have an issue with any of our projects. feel free to register.

Commit 5fbf722f authored by Christopher Snowhill's avatar Christopher Snowhill

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

parent b7487e2a
......@@ -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;
......
......@@ -45,7 +45,6 @@ private:
int delay;
Blip_Buffer* output;
short last_amp;
short wave_pos;
};
Namco_Osc oscs [osc_count];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment