visualizer adjustements

This commit is contained in:
Harrison Deng 2017-10-04 09:51:49 -05:00
parent 354efc647a
commit 9b3b4a08a2
2 changed files with 6 additions and 7 deletions

View File

@ -32,12 +32,11 @@ public class BasicVisualizer extends VisualizerCore {
public BasicVisualizer() { public BasicVisualizer() {
super(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()/2, 0, 0); super(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()/2, 0, 0);
mirrors = new Array<>(); mirrors = new Array<>();
barHeightMultiplier = Gdx.graphics.getHeight()*0.0075f;
pixmap = new Pixmap(2, 2, Format.RGBA8888); pixmap = new Pixmap(2, 2, Format.RGBA8888);
pixmap.setColor(Color.WHITE); pixmap.setColor(Color.WHITE);
pixmap.fill(); pixmap.fill();
barCount = 65; barCount = 65;
smoothRange = 4; smoothRange = 3;
angleRot = new Vector2(MathUtils.cosDeg(rotation), MathUtils.sinDeg(rotation)); angleRot = new Vector2(MathUtils.cosDeg(rotation), MathUtils.sinDeg(rotation));
textures = new Texture[barCount]; textures = new Texture[barCount];
bars = new Sprite[barCount]; bars = new Sprite[barCount];
@ -80,13 +79,13 @@ public class BasicVisualizer extends VisualizerCore {
public void modify(float delta) { public void modify(float delta) {
//Averaging bins together //Averaging bins together
for (int i = 0; i < barCount; i++) { for (int i = 0; i < barCount; i++) {
float barHeight = 0; float barHeight = 2;
for (int j = 0; j < binsPerBar; j++) { for (int j = 0; j < binsPerBar; j++) {
barHeight += Math.abs(audioPCM[j+i*binsPerBar]); barHeight += Math.abs(audioPCM[j+i*binsPerBar]);
} }
barHeight /= binsPerBar; barHeight /= binsPerBar;
barHeight *= barHeightMultiplier; barHeight *= barHeightMultiplier;
bars[i].setSize(barWidth, bars[i].getHeight() < barHeight ? barHeight : bars[i].getHeight() - 1800f*delta); bars[i].setSize(barWidth, bars[i].getHeight() < barHeight ? barHeight : bars[i].getHeight() - 1.5f*Gdx.graphics.getHeight()*delta);
} }
} }
@ -105,6 +104,7 @@ public class BasicVisualizer extends VisualizerCore {
} }
public void updatePositionInfo() { public void updatePositionInfo() {
barHeightMultiplier = height*0.05f;
int barSpace = 0; int barSpace = 0;
angleRot.set(MathUtils.cosDeg(rotation), MathUtils.sinDeg(rotation)); angleRot.set(MathUtils.cosDeg(rotation), MathUtils.sinDeg(rotation));

View File

@ -14,7 +14,6 @@ import com.badlogic.gdx.scenes.scene2d.ui.Image;
import com.badlogic.gdx.utils.Disposable; import com.badlogic.gdx.utils.Disposable;
import zero1hd.rhythmbullet.audio.visualizer.MirrorVisualizer; import zero1hd.rhythmbullet.audio.visualizer.MirrorVisualizer;
import zero1hd.rhythmbullet.graphics.meshes.TitleBarMesh;
public class TitleBarVisualizer extends Group implements Disposable { public class TitleBarVisualizer extends Group implements Disposable {
private Visualizer visual; private Visualizer visual;
@ -24,10 +23,10 @@ public class TitleBarVisualizer extends Group implements Disposable {
public TitleBarVisualizer(AssetManager assets, OrthographicCamera camera) { public TitleBarVisualizer(AssetManager assets, OrthographicCamera camera) {
if (assets == null) throw new NullPointerException("TitleBarVisualizer requires assets manager... ITS NULL YOU FOOL"); if (assets == null) throw new NullPointerException("TitleBarVisualizer requires assets manager... ITS NULL YOU FOOL");
visual = new Visualizer(); visual = new Visualizer();
visual.getVis().setSpaceBetweenBars(visual.getVis().getBarWidth()-3); visual.getVis().setSpaceBetweenBars(visual.getVis().getBarWidth()-2);
addActor(visual); addActor(visual);
setSize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()*0.3f); setSize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()*0.2f);
setPosition(0, (Gdx.graphics.getHeight()-getHeight())/2f); setPosition(0, (Gdx.graphics.getHeight()-getHeight())/2f);
visual.setWidth(getWidth()); visual.setWidth(getWidth());
visual.setHeight(getHeight()); visual.setHeight(getHeight());