This commit is contained in:
Zachary Hall 2024-10-16 10:34:33 -07:00
parent faaf5d1bf8
commit 299a85bfad

View file

@ -132,7 +132,6 @@ void ZsmBackend::tick(bool step) {
while (YM_read_status()) { while (YM_read_status()) {
size_t clocksToAddForYm = 64; size_t clocksToAddForYm = 64;
ticks_remaining -= clocksToAddForYm; ticks_remaining -= clocksToAddForYm;
prevCpuClocks += clocksToAddForYm;
if (ticks_remaining < 0) { if (ticks_remaining < 0) {
delayTicks -= 1; delayTicks -= 1;
nextCpuClocks += ClocksPerTick; nextCpuClocks += ClocksPerTick;
@ -211,7 +210,7 @@ void ZsmBackend::tick(bool step) {
size_t nextCpuClocksInt = std::floor(nextCpuClocks); size_t nextCpuClocksInt = std::floor(nextCpuClocks);
size_t prevCpuClocksInt = std::floor(prevCpuClocks); size_t prevCpuClocksInt = std::floor(prevCpuClocks);
size_t cpuClocksIntDelta = nextCpuClocksInt - prevCpuClocksInt; size_t cpuClocksIntDelta = nextCpuClocksInt - prevCpuClocksInt;
audio_step(cpuClocksIntDelta); audio_step(ticks_remaining);
cpuClocks = std::fmod(nextCpuClocks, ClocksPerTick); cpuClocks = std::fmod(nextCpuClocks, ClocksPerTick);
} }
size_t ZsmBackend::render(void *buf, size_t maxlen) { size_t ZsmBackend::render(void *buf, size_t maxlen) {