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 8b03cb2..6748eb3 100755 --- a/desktop/src/zero1hd/rhythmbullet/desktop/graphics/ui/components/Visualizer.java +++ b/desktop/src/zero1hd/rhythmbullet/desktop/graphics/ui/components/Visualizer.java @@ -116,13 +116,14 @@ public class Visualizer extends Widget implements Disposable { buffer.rewind(); if (compareBuffer.compareTo(buffer) != 0) { bufferChanged(); + + + //Begin copying current buffer to the comparison buffer + compareBuffer.clear(); + compareBuffer.put(buffer); + compareBuffer.flip(); } - //Begin copying current buffer to the comparison buffer - compareBuffer.clear(); - compareBuffer.put(buffer); - compareBuffer.flip(); - //Reset buffer to proper position. buffer.position(originalPos); } @@ -134,11 +135,11 @@ public class Visualizer extends Widget implements Disposable { private int updateBufferPosition() { int pos = (int) ((alGetSourcef(sourceID, AL11.AL_SAMPLE_OFFSET))-buffer.limit()-mm.getChannelCount()*mm.getReadWindowSize()); - try { - readWindowIndex = mm.getPlaybackIndexPosition()-1; - buffer.position(pos); - } catch (IllegalArgumentException iae) { + readWindowIndex = mm.getPlaybackIndexPosition()-1; + if (pos < 0) { buffer.position(0); + } else { + buffer.position(pos); } return pos; }