analysis now functions; music starts playing instantly after pressing

the begin button
This commit is contained in:
2018-09-05 19:55:48 -05:00
parent 49a441132d
commit eb384e82ae
3 changed files with 30 additions and 4 deletions

View File

@@ -133,6 +133,7 @@ public class AnalysisPage extends Page {
AudioAnalyzerSection midSection = new AudioAnalyzerSection(7, 25, 1.5f, 3);
audioAnalyzer = new DynamicAudioAnalyzer(mc.getMusicList().newAudioProcessor(mc.getCurrentMusicFileHandle()), bass, midSection);
audioAnalyzer.start();
}
@Override

View File

@@ -15,6 +15,7 @@ import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.InputListener;
import com.badlogic.gdx.scenes.scene2d.ui.Button;
@@ -28,6 +29,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
import com.badlogic.gdx.scenes.scene2d.ui.VerticalGroup;
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable;
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.ChangeEvent;
import com.badlogic.gdx.utils.Align;
import com.badlogic.gdx.utils.Array;
@@ -118,8 +120,16 @@ public class MusicSelectionPage extends Page implements Observer {
addActor(musicInfoTable);
beginButton = new TextButton("Begin", skin);
beginButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
if (musicSelectDelay != 0) {
mc.setMusicByFileHandle(getSelectedMusic());
musicSelectDelay = 0f;
}
}
});
beginButton.addListener(beginButtonListener);
mmc.addObserver(this);
mc.addObserver(this);
mc.getMusicList().addObserver(this);