From b07c9ffd4455ddafe8a60cb5d8314d2f6d4ffbf8 Mon Sep 17 00:00:00 2001 From: Recrown Date: Sat, 13 Jan 2018 01:24:32 -0600 Subject: [PATCH] adjustments for visualizer --- .../rhythmbullet/audio/visualizer/BasicVisualizer.java | 2 +- .../desktop/graphics/ui/components/Visualizer.java | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/core/src/zero1hd/rhythmbullet/audio/visualizer/BasicVisualizer.java b/core/src/zero1hd/rhythmbullet/audio/visualizer/BasicVisualizer.java index e55caf2..f9211f2 100755 --- a/core/src/zero1hd/rhythmbullet/audio/visualizer/BasicVisualizer.java +++ b/core/src/zero1hd/rhythmbullet/audio/visualizer/BasicVisualizer.java @@ -106,7 +106,7 @@ public class BasicVisualizer extends VisualizerCore { public void setMM(MusicManager mm) { maxAvgHeight = 0; currentAvg = 0; - float validBins = (6400/((mm.getSampleRate()/2)/((mm.getReadWindowSize()/2)+1))); + float validBins = (9000/((mm.getSampleRate()/2)/((mm.getReadWindowSize()/2)+1))); Gdx.app.debug("Visualizer", "valid frequency bins " + validBins); binsPerBar = MathUtils.round((validBins/barCount)); barHeights = new float[barCount]; diff --git a/desktop/src/zero1hd/rhythmbullet/desktop/graphics/ui/components/Visualizer.java b/desktop/src/zero1hd/rhythmbullet/desktop/graphics/ui/components/Visualizer.java index 780bf58..d9fb24d 100755 --- a/desktop/src/zero1hd/rhythmbullet/desktop/graphics/ui/components/Visualizer.java +++ b/desktop/src/zero1hd/rhythmbullet/desktop/graphics/ui/components/Visualizer.java @@ -29,7 +29,7 @@ public class Visualizer extends Widget implements Disposable { private ShortBuffer compareBuffer; private ShortBuffer buffer; private int sourceID; - private float visRefreshRate = 1f/60f; + private float visRefreshRate; private float timer; private int readWindowIndex; public Visualizer() { @@ -60,6 +60,7 @@ public class Visualizer extends Widget implements Disposable { + "\nDuration in seconds: " + mm.getDuration() + "\nSample rate: " + mm.getSampleRate()); vis.setMM(mm); + visRefreshRate = mm.getReadWindowSize()/mm.getSampleRate(); mmSet = true; } @@ -152,7 +153,7 @@ public class Visualizer extends Widget implements Disposable { } int originalPos = buffer.position(); - + System.out.println(visRefreshRate); prevBuffer = ShortBuffer.allocate(buffer.capacity()); buffer.rewind(); prevBuffer.put(buffer);