optimization

This commit is contained in:
Harrison Deng 2017-12-05 16:07:26 -06:00
parent 86a606c44e
commit a41923fa12
3 changed files with 8 additions and 15 deletions

View File

@ -15,11 +15,10 @@ import zero1hd.rhythmbullet.audio.MusicManager;
public class BasicVisualizer extends VisualizerCore {
private Pixmap pixmap;
private Texture bar;
private Texture barTexture;
private int barWidth;
private int binsPerBar;
private int spaceBetweenBars;
private Texture[] textures;
private Sprite[] bars;
private float[] barHeights;
private int smoothRange;
@ -41,13 +40,11 @@ public class BasicVisualizer extends VisualizerCore {
barCount = 75;
smoothRange = 2;
angleRot = new Vector2(MathUtils.cosDeg(rotation), MathUtils.sinDeg(rotation));
textures = new Texture[barCount];
bars = new Sprite[barCount];
barHeights = new float[barCount];
for (int i = 0; i < textures.length; i++) {
textures[i] = new Texture(pixmap);
bars[i] = new Sprite(textures[i]);
barTexture = new Texture(pixmap);
for (int i = 0; i < bars.length; i++) {
bars[i] = new Sprite(barTexture);
}
updatePositionInfo();
@ -118,10 +115,7 @@ public class BasicVisualizer extends VisualizerCore {
@Override
public void dispose() {
bar.dispose();
for (int i = 0; i < textures.length; i++) {
textures[i].dispose();
}
barTexture.dispose();
if (mm != null) {
mm.dispose();
}

View File

@ -131,7 +131,6 @@ public class MusicSelectable extends WidgetGroup implements Disposable {
/**
* Selects this panel
* @param updateGlobalSelection whether or not to tell everything that this is selected. Usually true unless you set the global somewhere else.
*/
public void select() {
msp.deselectAll();

View File

@ -208,10 +208,10 @@ public class MusicSelectionPage extends Page implements Observer {
exec.submit(() -> {
for (int i = 0; i < selectables.size; i++) {
MusicSelectable info = selectables.get(i);
info.getAudioInfo().loadInfo();
MusicSelectable selectable = selectables.get(i);
selectable.getAudioInfo().loadInfo();
Gdx.app.postRunnable(() -> {
info.updateInfo();
selectable.updateInfo();
});
}
extraInfoDone = true;