summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
author arbee <rb6502@users.noreply.github.com>2023-03-09 19:55:57 -0500
committer arbee <rb6502@users.noreply.github.com>2023-03-09 19:55:57 -0500
commit22aa30448f4f1c999b1c89339db284f91c14f50c (patch)
tree4eb1cb9e0c0ae62232d56522fa8e112f237833fe /src
parentb8dc25874948576430b80d801aae66cc983de52f (diff)
es5503: cleaner fix for preserving the full accumulator phase on looping. [Kelvin Sherlock, R. Belmont]
Diffstat (limited to 'src')
-rw-r--r--src/devices/sound/es5503.cpp27
1 files changed, 2 insertions, 25 deletions
diff --git a/src/devices/sound/es5503.cpp b/src/devices/sound/es5503.cpp
index 0141385ea7f..08b12f3512c 100644
--- a/src/devices/sound/es5503.cpp
+++ b/src/devices/sound/es5503.cpp
@@ -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?