From a41923fa12b335833006c53f5e5256e11d85e970 Mon Sep 17 00:00:00 2001 From: Recrown Date: Tue, 5 Dec 2017 16:07:26 -0600 Subject: [PATCH] optimization --- .../audio/visualizer/BasicVisualizer.java | 16 +++++----------- .../graphics/ui/components/MusicSelectable.java | 1 - .../graphics/ui/pages/MusicSelectionPage.java | 6 +++--- 3 files changed, 8 insertions(+), 15 deletions(-) diff --git a/core/src/zero1hd/rhythmbullet/audio/visualizer/BasicVisualizer.java b/core/src/zero1hd/rhythmbullet/audio/visualizer/BasicVisualizer.java index bb75cb0..6c0ed09 100755 --- a/core/src/zero1hd/rhythmbullet/audio/visualizer/BasicVisualizer.java +++ b/core/src/zero1hd/rhythmbullet/audio/visualizer/BasicVisualizer.java @@ -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(); } diff --git a/core/src/zero1hd/rhythmbullet/graphics/ui/components/MusicSelectable.java b/core/src/zero1hd/rhythmbullet/graphics/ui/components/MusicSelectable.java index 7be0fe1..e15fb3f 100755 --- a/core/src/zero1hd/rhythmbullet/graphics/ui/components/MusicSelectable.java +++ b/core/src/zero1hd/rhythmbullet/graphics/ui/components/MusicSelectable.java @@ -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(); diff --git a/core/src/zero1hd/rhythmbullet/graphics/ui/pages/MusicSelectionPage.java b/core/src/zero1hd/rhythmbullet/graphics/ui/pages/MusicSelectionPage.java index 414bfc0..4f6b373 100755 --- a/core/src/zero1hd/rhythmbullet/graphics/ui/pages/MusicSelectionPage.java +++ b/core/src/zero1hd/rhythmbullet/graphics/ui/pages/MusicSelectionPage.java @@ -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;