Browse Source

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

master
parent
commit
5fbf722f29
2 changed files with 4 additions and 8 deletions
  1. +4
    -7
      Frameworks/GME/gme/Nes_Namco_Apu.cpp
  2. +0
    -1
      Frameworks/GME/gme/Nes_Namco_Apu.h

+ 4
- 7
Frameworks/GME/gme/Nes_Namco_Apu.cpp 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;


+ 0
- 1
Frameworks/GME/gme/Nes_Namco_Apu.h View File

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


Loading…
Cancel
Save