Unified · Split
| @@ -69,15 +69,15 @@ · 68 unmodified lines | ||
| 69 | 69 | #if defined(GOOD_TRIG) |
| 70 | 70 | #define FHT_SWAP(a,b,t) {(t)=(a);(a)=(b);(b)=(t);} |
| 71 | 71 | #define TRIG_VARS \ |
| 72 | − int t_lam=0; | |
| 72 | + int t_lam=0; USED(t_lam); | |
| 73 | 73 | #define TRIG_INIT(k,c,s) \ |
| 74 | 74 | { \ |
| 75 | 75 | int i; \ |
| 76 | 76 | for (i=2 ; i<=k ; i++) \ |
| 77 | 77 | {coswrk[i]=costab[i];sinwrk[i]=sintab[i];} \ |
| 78 | 78 | t_lam = 0; \ |
| 79 | − c = 1; \ | |
| 80 | − s = 0; \ | |
| 79 | + c = 1; USED(c); \ | |
| 80 | + s = 0; USED(s); \ | |
| 81 | 81 | } |
| 82 | 82 | #define TRIG_NEXT(k,c,s) \ |
| 83 | 83 | { \ |
Empty file added.
Empty file added.
| @@ -0,0 +1,73 @@ | ||
| 1 | +#include <stdio.h> | |
| 2 | + | |
| 3 | +int | |
| 4 | +isinf(double d) | |
| 5 | +{ | |
| 6 | + if(isInf(d, 0) == 0) | |
| 7 | + return 0; | |
| 8 | + | |
| 9 | + return isInf(d, -1) ? -1 : 1; | |
| 10 | +} | |
| 11 | + | |
| 12 | +int | |
| 13 | +lrintf(float f) | |
| 14 | +{ | |
| 15 | + int i; | |
| 16 | + | |
| 17 | + *((float*)&i) = f + 12582912.0f; | |
| 18 | + | |
| 19 | + return (i & 0x7fffff) - 0x400000; | |
| 20 | +} | |
| 21 | + | |
| 22 | +#define ln2o1 1.4426950408889634073599 | |
| 23 | +#define hugeF 3.4028234e+38 | |
| 24 | +#define hugeD 1.79769313486231e+308 | |
| 25 | + | |
| 26 | +double | |
| 27 | +log2(double x) | |
| 28 | +{ | |
| 29 | + if(x == 0) | |
| 30 | + return -hugeD; | |
| 31 | + if(x < 0 || isNaN(x)) | |
| 32 | + return NaN(); | |
| 33 | + | |
| 34 | + return log(x)*ln2o1; | |
| 35 | +} | |
| 36 | + | |
| 37 | +float | |
| 38 | +log2f(float x) | |
| 39 | +{ | |
| 40 | + if(x == 0) | |
| 41 | + return -hugeF; | |
| 42 | + | |
| 43 | + return log2(x); | |
| 44 | +} | |
| 45 | + | |
| 46 | +/* taken from musl */ | |
| 47 | +#define dbleps 2.2204460492503131e-16 | |
| 48 | +static double toint = 1.0/dbleps; | |
| 49 | +double | |
| 50 | +round(double x) | |
| 51 | +{ | |
| 52 | + union {double f; u64int i;} u = {x}; | |
| 53 | + int e = u.i >> 52 & 0x7ff; | |
| 54 | + double y; | |
| 55 | + | |
| 56 | + if(e >= 0x3ff+52) | |
| 57 | + return x; | |
| 58 | + if(u.i >> 63) | |
| 59 | + x = -x; | |
| 60 | + if(e < 0x3ff-1) | |
| 61 | + return 0*u.f; | |
| 62 | + y = x + toint - toint - x; | |
| 63 | + if(y > 0.5) | |
| 64 | + y = y + x - 1; | |
| 65 | + else if(y <= -0.5) | |
| 66 | + y = y + x + 1; | |
| 67 | + else | |
| 68 | + y = y + x; | |
| 69 | + if(u.i >> 63) | |
| 70 | + y = -y; | |
| 71 | + | |
| 72 | + return y; | |
| 73 | +} | |
Empty file added.
Empty file added.
| @@ -0,0 +1,55 @@ | ||
| 1 | +#ifndef _plan9_stdio_h_ | |
| 2 | +#define _plan9_stdio_h_ | |
| 3 | + | |
| 4 | +#include <u.h> | |
| 5 | +#include <libc.h> | |
| 6 | +#include </sys/include/stdio.h> | |
| 7 | + | |
| 8 | +#define cosf cos | |
| 9 | +#define sinf sin | |
| 10 | +#define expf exp | |
| 11 | +#define logf log | |
| 12 | +#define powf pow | |
| 13 | +#define tanf tan | |
| 14 | +#define fmodf fmod | |
| 15 | +#define sqrtf sqrt | |
| 16 | +#define isnan isNaN | |
| 17 | +#define acosf acos | |
| 18 | +#define atanf atan | |
| 19 | +#define atan2f atan2 | |
| 20 | +#define tanhf tanh | |
| 21 | +#define fabsf fabs | |
| 22 | +#define roundf round | |
| 23 | +#define frexpf frexp | |
| 24 | +#define log10f log10 | |
| 25 | + | |
| 26 | +#define fmax(a,b) ((a)>(b)?(a):(b)) | |
| 27 | +#define fmin(a,b) ((a)<(b)?(a):(b)) | |
| 28 | +#define fmaxf fmax | |
| 29 | +#define fminf fmin | |
| 30 | + | |
| 31 | +#define isfinite(x) (!isinf(x)) | |
| 32 | + | |
| 33 | +typedef usize size_t; | |
| 34 | +typedef u8int uint8_t; | |
| 35 | +typedef s8int int8_t; | |
| 36 | +typedef u16int uint16_t; | |
| 37 | +typedef s16int int16_t; | |
| 38 | +typedef u32int uint32_t; | |
| 39 | +typedef s32int int32_t; | |
| 40 | +typedef u64int uint64_t; | |
| 41 | +typedef uintptr uintptr_t; | |
| 42 | + | |
| 43 | +#define CHAR_BIT 8 | |
| 44 | +#define INT_MAX 0x7fffffff | |
| 45 | +#define INT_MIN (-INT_MAX-1) | |
| 46 | +#define UINT_MAX 0xffffffffU | |
| 47 | +#define UINT16_MAX 0xffff | |
| 48 | + | |
| 49 | +int isinf(double d); | |
| 50 | +int lrintf(float f); | |
| 51 | +double log2(double x); | |
| 52 | +float log2f(float x); | |
| 53 | +double round(double x); | |
| 54 | + | |
| 55 | +#endif | |
Empty file added.
Empty file added.
| @@ -36,7 +36,9 @@ extern "C" { · 35 unmodified lines | ||
| 36 | 36 | #define SQRT8 2.82842712475f |
| 37 | 37 | #define LEAF_SQRT2 1.41421356237f |
| 38 | 38 | #define WSCALE 1.30612244898f |
| 39 | +#ifndef PI | |
| 39 | 40 | #define PI (3.14159265358979f) |
| 41 | +#endif | |
| 40 | 42 | #define TWO_PI (6.28318530717958f) |
| 41 | 43 | #define HALF_PI (1.570796326794897f) |
| 42 | 44 | |
| @@ -124,7 +124,7 @@ float tZeroCrossingCounter_tick (tZeroCrossingCounter* const zc, float · 123 unmodified lines | ||
| 124 | 124 | |
| 125 | 125 | z->inBuffer[z->position] = input; |
| 126 | 126 | int futurePosition = ((z->position + 1) % z->currentWindowSize); |
| 127 | − float output = 0.0f; | |
| 127 | + float output; | |
| 128 | 128 | |
| 129 | 129 | //add new value to count |
| 130 | 130 | if ((z->inBuffer[z->position] * z->inBuffer[z->prevPosition]) < 0.0f) |
| @@ -438,7 +438,7 @@ static void atkdtk_envelope(tAttackDetection* const ad, float *in) · 307 unmodified lines | ||
| 438 | 438 | { |
| 439 | 439 | _tAttackDetection* a = *ad; |
| 440 | 440 | |
| 441 | − int i = 0; | |
| 441 | + int i; | |
| 442 | 442 | float tmp; |
| 443 | 443 | for(i = 0; i < a->blockSize; ++i){ |
| 444 | 444 | tmp = fastabsf(in[i]); |
| @@ -1124,7 +1124,7 @@ int tZeroCrossingCollector_getState(tZeroCrossingCollector* const zc) · 679 unmodified lines | ||
| 1124 | 1124 | return z->_state; |
| 1125 | 1125 | } |
| 1126 | 1126 | |
| 1127 | −tZeroCrossingInfo const tZeroCrossingCollector_getCrossing(tZeroCrossingCollector* const zc, int index) | |
| 1127 | +tZeroCrossingInfo tZeroCrossingCollector_getCrossing(tZeroCrossingCollector* const zc, int index) | |
| 1128 | 1128 | { |
| 1129 | 1129 | _tZeroCrossingCollector* z = *zc; |
| 1130 | 1130 | |
| @@ -1487,7 +1487,7 @@ int tBACF_getCorrelation (tBACF* const bacf, int pos) · 356 unmodified lines | ||
| 1487 | 1487 | #elif _MSC_VER |
| 1488 | 1488 | count += __popcnt(*p1++ ^ v++); |
| 1489 | 1489 | #else |
| 1490 | − count += popcount(*p1++ ^ v++); | |
| 1490 | + count += popcount(*p1++ ^ v++); USED(count); USED(v); | |
| 1491 | 1491 | #endif |
| 1492 | 1492 | } |
| 1493 | 1493 | } |
| @@ -1675,7 +1675,7 @@ void tPeriodDetector_setHysteresis (tPeriodDetector* const detector, float · 181 unmodified lines | ||
| 1675 | 1675 | { |
| 1676 | 1676 | _tPeriodDetector* p = *detector; |
| 1677 | 1677 | |
| 1678 | − return tZeroCrossingCollector_setHysteresis(&p->_zc, hysteresis); | |
| 1678 | + tZeroCrossingCollector_setHysteresis(&p->_zc, hysteresis); | |
| 1679 | 1679 | } |
| 1680 | 1680 | |
| 1681 | 1681 | void tPeriodDetector_setSampleRate (tPeriodDetector* const detector, float sr) |
| @@ -2196,7 +2196,7 @@ int tDualPitchDetector_tick (tDualPitchDetector* const detector, float sa · 514 unmodified lines | ||
| 2196 | 2196 | if (ready) |
| 2197 | 2197 | { |
| 2198 | 2198 | int pd2_indeterminate = tPitchDetector_indeterminate(&p->_pd2); |
| 2199 | − int disagreement = 0; | |
| 2199 | + int disagreement; | |
| 2200 | 2200 | float period = tPeriodDetection_getPeriod(&p->_pd1); |
| 2201 | 2201 | if (!pd2_indeterminate && period != 0.0f) |
| 2202 | 2202 | { |
| @@ -513,7 +513,7 @@ float tLockhartWavefolder_tick(tLockhartWavefolder* const wf, float in) · 512 unmodified lines | ||
| 513 | 513 | { |
| 514 | 514 | _tLockhartWavefolder* w = *wf; |
| 515 | 515 | |
| 516 | − float out = 0.0f; | |
| 516 | + float out; | |
| 517 | 517 | |
| 518 | 518 | // Compute Antiderivative |
| 519 | 519 | w->l = (in > 0.0) - (in < 0.0); |
| @@ -86,7 +86,7 @@ float tCompressor_tick(tCompressor* const comp, float in) · 85 unmodified lines | ||
| 86 | 86 | float slope, overshoot; |
| 87 | 87 | |
| 88 | 88 | float in_db = LEAF_clip(-90.0f, fasteratodb(fastabsf(in)), 0.0f); |
| 89 | − float out_db = 0.0f; | |
| 89 | + float out_db; | |
| 90 | 90 | |
| 91 | 91 | c->y_T[1] = c->y_T[0]; |
| 92 | 92 | |
| @@ -149,7 +149,6 @@ void tTalkbox_warpedAutocorrelate(float * x, double* dl, double* Rt, unsigned in · 148 unmodified lines | ||
| 149 | 149 | Rt[0]=0; |
| 150 | 150 | r1=0; |
| 151 | 151 | r2=0; |
| 152 | − r1t=0; | |
| 153 | 152 | for(uint32_t m=0; m<L;m++) |
| 154 | 153 | { |
| 155 | 154 | Rt[0] += (double)(x[m]) * (double)(x[m]); |
| @@ -243,7 +242,7 @@ float tTalkbox_tick(tTalkbox* const voc, float synth, float voice) · 87 unmodified lines | ||
| 243 | 242 | if(++p0 >= v->N) { tTalkbox_lpc(v->buf0, v->car0, v->dl, v->Rt, v->N, v->O, v->warpFactor, v->warpOn, v->k, v->freeze, &v->G); p0 = 0; } |
| 244 | 243 | |
| 245 | 244 | w = 1.0f - w; fx += v->buf1[p1] * w; v->buf1[p1] = x * w; |
| 246 | − if(++p1 >= v->N) { tTalkbox_lpc(v->buf1, v->car1, v->dl, v->Rt, v->N, v->O, v->warpFactor, v->warpOn, v->k, v->freeze, &v->G); p1 = 0; } | |
| 245 | + if(++p1 >= v->N) { tTalkbox_lpc(v->buf1, v->car1, v->dl, v->Rt, v->N, v->O, v->warpFactor, v->warpOn, v->k, v->freeze, &v->G); } | |
| 247 | 246 | } |
| 248 | 247 | |
| 249 | 248 | p = v->u0 + h0 * fx; v->u0 = v->u1; v->u1 = fx - h0 * p; |
| @@ -487,7 +486,6 @@ void tTalkboxFloat_warpedAutocorrelate(float * x, float* dl, float* Rt, unsigned · 237 unmodified lines | ||
| 487 | 486 | Rt[0]=0; |
| 488 | 487 | r1=0; |
| 489 | 488 | r2=0; |
| 490 | − r1t=0; | |
| 491 | 489 | for(uint32_t m=0; m<L;m++) |
| 492 | 490 | { |
| 493 | 491 | Rt[0] += (x[m]) * (x[m]); |
| @@ -582,7 +580,7 @@ float tTalkboxFloat_tick(tTalkboxFloat* const voc, float synth, float voice) · 88 unmodified lines | ||
| 582 | 580 | if(++p0 >= v->N) { tTalkboxFloat_lpc(v->buf0, v->car0, v->dl, v->Rt, v->N, v->O, v->warpFactor, v->warpOn, v->k, v->freeze, &v->G); p0 = 0; } |
| 583 | 581 | |
| 584 | 582 | w = 1.0f - w; fx += v->buf1[p1] * w; v->buf1[p1] = x * w; |
| 585 | − if(++p1 >= v->N) { tTalkboxFloat_lpc(v->buf1, v->car1, v->dl, v->Rt, v->N, v->O, v->warpFactor, v->warpOn, v->k, v->freeze, &v->G); p1 = 0; } | |
| 583 | + if(++p1 >= v->N) { tTalkboxFloat_lpc(v->buf1, v->car1, v->dl, v->Rt, v->N, v->O, v->warpFactor, v->warpOn, v->k, v->freeze, &v->G); } | |
| 586 | 584 | } |
| 587 | 585 | |
| 588 | 586 | p = v->u0 + h0 * fx; v->u0 = v->u1; v->u1 = fx - h0 * p; |
| @@ -826,7 +824,7 @@ float tVocoder_tick (tVocoder* const voc, float synth, float voice) · 237 unmodified lines | ||
| 826 | 824 | { |
| 827 | 825 | _tVocoder* v = *voc; |
| 828 | 826 | |
| 829 | − float a, b, o=0.0f, aa, bb, oo = v->kout, g = v->gain, ht = v->thru, hh = v->high, tmp; | |
| 827 | + float a, b, o, aa, bb, oo = v->kout, g = v->gain, ht = v->thru, hh = v->high, tmp; | |
| 830 | 828 | uint32_t i, k = v->kval, nb = v->nbnd; |
| 831 | 829 | |
| 832 | 830 | a = voice; //speech |
| @@ -940,7 +938,7 @@ float tRosenbergGlottalPulse_tick (tRosenbergGlottalPulse* const gp) · 107 unmodified lines | ||
| 940 | 938 | { |
| 941 | 939 | _tRosenbergGlottalPulse* g = *gp; |
| 942 | 940 | |
| 943 | − float output = 0.0f; | |
| 941 | + float output; | |
| 944 | 942 | |
| 945 | 943 | // Phasor increment |
| 946 | 944 | g->phase += g->inc; |
| @@ -969,7 +967,7 @@ float tRosenbergGlottalPulse_tickHQ (tRosenbergGlottalPulse* const g · 22 unmodified lines | ||
| 969 | 967 | { |
| 970 | 968 | _tRosenbergGlottalPulse* g = *gp; |
| 971 | 969 | |
| 972 | − float output = 0.0f; | |
| 970 | + float output; | |
| 973 | 971 | |
| 974 | 972 | // Phasor increment |
| 975 | 973 | g->phase += g->inc; |
| @@ -1518,7 +1516,7 @@ void tSimpleRetune_initToPool (tSimpleRetune* const rt, int numVoices, float min · 542 unmodified lines | ||
| 1518 | 1516 | tPitchShift_initToPool(&r->ps[i], &r->dp, r->bufSize, mp); |
| 1519 | 1517 | } |
| 1520 | 1518 | |
| 1521 | − r->shiftFunction = &tPitchShift_shiftBy; | |
| 1519 | + r->shiftFunction = tPitchShift_shiftBy; | |
| 1522 | 1520 | } |
| 1523 | 1521 | |
| 1524 | 1522 | void tSimpleRetune_free (tSimpleRetune* const rt) |
| @@ -1564,8 +1562,8 @@ void tSimpleRetune_setMode (tSimpleRetune* const rt, int mode) · 39 unmodified lines | ||
| 1564 | 1562 | { |
| 1565 | 1563 | _tSimpleRetune* r = *rt; |
| 1566 | 1564 | |
| 1567 | − if (mode > 0) r->shiftFunction = &tPitchShift_shiftTo; | |
| 1568 | − else r->shiftFunction = &tPitchShift_shiftBy; | |
| 1565 | + if (mode > 0) r->shiftFunction = tPitchShift_shiftTo; | |
| 1566 | + else r->shiftFunction = tPitchShift_shiftBy; | |
| 1569 | 1567 | } |
| 1570 | 1568 | |
| 1571 | 1569 | void tSimpleRetune_setNumVoices(tSimpleRetune* const rt, int numVoices) |
| @@ -1663,7 +1661,7 @@ void tRetune_initToPool (tRetune* const rt, int numVoices, float minInputFreq, f · 91 unmodified lines | ||
| 1663 | 1661 | r->outBuffers[i] = (float*) mpool_calloc(sizeof(float) * r->bufSize, m); |
| 1664 | 1662 | } |
| 1665 | 1663 | |
| 1666 | − r->shiftFunction = &tPitchShift_shiftBy; | |
| 1664 | + r->shiftFunction = tPitchShift_shiftBy; | |
| 1667 | 1665 | } |
| 1668 | 1666 | |
| 1669 | 1667 | void tRetune_free (tRetune* const rt) |
| @@ -1715,8 +1713,8 @@ void tRetune_setMode (tRetune* const rt, int mode) · 45 unmodified lines | ||
| 1715 | 1713 | { |
| 1716 | 1714 | _tRetune* r = *rt; |
| 1717 | 1715 | |
| 1718 | − if (mode > 0) r->shiftFunction = &tPitchShift_shiftTo; | |
| 1719 | − else r->shiftFunction = &tPitchShift_shiftBy; | |
| 1716 | + if (mode > 0) r->shiftFunction = tPitchShift_shiftTo; | |
| 1717 | + else r->shiftFunction = tPitchShift_shiftBy; | |
| 1720 | 1718 | } |
| 1721 | 1719 | |
| 1722 | 1720 | void tRetune_setPickiness (tRetune* const rt, float p) |
| @@ -71,45 +71,45 @@ static void wdf_init(tWDF* const wdf, WDFComponentType type, float value, tWDF* · 70 unmodified lines | ||
| 71 | 71 | r->port_resistance_up = r->value; |
| 72 | 72 | r->port_conductance_up = 1.0f / r->value; |
| 73 | 73 | |
| 74 | − r->get_port_resistance = &get_port_resistance_for_resistor; | |
| 75 | − r->get_reflected_wave_up = &get_reflected_wave_for_resistor; | |
| 76 | − r->set_incident_wave = &set_incident_wave_for_leaf; | |
| 74 | + r->get_port_resistance = get_port_resistance_for_resistor; | |
| 75 | + r->get_reflected_wave_up = get_reflected_wave_for_resistor; | |
| 76 | + r->set_incident_wave = set_incident_wave_for_leaf; | |
| 77 | 77 | } |
| 78 | 78 | else if (r->type == Capacitor) |
| 79 | 79 | { |
| 80 | 80 | r->port_conductance_up = r->sample_rate * 2.0f * r->value; |
| 81 | 81 | r->port_resistance_up = 1.0f / r->port_conductance_up; //based on trapezoidal discretization |
| 82 | 82 | |
| 83 | − r->get_port_resistance = &get_port_resistance_for_capacitor; | |
| 84 | − r->get_reflected_wave_up = &get_reflected_wave_for_capacitor; | |
| 85 | − r->set_incident_wave = &set_incident_wave_for_leaf; | |
| 83 | + r->get_port_resistance = get_port_resistance_for_capacitor; | |
| 84 | + r->get_reflected_wave_up = get_reflected_wave_for_capacitor; | |
| 85 | + r->set_incident_wave = set_incident_wave_for_leaf; | |
| 86 | 86 | } |
| 87 | 87 | else if (r->type == Inductor) |
| 88 | 88 | { |
| 89 | 89 | r->port_resistance_up = r->sample_rate * 2.0f * r->value; //based on trapezoidal discretization |
| 90 | 90 | r->port_conductance_up = 1.0f / r->port_resistance_up; |
| 91 | 91 | |
| 92 | − r->get_port_resistance = &get_port_resistance_for_inductor; | |
| 93 | − r->get_reflected_wave_up = &get_reflected_wave_for_capacitor; // same as capacitor | |
| 94 | − r->set_incident_wave = &set_incident_wave_for_leaf_inverted; | |
| 92 | + r->get_port_resistance = get_port_resistance_for_inductor; | |
| 93 | + r->get_reflected_wave_up = get_reflected_wave_for_capacitor; // same as capacitor | |
| 94 | + r->set_incident_wave = set_incident_wave_for_leaf_inverted; | |
| 95 | 95 | } |
| 96 | 96 | else if (r->type == ResistiveSource) |
| 97 | 97 | { |
| 98 | 98 | r->port_resistance_up = r->value; |
| 99 | 99 | r->port_conductance_up = 1.0f / r->port_resistance_up; |
| 100 | 100 | |
| 101 | − r->get_port_resistance = &get_port_resistance_for_resistive; | |
| 102 | − r->get_reflected_wave_up = &get_reflected_wave_for_resistive; | |
| 103 | − r->set_incident_wave = &set_incident_wave_for_leaf; | |
| 101 | + r->get_port_resistance = get_port_resistance_for_resistive; | |
| 102 | + r->get_reflected_wave_up = get_reflected_wave_for_resistive; | |
| 103 | + r->set_incident_wave = set_incident_wave_for_leaf; | |
| 104 | 104 | } |
| 105 | 105 | else if (r->type == Inverter) |
| 106 | 106 | { |
| 107 | 107 | r->port_resistance_up = tWDF_getPortResistance(r->child_left); |
| 108 | 108 | r->port_conductance_up = 1.0f / r->port_resistance_up; |
| 109 | 109 | |
| 110 | − r->get_port_resistance = &get_port_resistance_for_inverter; | |
| 111 | − r->get_reflected_wave_up = &get_reflected_wave_for_inverter; | |
| 112 | − r->set_incident_wave = &set_incident_wave_for_inverter; | |
| 110 | + r->get_port_resistance = get_port_resistance_for_inverter; | |
| 111 | + r->get_reflected_wave_up = get_reflected_wave_for_inverter; | |
| 112 | + r->set_incident_wave = set_incident_wave_for_inverter; | |
| 113 | 113 | } |
| 114 | 114 | else if (r->type == SeriesAdaptor) |
| 115 | 115 | { |
| @@ -121,9 +121,9 @@ static void wdf_init(tWDF* const wdf, WDFComponentType type, float value, tWDF* · 5 unmodified lines | ||
| 121 | 121 | r->port_conductance_right = 1.0f / r->port_resistance_right; |
| 122 | 122 | r->gamma_zero = 1.0f / (r->port_resistance_right + r->port_resistance_left); |
| 123 | 123 | |
| 124 | − r->get_port_resistance = &get_port_resistance_for_series; | |
| 125 | − r->get_reflected_wave_up = &get_reflected_wave_for_series; | |
| 126 | − r->set_incident_wave = &set_incident_wave_for_series; | |
| 124 | + r->get_port_resistance = get_port_resistance_for_series; | |
| 125 | + r->get_reflected_wave_up = get_reflected_wave_for_series; | |
| 126 | + r->set_incident_wave = set_incident_wave_for_series; | |
| 127 | 127 | } |
| 128 | 128 | else if (r->type == ParallelAdaptor) |
| 129 | 129 | { |
| @@ -135,33 +135,33 @@ static void wdf_init(tWDF* const wdf, WDFComponentType type, float value, tWDF* · 5 unmodified lines | ||
| 135 | 135 | r->port_conductance_right = 1.0f / r->port_resistance_right; |
| 136 | 136 | r->gamma_zero = 1.0f / (r->port_resistance_right + r->port_resistance_left); |
| 137 | 137 | |
| 138 | − r->get_port_resistance = &get_port_resistance_for_parallel; | |
| 139 | − r->get_reflected_wave_up = &get_reflected_wave_for_parallel; | |
| 140 | − r->set_incident_wave = &set_incident_wave_for_parallel; | |
| 138 | + r->get_port_resistance = get_port_resistance_for_parallel; | |
| 139 | + r->get_reflected_wave_up = get_reflected_wave_for_parallel; | |
| 140 | + r->set_incident_wave = set_incident_wave_for_parallel; | |
| 141 | 141 | } |
| 142 | 142 | else if (r->type == IdealSource) |
| 143 | 143 | { |
| 144 | 144 | r->port_resistance_up = tWDF_getPortResistance(child); |
| 145 | 145 | r->port_conductance_up = 1.0f / r->port_resistance_up; |
| 146 | 146 | |
| 147 | − r->get_reflected_wave_down = &get_reflected_wave_for_ideal; | |
| 148 | − r->get_port_resistance = &get_port_resistance_for_root; | |
| 147 | + r->get_reflected_wave_down = get_reflected_wave_for_ideal; | |
| 148 | + r->get_port_resistance = get_port_resistance_for_root; | |
| 149 | 149 | } |
| 150 | 150 | else if (r->type == Diode) |
| 151 | 151 | { |
| 152 | 152 | r->port_resistance_up = tWDF_getPortResistance(child); |
| 153 | 153 | r->port_conductance_up = 1.0f / r->port_resistance_up; |
| 154 | 154 | |
| 155 | − r->get_reflected_wave_down = &get_reflected_wave_for_diode; | |
| 156 | − r->get_port_resistance = &get_port_resistance_for_root; | |
| 155 | + r->get_reflected_wave_down = get_reflected_wave_for_diode; | |
| 156 | + r->get_port_resistance = get_port_resistance_for_root; | |
| 157 | 157 | } |
| 158 | 158 | else if (r->type == DiodePair) |
| 159 | 159 | { |
| 160 | 160 | r->port_resistance_up = tWDF_getPortResistance(child); |
| 161 | 161 | r->port_conductance_up = 1.0f / r->port_resistance_up; |
| 162 | 162 | |
| 163 | − r->get_reflected_wave_down = &get_reflected_wave_for_diode_pair; | |
| 164 | − r->get_port_resistance = &get_port_resistance_for_root; | |
| 163 | + r->get_reflected_wave_down = get_reflected_wave_for_diode_pair; | |
| 164 | + r->get_port_resistance = get_port_resistance_for_root; | |
| 165 | 165 | } |
| 166 | 166 | } |
| 167 | 167 | //WDF |
| @@ -381,12 +381,14 @@ static float get_port_resistance_for_root(tWDF* const wdf) · 213 unmodified lines | ||
| 381 | 381 | static void set_incident_wave_for_leaf(tWDF* const wdf, float incident_wave, float input) |
| 382 | 382 | { |
| 383 | 383 | _tWDF* r = *wdf; |
| 384 | + USED(input); | |
| 384 | 385 | r->incident_wave_up = incident_wave; |
| 385 | 386 | } |
| 386 | 387 | |
| 387 | 388 | static void set_incident_wave_for_leaf_inverted(tWDF* const wdf, float incident_wave, float input) |
| 388 | 389 | { |
| 389 | 390 | _tWDF* r = *wdf; |
| 391 | + USED(input); | |
| 390 | 392 | r->incident_wave_up = -1.0f * incident_wave; |
| 391 | 393 | } |
| 392 | 394 | |
| @@ -438,6 +440,7 @@ static float get_reflected_wave_for_resistor(tWDF* const wdf, float input) · 45 unmodified lines | ||
| 438 | 440 | { |
| 439 | 441 | _tWDF* r = *wdf; |
| 440 | 442 | r->reflected_wave_up = 0.0f; |
| 443 | + USED(input); | |
| 441 | 444 | return r->reflected_wave_up; |
| 442 | 445 | } |
| 443 | 446 | |
| @@ -445,6 +448,7 @@ static float get_reflected_wave_for_capacitor(tWDF* const wdf, float input) · 1 unmodified line | ||
| 445 | 448 | { |
| 446 | 449 | _tWDF* r = *wdf; |
| 447 | 450 | r->reflected_wave_up = r->incident_wave_up; |
| 451 | + USED(input); | |
| 448 | 452 | return r->reflected_wave_up; |
| 449 | 453 | } |
| 450 | 454 | |
| @@ -483,6 +487,7 @@ static float get_reflected_wave_for_parallel(tWDF* const wdf, float input) · 32 unmodified lines | ||
| 483 | 487 | |
| 484 | 488 | static float get_reflected_wave_for_ideal(tWDF* const wdf, float input, float incident_wave) |
| 485 | 489 | { |
| 490 | + USED(wdf); USED(input); | |
| 486 | 491 | return (2.0f * input) - incident_wave; |
| 487 | 492 | } |
| 488 | 493 | |
| @@ -528,6 +533,7 @@ static float get_reflected_wave_for_diode(tWDF* const wdf, float input, float in · 39 unmodified lines | ||
| 528 | 533 | |
| 529 | 534 | float a = incident_wave; |
| 530 | 535 | float r = n->port_resistance_up; |
| 536 | + USED(input); | |
| 531 | 537 | return a + 2.0f*r*Is_DIODE - 2.0f*VT_DIODE*lambertW(a, r, Is_DIODE, 1.0f/VT_DIODE); |
| 532 | 538 | } |
| 533 | 539 | |
| @@ -537,6 +543,7 @@ static float get_reflected_wave_for_diode_pair(tWDF* const wdf, float input, flo · 3 unmodified lines | ||
| 537 | 543 | |
| 538 | 544 | float a = incident_wave; |
| 539 | 545 | float sgn = 0.0f; |
| 546 | + USED(input); | |
| 540 | 547 | if (a > 0.0f) sgn = 1.0f; |
| 541 | 548 | else if (a < 0.0f) sgn = -1.0f; |
| 542 | 549 | float r = n->port_resistance_up; |
| @@ -84,7 +84,7 @@ float t808Cowbell_tick(t808Cowbell* const cowbellInst) · 83 unmodified lines | ||
| 84 | 84 | { |
| 85 | 85 | _t808Cowbell* cowbell = *cowbellInst; |
| 86 | 86 | |
| 87 | − float sample = 0.0f; | |
| 87 | + float sample; | |
| 88 | 88 | |
| 89 | 89 | // Mix oscillators. |
| 90 | 90 | sample = (cowbell->oscMix * tSquare_tick(&cowbell->p[0])) + ((1.0f-cowbell->oscMix) * tSquare_tick(&cowbell->p[1])); |
| @@ -276,7 +276,7 @@ float LEAF_chebyshevT(float in, int n){ · 275 unmodified lines | ||
| 276 | 276 | else return 2.0f * in * LEAF_chebyshevT(in, n-1) - LEAF_chebyshevT(in, n-2); |
| 277 | 277 | } |
| 278 | 278 | |
| 279 | −#if !(_WIN32 || _WIN64) | |
| 279 | +#if !(_WIN32 || _WIN64 || __plan9__) | |
| 280 | 280 | float LEAF_CompoundChebyshevT(float in, int n, float* amps){ |
| 281 | 281 | float T[n+1]; |
| 282 | 282 | T[0] = 1.0f; |
| @@ -486,7 +486,7 @@ void LEAF_generate_sine(float* buffer, int size) · 203 unmodified lines | ||
| 486 | 486 | void LEAF_generate_sawtooth(float* buffer, float basefreq, int size, LEAF* const leaf) |
| 487 | 487 | { |
| 488 | 488 | int harmonic = 1; |
| 489 | − float phase = 0.0f; | |
| 489 | + float phase; | |
| 490 | 490 | float freq = harmonic * basefreq; |
| 491 | 491 | float amp; |
| 492 | 492 | |
| @@ -508,12 +508,12 @@ void LEAF_generate_sawtooth(float* buffer, float basefreq, int size, LEAF* const · 15 unmodified lines | ||
| 508 | 508 | void LEAF_generate_triangle(float* buffer, float basefreq, int size, LEAF* const leaf) |
| 509 | 509 | { |
| 510 | 510 | int harmonic = 1; |
| 511 | − float phase = 0.0f; | |
| 511 | + float phase; | |
| 512 | 512 | float freq = harmonic * basefreq; |
| 513 | − float amp = 1.0f; | |
| 513 | + float amp; | |
| 514 | 514 | |
| 515 | 515 | int count = 0; |
| 516 | − float mult = 1.0f; | |
| 516 | + float mult; | |
| 517 | 517 | |
| 518 | 518 | while (freq < (leaf->sampleRate * 0.5)) |
| 519 | 519 | { |
| @@ -537,9 +537,9 @@ void LEAF_generate_triangle(float* buffer, float basefreq, int size, LEAF* const · 17 unmodified lines | ||
| 537 | 537 | void LEAF_generate_square(float* buffer, float basefreq, int size, LEAF* const leaf) |
| 538 | 538 | { |
| 539 | 539 | int harmonic = 1; |
| 540 | − float phase = 0.0f; | |
| 540 | + float phase; | |
| 541 | 541 | float freq = harmonic * basefreq; |
| 542 | − float amp = 1.0f; | |
| 542 | + float amp; | |
| 543 | 543 | |
| 544 | 544 | while (freq < (leaf->sampleRate * 0.5)) |
| 545 | 545 | { |
| @@ -577,7 +577,7 @@ void LEAF_generate_table_skew_non_sym_double(float* buffer, float start, float e · 31 unmodified lines | ||
| 577 | 577 | double skew = log (0.5) / log ((center - start) / (end - start)); |
| 578 | 578 | double increment = 1.0 / (double)(size-1); |
| 579 | 579 | double x = 0.0; |
| 580 | − double proportion = 0.0; | |
| 580 | + double proportion; | |
| 581 | 581 | for (int i = 0; i < size; i++) |
| 582 | 582 | { |
| 583 | 583 | proportion = exp (log(x) / skew); |
| @@ -592,7 +592,7 @@ void LEAF_generate_table_skew_non_sym(float* buffer, float start, float end, flo · 8 unmodified lines | ||
| 592 | 592 | float skew = logf (0.5) / logf ((center - start) / (end - start)); |
| 593 | 593 | float increment = 1.0 / (float)(size-1); |
| 594 | 594 | float x = 0.0; |
| 595 | − float proportion = 0.0; | |
| 595 | + float proportion; | |
| 596 | 596 | for (int i = 0; i < size; i++) |
| 597 | 597 | { |
| 598 | 598 | proportion = expf (logf(x) / skew); |
| @@ -327,15 +327,15 @@ void mpool_free(char* ptr, _tMempool* pool) · 326 unmodified lines | ||
| 327 | 327 | mpool_node_t* next_node; |
| 328 | 328 | while (other_node != NULL) |
| 329 | 329 | { |
| 330 | − if ((long) other_node < (long) pool->mpool || | |
| 331 | − (long) other_node >= (((long) pool->mpool) + pool->msize)) | |
| 330 | + if ((uintptr_t) other_node < (uintptr_t) pool->mpool || | |
| 331 | + (uintptr_t) other_node >= (((uintptr_t) pool->mpool) + pool->msize)) | |
| 332 | 332 | { |
| 333 | 333 | LEAF_internalErrorCallback(pool->leaf, LEAFInvalidFree); |
| 334 | 334 | return; |
| 335 | 335 | } |
| 336 | 336 | next_node = other_node->next; |
| 337 | 337 | // Check if a node is directly after the freed node |
| 338 | − if (((long) freed_node) + (pool->leaf->header_size + freed_node->size) == (long) other_node) | |
| 338 | + if (((uintptr_t) freed_node) + (pool->leaf->header_size + freed_node->size) == (uintptr_t) other_node) | |
| 339 | 339 | { |
| 340 | 340 | // Increase freed node's size |
| 341 | 341 | freed_node->size += pool->leaf->header_size + other_node->size; |
| @@ -346,7 +346,7 @@ void mpool_free(char* ptr, _tMempool* pool) · 4 unmodified lines | ||
| 346 | 346 | } |
| 347 | 347 | |
| 348 | 348 | // Check if a node is directly before the freed node |
| 349 | − else if (((long) other_node) + (pool->leaf->header_size + other_node->size) == (long) freed_node) | |
| 349 | + else if (((uintptr_t) other_node) + (pool->leaf->header_size + other_node->size) == (uintptr_t) freed_node) | |
| 350 | 350 | { |
| 351 | 351 | // Increase the merging node's size |
| 352 | 352 | other_node->size += pool->leaf->header_size + freed_node->size; |
| @@ -163,7 +163,6 @@ int tStack_remove(tStack* const stack, uint16_t noteVal) · 162 unmodified lines | ||
| 163 | 163 | |
| 164 | 164 | } |
| 165 | 165 | // in case it got put on the stack multiple times |
| 166 | − foundIndex--; | |
| 167 | 166 | ns->size--; |
| 168 | 167 | removed = 1; |
| 169 | 168 | } |
| @@ -222,7 +221,7 @@ int tStack_next(tStack* const stack) · 52 unmodified lines | ||
| 222 | 221 | { |
| 223 | 222 | _tStack* ns = *stack; |
| 224 | 223 | |
| 225 | − int step = 0; | |
| 224 | + int step; | |
| 226 | 225 | if (ns->size != 0) // if there is at least one note in the stack |
| 227 | 226 | { |
| 228 | 227 | if (ns->pos > 0) // if you're not at the most recent note (first one), then go backward in the array (moving from earliest to latest) |
| @@ -748,7 +747,7 @@ int tSimplePoly_noteOn(tSimplePoly* const polyh, int note, uint8_t vel) · 519 unmodified lines | ||
| 748 | 747 | int tSimplePoly_noteOff(tSimplePoly* const polyh, uint8_t note) |
| 749 | 748 | { |
| 750 | 749 | _tSimplePoly* poly = *polyh; |
| 751 | − int16_t noteToTest = -1; | |
| 750 | + int16_t noteToTest; | |
| 752 | 751 | |
| 753 | 752 | tStack_remove(&poly->stack, note); |
| 754 | 753 | poly->notes[note][0] = -1; |
| @@ -833,7 +833,7 @@ float tNeuron_tick(tNeuron* const nr) · 832 unmodified lines | ||
| 833 | 833 | { |
| 834 | 834 | _tNeuron* n = *nr; |
| 835 | 835 | |
| 836 | − float output = 0.0f; | |
| 836 | + float output; | |
| 837 | 837 | float voltage = n->voltage; |
| 838 | 838 | |
| 839 | 839 | n->alpha[0] = (0.01f * (10.0f - voltage)) / (expf((10.0f - voltage)/10.0f) - 1.0f); |
| @@ -978,6 +978,7 @@ void tMBPulse_place_step_dd_noBuffer(tMBPulse* const osc, int index, float phase · 138 unmodified lines | ||
| 978 | 978 | float r; |
| 979 | 979 | long i; |
| 980 | 980 | |
| 981 | + USED(index); | |
| 981 | 982 | r = MINBLEP_PHASES * phase * inv_w; |
| 982 | 983 | i = lrintf(r - 0.5f); |
| 983 | 984 | r -= (float)i; |
| @@ -1323,6 +1324,7 @@ void tMBTriangle_place_dd_noBuffer(tMBTriangle* const osc, int index, float phas · 339 unmodified lines | ||
| 1323 | 1324 | float r; |
| 1324 | 1325 | long i; |
| 1325 | 1326 | |
| 1327 | + USED(index); | |
| 1326 | 1328 | r = MINBLEP_PHASES * phase * inv_w; |
| 1327 | 1329 | i = lrintf(r - 0.5f); |
| 1328 | 1330 | r -= (float)i; |
| @@ -1343,7 +1345,7 @@ float tMBTriangle_tick(tMBTriangle* const osc) · 14 unmodified lines | ||
| 1343 | 1345 | int j, k; |
| 1344 | 1346 | float sync; |
| 1345 | 1347 | float b, b1, invB, invB1, p, w, sw, z; |
| 1346 | − float x = 0.5f; | |
| 1348 | + float x; | |
| 1347 | 1349 | |
| 1348 | 1350 | sync = c->sync; |
| 1349 | 1351 | |
| @@ -1692,6 +1694,7 @@ void tMBSineTri_place_dd_noBuffer(tMBSineTri* const osc, int index, float phase, · 342 unmodified lines | ||
| 1692 | 1694 | float r; |
| 1693 | 1695 | long i; |
| 1694 | 1696 | |
| 1697 | + USED(index); | |
| 1695 | 1698 | r = MINBLEP_PHASES * phase * inv_w; |
| 1696 | 1699 | i = lrintf(r - 0.5f); |
| 1697 | 1700 | r -= (float)i; |
| @@ -1712,7 +1715,7 @@ float tMBSineTri_tick(tMBSineTri* const osc) · 14 unmodified lines | ||
| 1712 | 1715 | int j, k; |
| 1713 | 1716 | float sync; |
| 1714 | 1717 | float b, b1, invB, invB1, p, sinPhase, w, sw, z; |
| 1715 | − float x = 0.5f; | |
| 1718 | + float x; | |
| 1716 | 1719 | |
| 1717 | 1720 | sync = c->sync; |
| 1718 | 1721 | |
| @@ -2099,6 +2102,7 @@ void tMBSaw_place_step_dd_noBuffer(tMBSaw* const osc, int index, float phase, fl · 380 unmodified lines | ||
| 2099 | 2102 | float r; |
| 2100 | 2103 | long i; |
| 2101 | 2104 | |
| 2105 | + USED(index); | |
| 2102 | 2106 | r = MINBLEP_PHASES * phase * inv_w; |
| 2103 | 2107 | i = lrintf(r - 0.5f); |
| 2104 | 2108 | r -= (float)i; |
| @@ -2322,6 +2326,7 @@ void tMBSawPulse_place_step_dd_noBuffer(tMBSawPulse* const osc, int index, float · 217 unmodified lines | ||
| 2322 | 2326 | float r; |
| 2323 | 2327 | long i; |
| 2324 | 2328 | |
| 2329 | + USED(index); | |
| 2325 | 2330 | r = MINBLEP_PHASES * phase * inv_w; |
| 2326 | 2331 | i = lrintf(r - 0.5f); |
| 2327 | 2332 | r -= (float)i; |
| @@ -2913,7 +2918,7 @@ float tWaveOsc_tick(tWaveOsc* const cy) · 585 unmodified lines | ||
| 2913 | 2918 | // Phasor increment (unsigned 32bit int wraps automatically with overflow so no need for if branch checks, as you need with float) |
| 2914 | 2919 | c->phase += c->inc; |
| 2915 | 2920 | float floatPhase = (double)c->phase * 2.32830643654e-10; |
| 2916 | − float s1 = 0.f, s2 = 0.f; | |
| 2921 | + float s1, s2; | |
| 2917 | 2922 | |
| 2918 | 2923 | float temp; |
| 2919 | 2924 | int idx; |
| @@ -3299,7 +3304,7 @@ float tWaveOscS_tick(tWaveOscS* const cy) · 379 unmodified lines | ||
| 3299 | 3304 | // Phasor increment (unsigned 32bit int wraps automatically with overflow so no need for if branch checks, as you need with float) |
| 3300 | 3305 | c->phase += c->inc; |
| 3301 | 3306 | float floatPhase = (double)c->phase * 2.32830643654e-10; |
| 3302 | − float s1 = 0.f, s2 = 0.f; | |
| 3307 | + float s1, s2; | |
| 3303 | 3308 | |
| 3304 | 3309 | float temp; |
| 3305 | 3310 | int idx; |
| @@ -31,7 +31,7 @@ void tPluck_initToPool (tPluck* const pl, float lowestFrequency, tMempool* · 30 unmodified lines | ||
| 31 | 31 | |
| 32 | 32 | p->sampleRate = leaf->sampleRate; |
| 33 | 33 | |
| 34 | − if ( lowestFrequency <= 0.0f ) lowestFrequency = 10.0f; | |
| 34 | + if ( lowestFrequency <= 0.0f ) lowestFrequency = 10.0f; USED(lowestFrequency); | |
| 35 | 35 | |
| 36 | 36 | tNoise_initToPool(&p->noise, WhiteNoise, mp); |
| 37 | 37 | |
| @@ -124,6 +124,7 @@ void tPluck_setFrequency (tPluck* const pl, float frequency ) · 86 unmodified lines | ||
| 124 | 124 | // Perform the control change specified by \e number and \e value (0.0 - 128.0). |
| 125 | 125 | void tPluck_controlChange (tPluck* const pl, int number, float value) |
| 126 | 126 | { |
| 127 | + USED(pl); USED(number); USED(value); | |
| 127 | 128 | return; |
| 128 | 129 | } |
| 129 | 130 | |
| @@ -156,7 +157,7 @@ void tKarplusStrong_initToPool (tKarplusStrong* const pl, float lowestFrequ · 26 unmodified lines | ||
| 156 | 157 | |
| 157 | 158 | p->sampleRate = leaf->sampleRate; |
| 158 | 159 | |
| 159 | − if ( lowestFrequency <= 0.0f ) lowestFrequency = 8.0f; | |
| 160 | + if ( lowestFrequency <= 0.0f ) lowestFrequency = 8.0f; USED(lowestFrequency); | |
| 160 | 161 | |
| 161 | 162 | tAllpassDelay_initToPool(&p->delayLine, 0.0f, p->sampleRate * 2, mp); |
| 162 | 163 | tAllpassDelay_clear(&p->delayLine); |
| @@ -618,7 +619,7 @@ void tSimpleLivingString3_pluck(tSimpleLivingString3* const pl, float input, f · 455 unmodified lines | ||
| 618 | 619 | int remainder = length-pluckPoint; |
| 619 | 620 | for (int i = 0; i < length; i++) |
| 620 | 621 | { |
| 621 | − float val = 0.0f; | |
| 622 | + float val; | |
| 622 | 623 | if (i <= pluckPoint) |
| 623 | 624 | { |
| 624 | 625 | val = input * ((float)i/(float)pluckPoint); |
| @@ -643,6 +644,7 @@ void tSimpleLivingString3_pluck(tSimpleLivingString3* const pl, float input, f · 18 unmodified lines | ||
| 643 | 644 | float tSimpleLivingString3_tick(tSimpleLivingString3* const pl, float input) |
| 644 | 645 | { |
| 645 | 646 | _tSimpleLivingString3* p = *pl; |
| 647 | + USED(input); | |
| 646 | 648 | tLinearDelay_setDelay(&p->delayLineU, tExpSmooth_tick(&p->wlSmooth)); |
| 647 | 649 | tLinearDelay_setDelay(&p->delayLineL, tExpSmooth_tick(&p->wlSmooth)); |
| 648 | 650 | |
| @@ -1293,7 +1295,7 @@ float tLivingString2_tick(tLivingString2* const pl, float input) · 644 unmodified lines | ||
| 1293 | 1295 | tHermiteDelay_setDelay(&p->delUB, upLen); |
| 1294 | 1296 | |
| 1295 | 1297 | uint32_t PUPInt; |
| 1296 | − float pickupOut = 0.0f; | |
| 1298 | + float pickupOut; | |
| 1297 | 1299 | float pupos = tExpSmooth_tick(&p->puSmooth); |
| 1298 | 1300 | if (pupos < 0.9999f) |
| 1299 | 1301 | { |
| @@ -281,7 +281,7 @@ float tSampler_tick (tSampler* const sp) · 280 unmodified lines | ||
| 281 | 281 | return p->last; |
| 282 | 282 | } |
| 283 | 283 | |
| 284 | − float sample = 0.0f; | |
| 284 | + float sample; | |
| 285 | 285 | float cfxsample = 0.0f; |
| 286 | 286 | float crossfadeMix = 0.0f; |
| 287 | 287 | float flipsample = 0.0f; |
| @@ -1202,7 +1202,7 @@ void tAutoSampler_setCrossfadeLength (tAutoSampler* const as, uint32_t length · 914 unmodified lines | ||
| 1202 | 1202 | |
| 1203 | 1203 | void tAutoSampler_setRate (tAutoSampler* const as, float rate) |
| 1204 | 1204 | { |
| 1205 | − ; | |
| 1205 | + USED(as); USED(rate); | |
| 1206 | 1206 | } |
| 1207 | 1207 | |
| 1208 | 1208 | void tAutoSampler_setSampleRate (tAutoSampler* const as, float sr) |
| @@ -33,7 +33,7 @@ void LEAF_init(LEAF* const leaf, float sr, char* memory, size_t memorysize, floa · 32 unmodified lines | ||
| 33 | 33 | |
| 34 | 34 | leaf->clearOnAllocation = 0; |
| 35 | 35 | |
| 36 | − leaf->errorCallback = &LEAF_defaultErrorCallback; | |
| 36 | + leaf->errorCallback = LEAF_defaultErrorCallback; | |
| 37 | 37 | |
| 38 | 38 | for (int i = 0; i < LEAFErrorNil; ++i) |
| 39 | 39 | leaf->errorState[i] = 0; |
| @@ -59,6 +59,7 @@ void LEAF_defaultErrorCallback(LEAF* const leaf, LEAFErrorType whichone) · 19 unmodified lines | ||
| 59 | 59 | { |
| 60 | 60 | // Not sure what this should do if anything |
| 61 | 61 | // Maybe fine as a placeholder |
| 62 | + USED(leaf); USED(whichone); | |
| 62 | 63 | } |
| 63 | 64 | |
| 64 | 65 | void LEAF_internalErrorCallback(LEAF* const leaf, LEAFErrorType whichone) |
| @@ -24,6 +24,12 @@ · 23 unmodified lines | ||
| 24 | 24 | |
| 25 | 25 | #ifndef LEAF_H_INCLUDED |
| 26 | 26 | #define LEAF_H_INCLUDED |
| 27 | + | |
| 28 | +#ifdef __plan9__ | |
| 29 | +#pragma lib "./libleaf.$M.a" | |
| 30 | +#else | |
| 31 | +#define USED(x) | |
| 32 | +#endif | |
| 27 | 33 | |
| 28 | 34 | #define LEAF_DEBUG 0 |
| 29 | 35 | |
| @@ -0,0 +1,67 @@ | ||
| 1 | +</$objtype/mkfile | |
| 2 | +LIB=libleaf.$objtype.a | |
| 3 | + | |
| 4 | +CFLAGS=$CFLAGS -p -IInc -IExternals -IExternals/plan9 -D__plan9__=1 | |
| 5 | + | |
| 6 | +OFILES=\ | |
| 7 | + Externals/d_fft_mayer.$O\ | |
| 8 | + Externals/plan9/plan9.$O\ | |
| 9 | + Src/leaf-analysis.$O\ | |
| 10 | + Src/leaf-delay.$O\ | |
| 11 | + Src/leaf-distortion.$O\ | |
| 12 | + Src/leaf-dynamics.$O\ | |
| 13 | + Src/leaf-effects.$O\ | |
| 14 | + Src/leaf-electrical.$O\ | |
| 15 | + Src/leaf-envelopes.$O\ | |
| 16 | + Src/leaf-filters.$O\ | |
| 17 | + Src/leaf-instruments.$O\ | |
| 18 | + Src/leaf-math.$O\ | |
| 19 | + Src/leaf-mempool.$O\ | |
| 20 | + Src/leaf-midi.$O\ | |
| 21 | + Src/leaf-oscillators.$O\ | |
| 22 | + Src/leaf-physical.$O\ | |
| 23 | + Src/leaf-reverb.$O\ | |
| 24 | + Src/leaf-sampling.$O\ | |
| 25 | + Src/leaf-tables.$O\ | |
| 26 | + Src/leaf.$O\ | |
| 27 | + | |
| 28 | +HFILES=\ | |
| 29 | + Externals/d_fft_mayer.h\ | |
| 30 | + Externals/trigtbl.h\ | |
| 31 | + Inc/leaf-analysis.h\ | |
| 32 | + Inc/leaf-delay.h\ | |
| 33 | + Inc/leaf-distortion.h\ | |
| 34 | + Inc/leaf-dynamics.h\ | |
| 35 | + Inc/leaf-effects.h\ | |
| 36 | + Inc/leaf-electrical.h\ | |
| 37 | + Inc/leaf-envelopes.h\ | |
| 38 | + Inc/leaf-filters.h\ | |
| 39 | + Inc/leaf-global.h\ | |
| 40 | + Inc/leaf-instruments.h\ | |
| 41 | + Inc/leaf-math.h\ | |
| 42 | + Inc/leaf-mempool.h\ | |
| 43 | + Inc/leaf-midi.h\ | |
| 44 | + Inc/leaf-oscillators.h\ | |
| 45 | + Inc/leaf-physical.h\ | |
| 46 | + Inc/leaf-reverb.h\ | |
| 47 | + Inc/leaf-sampling.h\ | |
| 48 | + Inc/leaf-tables.h\ | |
| 49 | + leaf-config.h\ | |
| 50 | + leaf.h\ | |
| 51 | + | |
| 52 | +(.*)\.$O:R: \1.c | |
| 53 | + $CC $CFLAGS -o $target $stem1.c | |
| 54 | + | |
| 55 | +LIBOBJ=${OFILES:%=$LIB(%)} | |
| 56 | + | |
| 57 | +default:V: $LIB | |
| 58 | + | |
| 59 | +all:V: $LIB | |
| 60 | + | |
| 61 | +$LIB: $LIBOBJ | |
| 62 | + ar vu $LIB $newmember | |
| 63 | + | |
| 64 | +$LIB(%.$O):N: %.$O | |
| 65 | + | |
| 66 | +clean:V: | |
| 67 | + rm -f */*.[$OS] */*/*.[$OS] *.a | |
| @@ -0,0 +1,33 @@ | ||
| 1 | +#include "leaf.h" | |
| 2 | +#include <bio.h> | |
| 3 | + | |
| 4 | +static float | |
| 5 | +fandom(void) | |
| 6 | +{ | |
| 7 | + return frand(); | |
| 8 | +} | |
| 9 | + | |
| 10 | +void | |
| 11 | +main(int, char **) | |
| 12 | +{ | |
| 13 | + LEAF leaf; | |
| 14 | + tCycle cycle; | |
| 15 | + char mem[1000]; | |
| 16 | + Biobuf out; | |
| 17 | + int i; | |
| 18 | + | |
| 19 | + LEAF_init(&leaf, 44100, mem, 1000, fandom); | |
| 20 | + tCycle_init(&cycle, &leaf); | |
| 21 | + tCycle_setFreq(&cycle, 220); | |
| 22 | + Binit(&out, 1, OWRITE); | |
| 23 | + | |
| 24 | + for(i = 0; i < 44100; i++){ | |
| 25 | + float f = tCycle_tick(&cycle); | |
| 26 | + s16int s[2]; | |
| 27 | + s[0] = 16384.0f*(f - 0.5f); | |
| 28 | + s[1] = s[0]; | |
| 29 | + Bwrite(&out, s, sizeof(s)); | |
| 30 | + } | |
| 31 | + | |
| 32 | + exits(nil); | |
| 33 | +} | |