minor tuning to visualizer
This commit is contained in:
parent
5e3188ccc8
commit
c70d161337
Binary file not shown.
Before Width: | Height: | Size: 81 KiB After Width: | Height: | Size: 121 KiB |
@ -69,7 +69,7 @@ public class BasicVisualizer extends VisualizerCore {
|
||||
for (int i = 0; i < barCount; i++) {
|
||||
float barHeight = 0;
|
||||
for (int j = 0; j < binsPerBar; j++) {
|
||||
barHeight += Math.abs(audioPCM[j+i*binsPerBar]);
|
||||
barHeight += Math.abs(audioPCM[j+i*binsPerBar +1]);
|
||||
}
|
||||
barHeight /= binsPerBar;
|
||||
barHeight *= barHeightMultiplier;
|
||||
@ -106,7 +106,7 @@ public class BasicVisualizer extends VisualizerCore {
|
||||
public void setMM(MusicManager mm) {
|
||||
maxAvgHeight = 0;
|
||||
currentAvg = 0;
|
||||
float validBins = (9000/((mm.getSampleRate()/2)/((mm.getReadWindowSize()/2)+1)));
|
||||
float validBins = (5000/((mm.getSampleRate()/2)/((mm.getReadWindowSize()/2)+1)));
|
||||
Gdx.app.debug("Visualizer", "valid frequency bins " + validBins);
|
||||
binsPerBar = MathUtils.round((validBins/barCount));
|
||||
barHeights = new float[barCount];
|
||||
|
@ -89,7 +89,6 @@ public class VisualizerCore implements Disposable {
|
||||
public MusicManager getMm() {
|
||||
return mm;
|
||||
}
|
||||
|
||||
public float[] getAudioPCM() {
|
||||
return audioPCM;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user