From b8dc25874948576430b80d801aae66cc983de52f Mon Sep 17 00:00:00 2001 From: Peter Ferrie Date: Thu, 9 Mar 2023 16:30:13 -0800 Subject: es5503.cpp: preserve fractional phase, allows high-freq sample play [Peter Ferrie] (#10973) --- src/devices/sound/es5503.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/devices/sound/es5503.cpp b/src/devices/sound/es5503.cpp index f460050df66..0141385ea7f 100644 --- a/src/devices/sound/es5503.cpp +++ b/src/devices/sound/es5503.cpp @@ -105,6 +105,7 @@ void es5503_device::halt_osc(int onum, int type, uint32_t *accumulator, int ress { uint16_t wtsize = pOsc->wtsize - 1; uint32_t altram = (*accumulator) >> resshift; + uint32_t fraction = (*accumulator) & ((1 << resshift) - 1); if (altram > wtsize) { @@ -115,7 +116,7 @@ void es5503_device::halt_osc(int onum, int type, uint32_t *accumulator, int ress altram = 0; } - *accumulator = altram << resshift; + *accumulator = (altram << resshift) + fraction; } // if we're in swap mode, start the partner @@ -135,6 +136,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; @@ -144,7 +146,7 @@ void es5503_device::halt_osc(int onum, int type, uint32_t *accumulator, int ress altram = 0; } - *accumulator = altram << resshift; + *accumulator = (altram << resshift) + fraction; } } // IRQ enabled for this voice? -- cgit v1.2.3