ref: 96de5819111e6f89e310981e49fa52e8b9cae653
parent: 6a7c384764bf6d69450037b1fb2ff3dd96b5e81c
author: Paul Batchelor <thisispaulbatchelor@gmail.com>
date: Thu Oct 8 07:28:51 EDT 2020
oscmorph tweaks
--- a/modules/oscmorph.c
+++ b/modules/oscmorph.c
@@ -1,3 +1,5 @@
+/* This code is placed in the public domain */
+
#include <stdlib.h>
#include <math.h>
#include "soundpipe.h"
@@ -26,6 +28,7 @@
osc->wtpos = 0.0;
osc->nft = nft;
uint32_t prev = (uint32_t)ft[0]->size;
+
for (i = 0; i < nft; i++) {
if (prev != ft[i]->size) {
fprintf(stderr, "sp_oscmorph: size mismatch\n");
@@ -42,15 +45,20 @@
SPFLOAT amp, cps, fract, v1, v2;
SPFLOAT *ft1, *ft2;
int32_t phs, lobits, pos;
- SPFLOAT sicvt = osc->tbl[0]->sicvt;
+ SPFLOAT sicvt;
+ SPFLOAT findex;
+ int index;
+ SPFLOAT wtfrac;
/* Use only the fractional part of the position or 1 */
if (osc->wtpos > 1.0) {
osc->wtpos -= (int)osc->wtpos;
}
- SPFLOAT findex = osc->wtpos * (osc->nft - 1);
- int index = floor(findex);
- SPFLOAT wtfrac = findex - index;
+
+ sicvt = osc->tbl[0]->sicvt;
+ findex = osc->wtpos * (osc->nft - 1);
+ wtfrac = findex - index;
+ index = floor(findex);
lobits = osc->tbl[0]->lobits;
amp = osc->amp;