minor optimizations
This commit is contained in:
parent
ec47ff73f7
commit
bb934de70c
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user