es5503: cleaner fix for preserving the full accumulator phase on looping. [Kelvin Sherlock, R. Belmont]

This commit is contained in:
arbee 2023-03-09 19:55:57 -05:00
parent b8dc258749
commit 22aa30448f

View File

@ -104,19 +104,7 @@ void es5503_device::halt_osc(int onum, int type, uint32_t *accumulator, int ress
else // preserve the relative phase of the oscillator when looping
{
uint16_t wtsize = pOsc->wtsize - 1;
uint32_t altram = (*accumulator) >> resshift;
uint32_t fraction = (*accumulator) & ((1 << resshift) - 1);
if (altram > wtsize)
{
altram -= wtsize;
}
else
{
altram = 0;
}
*accumulator = (altram << resshift) + fraction;
*accumulator -= (wtsize << resshift);
}
// if we're in swap mode, start the partner
@ -135,18 +123,7 @@ void es5503_device::halt_osc(int onum, int type, uint32_t *accumulator, int ress
// preserve the phase in this case too
uint16_t wtsize = pOsc->wtsize - 1;
uint32_t altram = (*accumulator) >> resshift;
uint32_t fraction = (*accumulator) & ((1 << resshift) - 1);
if (altram > wtsize)
{
altram -= wtsize;
}
else
{
altram = 0;
}
*accumulator = (altram << resshift) + fraction;
*accumulator -= (wtsize << resshift);
}
}
// IRQ enabled for this voice?