X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=Audio.pde;h=def7d0e1062ba7697415cef9ce98298f0f64a937;hb=6b3d53ca7ec4376d42dbd273102dde60c876c93c;hp=6e36a298e42a73aec03958fda464234bc8f2434a;hpb=922def98b6cc88f3aa8784b8968d8a5aa1bfc1a2;p=SugarCubes.git diff --git a/Audio.pde b/Audio.pde index 6e36a29..def7d0e 100644 --- a/Audio.pde +++ b/Audio.pde @@ -39,8 +39,8 @@ public static class GraphicEQ { } } - final float logTen = log(10); - public float log10(float val) { + static final float logTen = log(10); + public static float log10(float val) { return log(val) / logTen; } @@ -57,7 +57,7 @@ public static class GraphicEQ { return avg; } - public void run(int deltaMs) { + public void run(double deltaMs) { fft.forward(lx.audioInput().mix); float zeroDBReference = pow(10, 100*(1-level.getValuef())/20.); float decibelRange = 12 + range.getValuef() * 60; @@ -70,13 +70,13 @@ public static class GraphicEQ { float value = constrain(positiveDecibels / decibelRange, 0, 1); if (value > bandVals[i].getValuef()) { - bandVals[i].setEndVal(value, attack.getValuef() * 20).trigger(); + bandVals[i].setRangeFromHereTo(value, attack.getValuef() * 20).trigger(); } } for (LinearEnvelope band : bandVals) { band.run(deltaMs); if (!band.isRunning() && band.getValuef() > 0) { - band.setEndVal(0, release.getValuef() * 1600).trigger(); + band.setRangeFromHereTo(0, release.getValuef() * 1600).trigger(); } } }