diff options
author | Michael Pavone <pavone@retrodev.com> | 2017-05-11 07:51:28 -0700 |
---|---|---|
committer | Michael Pavone <pavone@retrodev.com> | 2017-05-11 07:51:28 -0700 |
commit | fa813fc755c00d298abd83d7e63690bed5b38fe6 (patch) | |
tree | 83e561232dba5eca147ee4d2b85206a0eaf2bb5c /psg.c | |
parent | c3c18ab355b4b42f7a5689c35e8cf6de60706bd0 (diff) |
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
Diffstat (limited to 'psg.c')
-rw-r--r-- | psg.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -135,7 +135,7 @@ void psg_run(psg_context * context, uint32_t cycles) 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)); |