minor optimizations
This commit is contained in:
parent
ec47ff73f7
commit
bb934de70c
@ -116,13 +116,14 @@ public class Visualizer extends Widget implements Disposable {
|
|||||||
buffer.rewind();
|
buffer.rewind();
|
||||||
if (compareBuffer.compareTo(buffer) != 0) {
|
if (compareBuffer.compareTo(buffer) != 0) {
|
||||||
bufferChanged();
|
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.
|
//Reset buffer to proper position.
|
||||||
buffer.position(originalPos);
|
buffer.position(originalPos);
|
||||||
}
|
}
|
||||||
@ -134,11 +135,11 @@ public class Visualizer extends Widget implements Disposable {
|
|||||||
|
|
||||||
private int updateBufferPosition() {
|
private int updateBufferPosition() {
|
||||||
int pos = (int) ((alGetSourcef(sourceID, AL11.AL_SAMPLE_OFFSET))-buffer.limit()-mm.getChannelCount()*mm.getReadWindowSize());
|
int pos = (int) ((alGetSourcef(sourceID, AL11.AL_SAMPLE_OFFSET))-buffer.limit()-mm.getChannelCount()*mm.getReadWindowSize());
|
||||||
try {
|
readWindowIndex = mm.getPlaybackIndexPosition()-1;
|
||||||
readWindowIndex = mm.getPlaybackIndexPosition()-1;
|
if (pos < 0) {
|
||||||
buffer.position(pos);
|
|
||||||
} catch (IllegalArgumentException iae) {
|
|
||||||
buffer.position(0);
|
buffer.position(0);
|
||||||
|
} else {
|
||||||
|
buffer.position(pos);
|
||||||
}
|
}
|
||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user