From 4c207b20d144d5e016965c6371338f259a3056c7 Mon Sep 17 00:00:00 2001 From: Recrown Date: Thu, 11 Jan 2018 00:08:05 -0600 Subject: [PATCH 1/2] fixed error with window index --- .../desktop/graphics/ui/components/Visualizer.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 1e7287c..28b5cba 100755 --- a/desktop/src/zero1hd/rhythmbullet/desktop/graphics/ui/components/Visualizer.java +++ b/desktop/src/zero1hd/rhythmbullet/desktop/graphics/ui/components/Visualizer.java @@ -97,9 +97,9 @@ public class Visualizer extends Widget implements Disposable { } private int updateBufferPosition() { - int pos = (int) ((alGetSourcef(sourceID, AL11.AL_SAMPLE_OFFSET))-mm.getReadWindowSize()*mm.getChannelCount()); + int pos = (int) ((alGetSourcef(sourceID, AL11.AL_SAMPLE_OFFSET))-(mm.getReadWindowSize()*mm.getChannelCount())); try { - readWindowIndex = mm.getPlaybackIndexPosition(); + readWindowIndex = mm.getPlaybackIndexPosition()-1; buffer.position(pos); } catch (IllegalArgumentException iae) { buffer.position(0); From 98e2932f49d8e995909e1967903f0fa10e0a9ab0 Mon Sep 17 00:00:00 2001 From: Recrown Date: Thu, 11 Jan 2018 00:45:33 -0600 Subject: [PATCH 2/2] switched to checking buffer position to make sure its legal --- .../rhythmbullet/desktop/graphics/ui/components/Visualizer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 28b5cba..efefe5d 100755 --- a/desktop/src/zero1hd/rhythmbullet/desktop/graphics/ui/components/Visualizer.java +++ b/desktop/src/zero1hd/rhythmbullet/desktop/graphics/ui/components/Visualizer.java @@ -100,7 +100,7 @@ public class Visualizer extends Widget implements Disposable { int pos = (int) ((alGetSourcef(sourceID, AL11.AL_SAMPLE_OFFSET))-(mm.getReadWindowSize()*mm.getChannelCount())); try { readWindowIndex = mm.getPlaybackIndexPosition()-1; - buffer.position(pos); + buffer.position(Math.max(pos, 0)); } catch (IllegalArgumentException iae) { buffer.position(0); Gdx.app.error("BufferPosition", iae + " position was " + pos);