History

crusher parameter fixes

Matthew Wang committed 7 years ago

Commit 9179bd91 parent 32b51e43 files · +8 −8Browse files

Unified · Split

3 files
  1. LEAF/Inc/leaf-math.h +1 −1
  2. LEAF/Src/leaf-crusher.c +4 −4
  3. LEAF/Src/leaf-math.c +3 −3
LEAF/Inc/leaf-math.h+1−1
@@ -80,7 +80,7 @@ float LEAF_reedTable (float input, float offset, float slope); · 79 unmodified lines
8080
8181 float LEAF_reduct (float input, float ratio);
8282 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);
8484
8585 float LEAF_clip (float min, float val, float max);
8686 int LEAF_clipInt (int min, int val, int max);
LEAF/Src/leaf-crusher.c+4−4
@@ -41,11 +41,11 @@ float tCrusher_tick (tCrusher* const c, float input) · 40 unmodified lines
4141
4242 sample *= SCALAR; // SCALAR is 5000 by default
4343
44− sample = floorf(sample);
44+ sample = (int32_t) sample;
4545
4646 sample /= c->div;
4747
48− sample = LEAF_bitwise_or(sample, c->op << 23);
48+ sample = LEAF_bitwise_xor(sample, c->op << 23);
4949
5050 sample = LEAF_clip(-1.f, sample, 1.f);
5151
@@ -59,12 +59,12 @@ float tCrusher_tick (tCrusher* const c, float input) · 7 unmodified lines
5959
6060 void tCrusher_setOperation (tCrusher* const c, float op)
6161 {
62− c->op = (int) (op * 8.0f);
62+ c->op = (uint32_t) (op * 8.0f);
6363 }
6464
6565 // 0.0 - 1.0
6666 void tCrusher_setQuality (tCrusher* const c, float val)
67−{
67+{
6868 val = LEAF_clip(0.0f, val, 1.0f);
6969
7070 c->div = 0.01f + val * SCALAR;
LEAF/Src/leaf-math.c+3−3
@@ -127,7 +127,7 @@ int reduct_count = 0; · 126 unmodified lines
127127 float LEAF_reduct (float input, float ratio)
128128 {
129129 reduct_count++;
130− if (reduct_count > (leaf.sampleRate * (1.f - ratio)))
130+ if (reduct_count > 1.f / ratio)
131131 {
132132 hold = input;
133133 reduct_count = 0;
@@ -150,10 +150,10 @@ float LEAF_round (float input, float rnd) · 16 unmodified lines
150150
151151 union unholy_t unholy;
152152
153−float LEAF_bitwise_or(float input, uint32_t op)
153+float LEAF_bitwise_xor(float input, uint32_t op)
154154 {
155155 unholy.f = input;
156− unholy.i = (unholy.i | op);
156+ unholy.i = (unholy.i ^ op);
157157
158158 return unholy.f;
159159 }

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