From fa813fc755c00d298abd83d7e63690bed5b38fe6 Mon Sep 17 00:00:00 2001 From: Michael Pavone Date: Thu, 11 May 2017 07:51:28 -0700 Subject: Fix resampling code to deal with case in which output frequency is greater than the input frequency. Probably could stand to be improved, but at least it doesn't cause the emulator to deadlock --- ym2612.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ym2612.c') diff --git a/ym2612.c b/ym2612.c index 634d1e5..7049740 100644 --- a/ym2612.c +++ b/ym2612.c @@ -635,7 +635,7 @@ void ym_run(ym2612_context * context, uint32_t to_cycle) left = tmp >> 16; tmp = right * context->lowpass_alpha + context->last_right * (0x10000 - context->lowpass_alpha); right = tmp >> 16; - if (context->buffer_fraction > BUFFER_INC_RES) { + while (context->buffer_fraction > BUFFER_INC_RES) { context->buffer_fraction -= BUFFER_INC_RES; int64_t tmp = context->last_left * ((context->buffer_fraction << 16) / context->buffer_inc); -- cgit v1.2.3