optimizations done to graphing
This commit is contained in:
parent
b18cbe2352
commit
db902e59e1
@ -18,11 +18,10 @@ import zero1hd.rhythmbullet.audio.AudioAnalyzer;
|
|||||||
import zero1hd.rhythmbullet.audio.AudioDataPackage;
|
import zero1hd.rhythmbullet.audio.AudioDataPackage;
|
||||||
import zero1hd.rhythmbullet.audio.map.RhythmMapAlgorithm;
|
import zero1hd.rhythmbullet.audio.map.RhythmMapAlgorithm;
|
||||||
import zero1hd.rhythmbullet.screens.MainMenu;
|
import zero1hd.rhythmbullet.screens.MainMenu;
|
||||||
import zero1hd.rhythmbullet.ui.windows.BassUMGraphWindow;
|
import zero1hd.rhythmbullet.ui.builders.AudioGraph;
|
||||||
import zero1hd.rhythmbullet.ui.windows.BeatViewer;
|
import zero1hd.rhythmbullet.ui.windows.BeatViewer;
|
||||||
import zero1hd.rhythmbullet.ui.windows.DifficultyWindow;
|
import zero1hd.rhythmbullet.ui.windows.DifficultyWindow;
|
||||||
import zero1hd.rhythmbullet.ui.windows.FPSWindow;
|
import zero1hd.rhythmbullet.ui.windows.FPSWindow;
|
||||||
import zero1hd.rhythmbullet.ui.windows.MGraphWindow;
|
|
||||||
import zero1hd.rhythmbullet.ui.windows.MusicController;
|
import zero1hd.rhythmbullet.ui.windows.MusicController;
|
||||||
import zero1hd.rhythmbullet.ui.windows.MusicSelector;
|
import zero1hd.rhythmbullet.ui.windows.MusicSelector;
|
||||||
import zero1hd.rhythmbullet.ui.windows.SpawnerWindow;
|
import zero1hd.rhythmbullet.ui.windows.SpawnerWindow;
|
||||||
@ -35,8 +34,8 @@ public class CreativeHUD extends Stage implements MiniListener {
|
|||||||
MusicSelector musicSelector;
|
MusicSelector musicSelector;
|
||||||
FPSWindow fpsViewer;
|
FPSWindow fpsViewer;
|
||||||
BeatViewer beatViewer;
|
BeatViewer beatViewer;
|
||||||
BassUMGraphWindow bassUMgraphWindow;
|
AudioGraph bassUMgraphWindow;
|
||||||
MGraphWindow mGraphWindow;
|
AudioGraph mGraphWindow;
|
||||||
VolumeWindow volumeWindow;
|
VolumeWindow volumeWindow;
|
||||||
SpawnerWindow spawnerWindow;
|
SpawnerWindow spawnerWindow;
|
||||||
DifficultyWindow diffWindow;
|
DifficultyWindow diffWindow;
|
||||||
@ -57,8 +56,10 @@ public class CreativeHUD extends Stage implements MiniListener {
|
|||||||
|
|
||||||
fpsViewer = new FPSWindow("FPS", core.getDefaultSkin());
|
fpsViewer = new FPSWindow("FPS", core.getDefaultSkin());
|
||||||
beatViewer = new BeatViewer("Beat", core.getDefaultSkin());
|
beatViewer = new BeatViewer("Beat", core.getDefaultSkin());
|
||||||
bassUMgraphWindow = new BassUMGraphWindow("Bass/UM Peak Values", core.getDefaultSkin());
|
bassUMgraphWindow = new AudioGraph(512, 256);
|
||||||
mGraphWindow = new MGraphWindow("Midrange Peak Values", core.getDefaultSkin());
|
bassUMgraphWindow.setPosition(getWidth() - bassUMgraphWindow.getWidth(), 0);
|
||||||
|
mGraphWindow = new AudioGraph(512, 256);
|
||||||
|
mGraphWindow.setPosition(getWidth() - mGraphWindow.getWidth(), bassUMgraphWindow.getHeight());
|
||||||
volumeWindow = new VolumeWindow("Volume adjustments", core.getDefaultSkin(), core.getPrefs());
|
volumeWindow = new VolumeWindow("Volume adjustments", core.getDefaultSkin(), core.getPrefs());
|
||||||
spawnerWindow = new SpawnerWindow("Spawn Tool", core.getDefaultSkin(), gpa.em, gpa.cm, gpa);
|
spawnerWindow = new SpawnerWindow("Spawn Tool", core.getDefaultSkin(), gpa.em, gpa.cm, gpa);
|
||||||
diffWindow = new DifficultyWindow(core.getDefaultSkin());
|
diffWindow = new DifficultyWindow(core.getDefaultSkin());
|
||||||
@ -240,8 +241,8 @@ public class CreativeHUD extends Stage implements MiniListener {
|
|||||||
case MUSIC_SELECTED:
|
case MUSIC_SELECTED:
|
||||||
beatViewer.setMusic(null, null);
|
beatViewer.setMusic(null, null);
|
||||||
volumeWindow.setMusic(null);
|
volumeWindow.setMusic(null);
|
||||||
bassUMgraphWindow.setData(null, null, null);
|
bassUMgraphWindow.setGraphingData(null, null, null);
|
||||||
mGraphWindow.setData(null, null, null);
|
mGraphWindow.setGraphingData(null, null, null);
|
||||||
if (musicPlayBackControls.getAudiofile() != null) {
|
if (musicPlayBackControls.getAudiofile() != null) {
|
||||||
musicPlayBackControls.getAudiofile().dispose();
|
musicPlayBackControls.getAudiofile().dispose();
|
||||||
}
|
}
|
||||||
@ -267,15 +268,15 @@ public class CreativeHUD extends Stage implements MiniListener {
|
|||||||
volumeWindow.setMusic(adp.getMusicInfo());
|
volumeWindow.setMusic(adp.getMusicInfo());
|
||||||
beatViewer.setMusic(adp.getMusicInfo(), analyzer.getAudioDataPackage());
|
beatViewer.setMusic(adp.getMusicInfo(), analyzer.getAudioDataPackage());
|
||||||
|
|
||||||
bassUMgraphWindow.setData(analyzer.getAudioDataPackage().getBassPeaks(), analyzer.getAudioDataPackage().getuMPeaks(), adp.getMusicInfo());
|
bassUMgraphWindow.setGraphingData(analyzer.getAudioDataPackage().getBassPeaks(), analyzer.getAudioDataPackage().getuMPeaks(), adp.getMusicInfo());
|
||||||
bassUMgraphWindow.getGraph().avgG1 = adp.getBassAvg();
|
bassUMgraphWindow.avgG1 = adp.getBassAvg();
|
||||||
bassUMgraphWindow.getGraph().normalDataG1 = adp.getBassMaxVal();
|
bassUMgraphWindow.normalDataG1 = adp.getBassMaxVal();
|
||||||
bassUMgraphWindow.getGraph().avgG2 = adp.getuMAvg();
|
bassUMgraphWindow.avgG2 = adp.getuMAvg();
|
||||||
bassUMgraphWindow.getGraph().normalDataG2 = adp.getuMMaxval();
|
bassUMgraphWindow.normalDataG2 = adp.getuMMaxval();
|
||||||
|
|
||||||
mGraphWindow.setData(analyzer.getAudioDataPackage().getmPeaks(), null, adp.getMusicInfo());
|
mGraphWindow.setGraphingData(analyzer.getAudioDataPackage().getmPeaks(), null, adp.getMusicInfo());
|
||||||
mGraphWindow.getGraph().normalDataG1 = adp.getmMaxVal();
|
mGraphWindow.normalDataG1 = adp.getmMaxVal();
|
||||||
mGraphWindow.getGraph().avgG1 = adp.getmAvg();
|
mGraphWindow.avgG1 = adp.getmAvg();
|
||||||
gpa.setAudioMap(mapGen.getMap());
|
gpa.setAudioMap(mapGen.getMap());
|
||||||
ghud.setMusic(adp.getMusicInfo().getPlaybackMusic());
|
ghud.setMusic(adp.getMusicInfo().getPlaybackMusic());
|
||||||
break;
|
break;
|
||||||
|
@ -2,34 +2,28 @@ package zero1hd.rhythmbullet.ui.builders;
|
|||||||
|
|
||||||
import com.badlogic.gdx.Gdx;
|
import com.badlogic.gdx.Gdx;
|
||||||
import com.badlogic.gdx.Input.Keys;
|
import com.badlogic.gdx.Input.Keys;
|
||||||
import com.badlogic.gdx.graphics.Pixmap;
|
|
||||||
import com.badlogic.gdx.graphics.Texture;
|
|
||||||
import com.badlogic.gdx.graphics.Pixmap.Format;
|
|
||||||
import com.badlogic.gdx.graphics.g2d.Batch;
|
import com.badlogic.gdx.graphics.g2d.Batch;
|
||||||
|
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
|
||||||
|
import com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType;
|
||||||
import com.badlogic.gdx.math.MathUtils;
|
import com.badlogic.gdx.math.MathUtils;
|
||||||
import com.badlogic.gdx.scenes.scene2d.Actor;
|
import com.badlogic.gdx.scenes.scene2d.Actor;
|
||||||
import com.badlogic.gdx.utils.FloatArray;
|
import com.badlogic.gdx.utils.FloatArray;
|
||||||
|
|
||||||
|
import zero1hd.rhythmbullet.audio.CoreMusicInfo;
|
||||||
|
|
||||||
public class AudioGraph extends Actor {
|
public class AudioGraph extends Actor {
|
||||||
Pixmap audioGraph;
|
private CoreMusicInfo audioData;
|
||||||
Texture textureOfGraph;
|
ShapeRenderer shapeRender;
|
||||||
FloatArray mainGraph;
|
FloatArray mainGraph;
|
||||||
FloatArray overlayGraph;
|
FloatArray overlayGraph;
|
||||||
int dataIndex;
|
int dataIndex;
|
||||||
int displayMode;
|
int displayMode;
|
||||||
public float normalDataG1 = 1f, normalDataG2 = 1f, avgG1 = 1f, avgG2 = 1f;
|
public float normalDataG1 = 1f, normalDataG2 = 1f, avgG1 = 1f, avgG2 = 1f;
|
||||||
float scale;
|
float scale;
|
||||||
|
|
||||||
public AudioGraph(int graphSizeW, int graphSizeH) {
|
public AudioGraph(int graphSizeW, int graphSizeH) {
|
||||||
audioGraph = new Pixmap(graphSizeW, graphSizeH, Format.RGBA8888);
|
shapeRender = new ShapeRenderer();
|
||||||
audioGraph.setColor(0.1f, 0.1f, 0.1f, 0.75f);
|
setSize(graphSizeW, graphSizeH);
|
||||||
audioGraph.fill();
|
scale = graphSizeH;
|
||||||
|
|
||||||
textureOfGraph = new Texture(audioGraph);
|
|
||||||
setWidth(graphSizeW);
|
|
||||||
setHeight(graphSizeH);
|
|
||||||
|
|
||||||
scale = audioGraph.getHeight();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAudioDataIndex(int audioDataIndex) {
|
public void setAudioDataIndex(int audioDataIndex) {
|
||||||
@ -37,88 +31,110 @@ public class AudioGraph extends Actor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void act(float delta) {
|
public void draw(Batch batch, float parentAlpha) {
|
||||||
audioGraph.setColor(0f, 0f, 0f, 0.75f);
|
batch.end();
|
||||||
audioGraph.fill();
|
shapeRender.begin(ShapeType.Line);
|
||||||
|
shapeRender.setColor(0f, 0f, 0f, 0.35f);
|
||||||
|
shapeRender.rect(getX(), getY(), getWidth(), getHeight());
|
||||||
if (overlayGraph != null) {
|
if (overlayGraph != null) {
|
||||||
if (Gdx.input.isKeyPressed(Keys.COMMA)) {
|
if (Gdx.input.isKeyPressed(Keys.COMMA)) {
|
||||||
if (scale > 0.05f) {
|
if (scale > 0.05f) {
|
||||||
scale -= 0.25f;
|
scale -= 0.25f;
|
||||||
}
|
}
|
||||||
} else if (Gdx.input.isKeyPressed(Keys.PERIOD)) {
|
} else if (Gdx.input.isKeyPressed(Keys.PERIOD)) {
|
||||||
if (scale < audioGraph.getHeight()*2f) {
|
if (scale < getHeight()*2) {
|
||||||
scale += 0.4f;
|
scale += 0.4f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Gdx.input.isKeyJustPressed(Keys.M)) {
|
if (Gdx.input.isKeyJustPressed(Keys.M)) {
|
||||||
displayMode++;
|
|
||||||
if (displayMode != 3) {
|
|
||||||
Gdx.app.debug("Graph", "Switching to another graph.");
|
Gdx.app.debug("Graph", "Switching to another graph.");
|
||||||
} else {
|
displayMode++;
|
||||||
|
if (displayMode == 3) {
|
||||||
displayMode = 0;
|
displayMode = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Gdx.input.isKeyPressed(Keys.COMMA)) {
|
|
||||||
if (scale > 0.05f) {
|
|
||||||
scale -= 0.25f;
|
|
||||||
}
|
|
||||||
} else if (Gdx.input.isKeyPressed(Keys.PERIOD)) {
|
|
||||||
if (scale < audioGraph.getHeight()*2f) {
|
|
||||||
scale += 0.4f;
|
|
||||||
}
|
|
||||||
} else if (Gdx.input.isKeyJustPressed(Keys.SLASH)) {
|
|
||||||
scale = audioGraph.getHeight();
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (displayMode) {
|
switch (displayMode) {
|
||||||
case 0:
|
case 0:
|
||||||
audioGraph.setColor(1f, 0f, 0f, 0.75f);
|
shapeRender.setColor(1f, 0f, 0f, 1f);
|
||||||
for (int x = 0; x < audioGraph.getWidth(); x++) {
|
for (int x = 0; x < getWidth(); x++) {
|
||||||
try {
|
try {
|
||||||
audioGraph.drawLine(x, audioGraph.getHeight(), x, (int) (audioGraph.getHeight()-(mainGraph.get(dataIndex+x-audioGraph.getWidth()/2)/normalDataG1)*scale));
|
shapeRender.line(
|
||||||
|
getX()+x,
|
||||||
|
getY(),
|
||||||
|
getX()+x,
|
||||||
|
(int) ((mainGraph.get((int) (dataIndex+x-getWidth()/2))/normalDataG1)*scale)+getY());
|
||||||
} catch (NullPointerException | IndexOutOfBoundsException e) {
|
} catch (NullPointerException | IndexOutOfBoundsException e) {
|
||||||
}
|
}
|
||||||
audioGraph.drawLine(0, audioGraph.getHeight() - MathUtils.round(scale*(avgG1/normalDataG1)), audioGraph.getWidth(), audioGraph.getHeight() - MathUtils.round(scale*(avgG1/normalDataG1)));
|
shapeRender.line(
|
||||||
|
getX(),
|
||||||
|
MathUtils.round(scale*(avgG1/normalDataG1))+getY(),
|
||||||
|
getWidth() + getX(),
|
||||||
|
MathUtils.round(scale*(avgG1/normalDataG1))+getY());
|
||||||
}
|
}
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
audioGraph.setColor(0f, 0f, 1f, 0.75f);
|
shapeRender.setColor(0f, 0f, 1f, 0.75f);
|
||||||
for (int x = 0; x < audioGraph.getWidth() -1; x++) {
|
for (int x = 0; x < getHeight() -1; x++) {
|
||||||
try {
|
try {
|
||||||
audioGraph.drawLine(x, audioGraph.getHeight(), x, (int) (audioGraph.getHeight()-(overlayGraph.get(dataIndex+x-audioGraph.getWidth()/2)/normalDataG2)*scale));
|
shapeRender.line(
|
||||||
|
getX()+x,
|
||||||
|
getY(),
|
||||||
|
getX()+x,
|
||||||
|
(int) ((overlayGraph.get((int) (dataIndex+x-getWidth()/2))/normalDataG2)*scale)+getY());
|
||||||
} catch (NullPointerException | IndexOutOfBoundsException e) {
|
} catch (NullPointerException | IndexOutOfBoundsException e) {
|
||||||
}
|
}
|
||||||
audioGraph.drawLine(0, audioGraph.getHeight() - MathUtils.round(scale*(avgG2/normalDataG2)), audioGraph.getWidth(), audioGraph.getHeight() - MathUtils.round(scale*(avgG2/normalDataG2)));
|
shapeRender.line(
|
||||||
|
getX(),
|
||||||
|
MathUtils.round(scale*(avgG2/normalDataG2)) + getY(),
|
||||||
|
getWidth() + getX(),
|
||||||
|
MathUtils.round(scale*(avgG2/normalDataG2))+getY());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
audioGraph.setColor(1f, 0f, 0f, 0.75f);
|
shapeRender.setColor(1f, 0f, 0f, 0.75f);
|
||||||
for (int x = 0; x < audioGraph.getWidth(); x++) {
|
for (int x = 0; x < getWidth(); x++) {
|
||||||
try {
|
try {
|
||||||
audioGraph.drawLine(x, audioGraph.getHeight(), x, (int) (audioGraph.getHeight()-(mainGraph.get(dataIndex+x-audioGraph.getWidth()/2)/normalDataG1)*scale));
|
shapeRender.line(
|
||||||
|
getX()+x,
|
||||||
|
getY(),
|
||||||
|
getX()+x,
|
||||||
|
(int) ((mainGraph.get((int) (dataIndex+x-getWidth()/2))/normalDataG1)*scale)+getY());
|
||||||
} catch (NullPointerException | IndexOutOfBoundsException e) {
|
} catch (NullPointerException | IndexOutOfBoundsException e) {
|
||||||
}
|
}
|
||||||
|
shapeRender.line(
|
||||||
|
getX(),
|
||||||
|
MathUtils.round(scale*(avgG1/normalDataG1))+getY(),
|
||||||
|
getWidth() + getX(),
|
||||||
|
MathUtils.round(scale*(avgG1/normalDataG1))+getY());
|
||||||
}
|
}
|
||||||
audioGraph.drawLine(0, audioGraph.getHeight() - MathUtils.round(scale*(avgG1/normalDataG1)), audioGraph.getWidth(), audioGraph.getHeight() - MathUtils.round(scale*(avgG1/normalDataG1)));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
audioGraph.setColor(0f, 1f, 0f, 0.95f);
|
shapeRender.setColor(0f, 1f, 0f, 1f);
|
||||||
audioGraph.drawLine(audioGraph.getWidth()/2, 0, audioGraph.getWidth()/2, audioGraph.getHeight());
|
shapeRender.line(getX()+getWidth()/2, 0, getX()+getWidth()/2, getHeight()+getY());
|
||||||
|
shapeRender.end();
|
||||||
|
|
||||||
textureOfGraph.draw(audioGraph, 0, 0);
|
batch.begin();
|
||||||
super.act(delta);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void draw(Batch batch, float parentAlpha) {
|
|
||||||
batch.draw(textureOfGraph, getX(), getY(), getWidth(), getHeight());
|
|
||||||
super.draw(batch, parentAlpha);
|
super.draw(batch, parentAlpha);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setGraphingData(FloatArray dataSet1, FloatArray dataSet2) {
|
@Override
|
||||||
|
public void act(float delta) {
|
||||||
|
if (audioData != null) {
|
||||||
|
setAudioDataIndex(audioData.getReadIndex());
|
||||||
|
}
|
||||||
|
super.act(delta);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set what arrays to graph
|
||||||
|
* @param dataSet1 first audio data set
|
||||||
|
* @param dataSet2 overlay graph. This one can be null.
|
||||||
|
* @param audioData actual basic audio information for index position
|
||||||
|
*/
|
||||||
|
public void setGraphingData(FloatArray dataSet1, FloatArray dataSet2, CoreMusicInfo audioData) {
|
||||||
this.mainGraph = dataSet1;
|
this.mainGraph = dataSet1;
|
||||||
this.overlayGraph = dataSet2;
|
this.overlayGraph = dataSet2;
|
||||||
if (dataSet2 == null) {
|
if (dataSet2 == null) {
|
||||||
@ -126,6 +142,7 @@ public class AudioGraph extends Actor {
|
|||||||
} else {
|
} else {
|
||||||
displayMode = 0;
|
displayMode = 0;
|
||||||
}
|
}
|
||||||
|
this.audioData = audioData;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ import com.badlogic.gdx.utils.Align;
|
|||||||
public class GraphicsTable extends Table {
|
public class GraphicsTable extends Table {
|
||||||
private Label resolutions, shaders;
|
private Label resolutions, shaders;
|
||||||
|
|
||||||
private CheckBox glowShader, bgShader, invertShader, fancySpriteShader;
|
private CheckBox glowShader;
|
||||||
|
|
||||||
private SetResolutionButton
|
private SetResolutionButton
|
||||||
_3840x2160,
|
_3840x2160,
|
||||||
@ -35,26 +35,11 @@ public class GraphicsTable extends Table {
|
|||||||
add(shaders).fillX();
|
add(shaders).fillX();
|
||||||
row();
|
row();
|
||||||
|
|
||||||
invertShader = new CheckBox(" Invert Shader", skin, "expandable");
|
|
||||||
invertShader.setChecked(pref.getBoolean("invert shader", false));
|
|
||||||
add(invertShader).minHeight(shaders.getHeight());
|
|
||||||
row();
|
|
||||||
|
|
||||||
glowShader = new CheckBox(" Glow Shader", skin, "expandable");
|
glowShader = new CheckBox(" Glow Shader", skin, "expandable");
|
||||||
glowShader.setChecked(pref.getBoolean("glow shader", true));
|
glowShader.setChecked(pref.getBoolean("glow shader", true));
|
||||||
add(glowShader).minHeight(shaders.getHeight());
|
add(glowShader).minHeight(shaders.getHeight());
|
||||||
row();
|
row();
|
||||||
|
|
||||||
bgShader = new CheckBox(" Background Shader", skin, "expandable");
|
|
||||||
bgShader.setChecked(pref.getBoolean("bg shader", true));
|
|
||||||
add(bgShader).minHeight(shaders.getHeight());
|
|
||||||
row();
|
|
||||||
|
|
||||||
fancySpriteShader = new CheckBox(" Fancy Sprites", skin, "expandable");
|
|
||||||
fancySpriteShader.setChecked(pref.getBoolean("fancy", true));
|
|
||||||
add(fancySpriteShader).minHeight(shaders.getHeight());
|
|
||||||
row();
|
|
||||||
|
|
||||||
resolutions = new Label("Resolutions: ", skin);
|
resolutions = new Label("Resolutions: ", skin);
|
||||||
add(resolutions).left();
|
add(resolutions).left();
|
||||||
row();
|
row();
|
||||||
@ -111,9 +96,6 @@ public class GraphicsTable extends Table {
|
|||||||
public void save(Preferences prefs) {
|
public void save(Preferences prefs) {
|
||||||
Gdx.app.debug("Preferences", "Saved shading values values.");
|
Gdx.app.debug("Preferences", "Saved shading values values.");
|
||||||
|
|
||||||
prefs.putBoolean("bg shader", bgShader.isChecked());
|
|
||||||
prefs.putBoolean("glow shader", glowShader.isChecked());
|
prefs.putBoolean("glow shader", glowShader.isChecked());
|
||||||
prefs.putBoolean("invert shader", invertShader.isChecked());
|
|
||||||
prefs.putBoolean("fancy", fancySpriteShader.isChecked());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,38 +0,0 @@
|
|||||||
package zero1hd.rhythmbullet.ui.windows;
|
|
||||||
|
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
|
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.Window;
|
|
||||||
import com.badlogic.gdx.utils.FloatArray;
|
|
||||||
|
|
||||||
import zero1hd.rhythmbullet.audio.CoreMusicInfo;
|
|
||||||
import zero1hd.rhythmbullet.ui.builders.AudioGraph;
|
|
||||||
|
|
||||||
public class BassUMGraphWindow extends Window {
|
|
||||||
AudioGraph graph;
|
|
||||||
CoreMusicInfo audioData;
|
|
||||||
|
|
||||||
public BassUMGraphWindow(String title, Skin skin) {
|
|
||||||
super(title, skin, "tinted");
|
|
||||||
graph = new AudioGraph(300, 150);
|
|
||||||
add(graph);
|
|
||||||
pack();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void act(float delta) {
|
|
||||||
if (audioData != null) {
|
|
||||||
graph.setAudioDataIndex(audioData.getReadIndex());
|
|
||||||
}
|
|
||||||
super.act(delta);
|
|
||||||
}
|
|
||||||
|
|
||||||
public AudioGraph getGraph() {
|
|
||||||
return graph;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setData(FloatArray dataSet1, FloatArray dataSet2, CoreMusicInfo audioData) {
|
|
||||||
this.audioData = audioData;
|
|
||||||
graph.setGraphingData(dataSet1, dataSet2);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,37 +0,0 @@
|
|||||||
package zero1hd.rhythmbullet.ui.windows;
|
|
||||||
|
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
|
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.Window;
|
|
||||||
import com.badlogic.gdx.utils.FloatArray;
|
|
||||||
|
|
||||||
import zero1hd.rhythmbullet.audio.CoreMusicInfo;
|
|
||||||
import zero1hd.rhythmbullet.ui.builders.AudioGraph;
|
|
||||||
|
|
||||||
public class MGraphWindow extends Window {
|
|
||||||
private AudioGraph graph;
|
|
||||||
private CoreMusicInfo audioData;
|
|
||||||
|
|
||||||
public MGraphWindow(String title, Skin skin) {
|
|
||||||
super(title, skin, "tinted");
|
|
||||||
graph = new AudioGraph(300, 150);
|
|
||||||
add(graph);
|
|
||||||
pack();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void act(float delta) {
|
|
||||||
if (audioData != null) {
|
|
||||||
graph.setAudioDataIndex(audioData.getReadIndex());
|
|
||||||
}
|
|
||||||
super.act(delta);
|
|
||||||
}
|
|
||||||
|
|
||||||
public AudioGraph getGraph() {
|
|
||||||
return graph;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setData(FloatArray dataSet1, FloatArray dataSet2, CoreMusicInfo audioData) {
|
|
||||||
this.audioData = audioData;
|
|
||||||
graph.setGraphingData(dataSet1, dataSet2);
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user