Showing the changes to modules (1 of 1 file). Show all
Unified · Split
| @@ -1,3 +1,5 @@ | ||
| 1 | +/* This code is placed in the public domain */ | |
| 2 | + | |
| 1 | 3 | #include <stdlib.h> |
| 2 | 4 | #include <math.h> |
| 3 | 5 | #include "soundpipe.h" |
| @@ -26,6 +28,7 @@ int sp_oscmorph_init(sp_data *sp, sp_oscmorph *osc, sp_ftbl **ft, int nft, SPFLO · 22 unmodified lines | ||
| 26 | 28 | osc->wtpos = 0.0; |
| 27 | 29 | osc->nft = nft; |
| 28 | 30 | uint32_t prev = (uint32_t)ft[0]->size; |
| 31 | + | |
| 29 | 32 | for (i = 0; i < nft; i++) { |
| 30 | 33 | if (prev != ft[i]->size) { |
| 31 | 34 | fprintf(stderr, "sp_oscmorph: size mismatch\n"); |
| @@ -42,15 +45,20 @@ int sp_oscmorph_compute(sp_data *sp, sp_oscmorph *osc, SPFLOAT *in, SPFLOAT *out · 10 unmodified lines | ||
| 42 | 45 | SPFLOAT amp, cps, fract, v1, v2; |
| 43 | 46 | SPFLOAT *ft1, *ft2; |
| 44 | 47 | int32_t phs, lobits, pos; |
| 45 | − SPFLOAT sicvt = osc->tbl[0]->sicvt; | |
| 48 | + SPFLOAT sicvt; | |
| 49 | + SPFLOAT findex; | |
| 50 | + int index; | |
| 51 | + SPFLOAT wtfrac; | |
| 46 | 52 | |
| 47 | 53 | /* Use only the fractional part of the position or 1 */ |
| 48 | 54 | if (osc->wtpos > 1.0) { |
| 49 | 55 | osc->wtpos -= (int)osc->wtpos; |
| 50 | 56 | } |
| 51 | − SPFLOAT findex = osc->wtpos * (osc->nft - 1); | |
| 52 | − int index = floor(findex); | |
| 53 | − SPFLOAT wtfrac = findex - index; | |
| 57 | + | |
| 58 | + sicvt = osc->tbl[0]->sicvt; | |
| 59 | + findex = osc->wtpos * (osc->nft - 1); | |
| 60 | + wtfrac = findex - index; | |
| 61 | + index = floor(findex); | |
| 54 | 62 | |
| 55 | 63 | lobits = osc->tbl[0]->lobits; |
| 56 | 64 | amp = osc->amp; |