Mercurial > repos > blastem
changeset 1356:4d16c09210fd
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
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Thu, 11 May 2017 07:51:28 -0700 |
parents | 03cb4dd2499f |
children | 5ee19c72fa95 |
files | psg.c ym2612.c |
diffstat | 2 files changed, 2 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/psg.c Wed May 10 22:06:59 2017 -0700 +++ b/psg.c Thu May 11 07:51:28 2017 -0700 @@ -135,7 +135,7 @@ context->accum = tmp >> 16; context->buffer_fraction += context->buffer_inc; - if (context->buffer_fraction >= BUFFER_INC_RES) { + while (context->buffer_fraction >= BUFFER_INC_RES) { context->buffer_fraction -= BUFFER_INC_RES; int32_t tmp = context->last_sample * ((context->buffer_fraction << 16) / context->buffer_inc); tmp += context->accum * (0x10000 - ((context->buffer_fraction << 16) / context->buffer_inc));
--- a/ym2612.c Wed May 10 22:06:59 2017 -0700 +++ b/ym2612.c Thu May 11 07:51:28 2017 -0700 @@ -635,7 +635,7 @@ 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);