History

oscmorph tweaks

Paul Batchelor committed 6 years ago

Commit 96de5811 parent 6a7c3841 file · +12 −4Browse files

Showing the changes to modules (1 of 1 file). Show all

Unified · Split

modules/oscmorph.c+12−4
@@ -1,3 +1,5 @@
1+/* This code is placed in the public domain */
2+
13 #include <stdlib.h>
24 #include <math.h>
35 #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
2628 osc->wtpos = 0.0;
2729 osc->nft = nft;
2830 uint32_t prev = (uint32_t)ft[0]->size;
31+
2932 for (i = 0; i < nft; i++) {
3033 if (prev != ft[i]->size) {
3134 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
4245 SPFLOAT amp, cps, fract, v1, v2;
4346 SPFLOAT *ft1, *ft2;
4447 int32_t phs, lobits, pos;
45− SPFLOAT sicvt = osc->tbl[0]->sicvt;
48+ SPFLOAT sicvt;
49+ SPFLOAT findex;
50+ int index;
51+ SPFLOAT wtfrac;
4652
4753 /* Use only the fractional part of the position or 1 */
4854 if (osc->wtpos > 1.0) {
4955 osc->wtpos -= (int)osc->wtpos;
5056 }
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);
5462
5563 lobits = osc->tbl[0]->lobits;
5664 amp = osc->amp;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t