Unified · Split
| @@ -80,7 +80,7 @@ float LEAF_reedTable (float input, float offset, float slope); · 79 unmodified lines | ||
| 80 | 80 | |
| 81 | 81 | float LEAF_reduct (float input, float ratio); |
| 82 | 82 | float LEAF_round (float input, float rnd); |
| 83 | −float LEAF_bitwise_or(float input, uint32_t op); | |
| 83 | +float LEAF_bitwise_xor(float input, uint32_t op); | |
| 84 | 84 | |
| 85 | 85 | float LEAF_clip (float min, float val, float max); |
| 86 | 86 | int LEAF_clipInt (int min, int val, int max); |
| @@ -41,11 +41,11 @@ float tCrusher_tick (tCrusher* const c, float input) · 40 unmodified lines | ||
| 41 | 41 | |
| 42 | 42 | sample *= SCALAR; // SCALAR is 5000 by default |
| 43 | 43 | |
| 44 | − sample = floorf(sample); | |
| 44 | + sample = (int32_t) sample; | |
| 45 | 45 | |
| 46 | 46 | sample /= c->div; |
| 47 | 47 | |
| 48 | − sample = LEAF_bitwise_or(sample, c->op << 23); | |
| 48 | + sample = LEAF_bitwise_xor(sample, c->op << 23); | |
| 49 | 49 | |
| 50 | 50 | sample = LEAF_clip(-1.f, sample, 1.f); |
| 51 | 51 | |
| @@ -59,12 +59,12 @@ float tCrusher_tick (tCrusher* const c, float input) · 7 unmodified lines | ||
| 59 | 59 | |
| 60 | 60 | void tCrusher_setOperation (tCrusher* const c, float op) |
| 61 | 61 | { |
| 62 | − c->op = (int) (op * 8.0f); | |
| 62 | + c->op = (uint32_t) (op * 8.0f); | |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | // 0.0 - 1.0 |
| 66 | 66 | void tCrusher_setQuality (tCrusher* const c, float val) |
| 67 | −{ | |
| 67 | +{ | |
| 68 | 68 | val = LEAF_clip(0.0f, val, 1.0f); |
| 69 | 69 | |
| 70 | 70 | c->div = 0.01f + val * SCALAR; |
| @@ -127,7 +127,7 @@ int reduct_count = 0; · 126 unmodified lines | ||
| 127 | 127 | float LEAF_reduct (float input, float ratio) |
| 128 | 128 | { |
| 129 | 129 | reduct_count++; |
| 130 | − if (reduct_count > (leaf.sampleRate * (1.f - ratio))) | |
| 130 | + if (reduct_count > 1.f / ratio) | |
| 131 | 131 | { |
| 132 | 132 | hold = input; |
| 133 | 133 | reduct_count = 0; |
| @@ -150,10 +150,10 @@ float LEAF_round (float input, float rnd) · 16 unmodified lines | ||
| 150 | 150 | |
| 151 | 151 | union unholy_t unholy; |
| 152 | 152 | |
| 153 | −float LEAF_bitwise_or(float input, uint32_t op) | |
| 153 | +float LEAF_bitwise_xor(float input, uint32_t op) | |
| 154 | 154 | { |
| 155 | 155 | unholy.f = input; |
| 156 | − unholy.i = (unholy.i | op); | |
| 156 | + unholy.i = (unholy.i ^ op); | |
| 157 | 157 | |
| 158 | 158 | return unholy.f; |
| 159 | 159 | } |