optimization
This commit is contained in:
		@@ -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();
 | 
			
		||||
		}
 | 
			
		||||
 
 | 
			
		||||
@@ -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();
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user