main menu particles fine tuning with visual debug
This commit is contained in:
@@ -63,24 +63,26 @@ public class PCMObtainer implements Observer, PCMSystem {
|
||||
df.setRoundingMode(RoundingMode.HALF_EVEN);
|
||||
}
|
||||
|
||||
private synchronized boolean calcPCMData() {
|
||||
boolean empty = true;
|
||||
short chanVal;
|
||||
for (int sid = 0; sid < PCM.length && sid < playingBuffer.remaining(); sid++) {
|
||||
PCM[sid] = 0;
|
||||
for (int channel = 0; channel < channelCount; channel++) {
|
||||
if (PCM[sid] < (chanVal = playingBuffer.get())) {
|
||||
PCM[sid] = chanVal;
|
||||
private boolean calcPCMData() {
|
||||
synchronized (PCM) {
|
||||
boolean empty = true;
|
||||
short chanVal;
|
||||
for (int sid = 0; sid < PCM.length && sid < playingBuffer.remaining(); sid++) {
|
||||
PCM[sid] = 0;
|
||||
for (int channel = 0; channel < channelCount; channel++) {
|
||||
if (PCM[sid] < (chanVal = playingBuffer.get())) {
|
||||
PCM[sid] = chanVal;
|
||||
}
|
||||
}
|
||||
PCM[sid] /= Short.MAX_VALUE + 1f;
|
||||
|
||||
if (PCM[sid] != 0) {
|
||||
empty = false;
|
||||
}
|
||||
|
||||
}
|
||||
PCM[sid] /= Short.MAX_VALUE + 1f;
|
||||
|
||||
if (PCM[sid] != 0) {
|
||||
empty = false;
|
||||
}
|
||||
|
||||
return empty;
|
||||
}
|
||||
return empty;
|
||||
}
|
||||
|
||||
private void checkValidityOfPlaybackBuffer() {
|
||||
@@ -138,7 +140,8 @@ public class PCMObtainer implements Observer, PCMSystem {
|
||||
public float[] getFrequencyBins() {
|
||||
if (mc.isPlaying()) {
|
||||
if (updated) {
|
||||
synchronized (this) {
|
||||
synchronized (PCM) {
|
||||
fft.realForward(PCM);
|
||||
System.arraycopy(PCM, 1, frequencyBins, 0, frequencyBins.length);
|
||||
}
|
||||
updated = false;
|
||||
@@ -174,9 +177,6 @@ public class PCMObtainer implements Observer, PCMSystem {
|
||||
//calculate current pcm data and notify that there is new data
|
||||
checkValidityOfPlaybackBuffer();
|
||||
updated = !calcPCMData();
|
||||
if (updated) {
|
||||
fft.realForward(PCM);
|
||||
}
|
||||
windowsRead++;
|
||||
|
||||
//contemplate synchronization
|
||||
|
@@ -286,7 +286,7 @@ public class MusicSelectionPage extends Page implements Observer {
|
||||
if (!selectable.isOffScreen()) {
|
||||
selectable.getMetadata().loadAlbumCover();
|
||||
selectable.loadAttempted();
|
||||
simpleDebug("Loaded " + selectable.getMetadata().getTitle());
|
||||
simpleDebug("Loaded album cover of " + selectable.getMetadata().getTitle());
|
||||
} else {
|
||||
simpleDebug("Skipping " + selectable.getMetadata().getTitle());
|
||||
}
|
||||
|
Reference in New Issue
Block a user