Reply 340 of 525, by Falcosoft
- Rank
- l33t
DracoNihil wrote on 2024-05-19, 06:37:Falcosoft wrote on 2024-05-19, 05:32:It seems to be case 3. The introduction of oversampling was final sample mixing related: https://github.com/nukeykt/Nuked-SC55/c […]
Rincewind42 wrote on 2024-05-19, 00:17:... 1. the hardware does 2x oversampling, so emulating this accurately is a must. 2. it's a Nuked-SC55 special, and the digital […]
...
1. the hardware does 2x oversampling, so emulating this accurately is a must.
2. it's a Nuked-SC55 special, and the digital circuit simulation is doing twice the work unnecessarily.
3. it's a Nuked-SC55 special, the digital circuit simulation runs at the correct 32k rate, then there's some extra interpolation/upsampling going on as a post-processing step.
...It seems to be case 3. The introduction of oversampling was final sample mixing related:
https://github.com/nukeykt/Nuked-SC55/commit/ … 00df21c6036039fIt's very easy to disable oversampling by modifying 2 places in code. And it has almost zero impact on performance. You can test it:
1. in pcm.cpp disabe this code fragment:if (pcm.config_reg_3c & 0x40) // oversampling
{
pcm.ram2[30][10] = shifter;
pcm.ram1[30][0] = pcm.accum_l & write_mask;
pcm.ram1[30][1] = pcm.accum_r & write_mask;
tt[0] = (int)((pcm.ram1[30][3] & ~write_mask) << 12);
tt[1] = (int)((pcm.ram1[30][5] & ~write_mask) << 12);
MCU_PostSample(tt);
}
2. In mcu.cpp change the line from
spec.freq = (mcu_mk1 || mcu_jv880) ? 64000 : 66207;
to
spec.freq = (mcu_mk1 || mcu_jv880) ? 32000 : 33103;
How exactly do you mean by disable that code fragment? When I try to remove that all it does is produce a emulator that immediately deadlocks to 100% CPU usage and doesn't respond to any signal other than SIGKILL.
I meant commenting out. Sorry, I have not tried it on latest master (I have tested it on a fork of mine that diverged from latest master earlier). On latest master you have to disable (I mean commenting out) also the following part in mcu.cpp (lines 1008-1010) in order no-oversampling code path to work.
// if (pcm.config_reg_3c & 0x40)
// sample_write_ptr &= ~3;
// else
sample_write_ptr &= ~1;
if (sample_read_ptr == sample_write_ptr)
{
MCU_WorkThread_Unlock();
while (sample_read_ptr == sample_write_ptr)
{
SDL_Delay(1);
}
MCU_WorkThread_Lock();
}