fixed issue with data cleaning thread crashing

This commit is contained in:
Harrison Deng 2017-09-01 02:07:29 -05:00
parent e15d571848
commit d00f434275
16 changed files with 63 additions and 65 deletions

View File

@ -3,7 +3,7 @@ package zero1hd.rhythmbullet.audio;
import com.badlogic.gdx.files.FileHandle; import com.badlogic.gdx.files.FileHandle;
public class Audio { public class Audio {
public static BasicMusicInfo getAudioData(FileHandle file) { public static CoreMusicInfo getAudioData(FileHandle file) {
if (file.extension().equalsIgnoreCase("wav")) { if (file.extension().equalsIgnoreCase("wav")) {
return new WavAudioData(file); return new WavAudioData(file);
} else if (file.extension().equalsIgnoreCase("mp3")) { } else if (file.extension().equalsIgnoreCase("mp3")) {

View File

@ -14,7 +14,7 @@ public class AudioAnalyzer {
private boolean containsData; private boolean containsData;
private boolean finalized; private boolean finalized;
FloatFFT_1D fft; FloatFFT_1D fft;
private BasicMusicInfo audioData; private CoreMusicInfo musicInfo;
float[] audioPCM; float[] audioPCM;
float[] spectrum; float[] spectrum;
@ -63,7 +63,7 @@ public class AudioAnalyzer {
analysisAlgorithm = () -> { analysisAlgorithm = () -> {
progress = 0; progress = 0;
int tasksDone = 0; int tasksDone = 0;
long totalTasks = audioData.getSampleCount()/audioData.getReadWindowSize(); long totalTasks = musicInfo.getSampleCount()/musicInfo.getReadWindowSize();
bassThresholdMultiplier = 1.5f; bassThresholdMultiplier = 1.5f;
mThresholdMultiplier = 1.4f; mThresholdMultiplier = 1.4f;
@ -82,7 +82,7 @@ public class AudioAnalyzer {
mThresholdCalcRange = thresholdRangeCalc(0.4f); mThresholdCalcRange = thresholdRangeCalc(0.4f);
umThresholdCalcRange = thresholdRangeCalc(0.4f); umThresholdCalcRange = thresholdRangeCalc(0.4f);
Gdx.app.debug("Read freq", String.valueOf(audioData.getSampleRate())); Gdx.app.debug("Read freq", String.valueOf(musicInfo.getSampleRate()));
Gdx.app.debug("Using following bin ranges", "\nBass freq begin: " + bassBinBegin + "\nBass freq end: " + bassBinEnd + "\nMain freq begin: " + umBinBegin + "\nMain freq end: " + umBinEnd); Gdx.app.debug("Using following bin ranges", "\nBass freq begin: " + bassBinBegin + "\nBass freq end: " + bassBinEnd + "\nMain freq begin: " + umBinBegin + "\nMain freq end: " + umBinEnd);
Gdx.app.debug("Total tasks", String.valueOf(totalTasks)); Gdx.app.debug("Total tasks", String.valueOf(totalTasks));
@ -91,10 +91,10 @@ public class AudioAnalyzer {
Gdx.app.debug("Threshold Calc Range M", String.valueOf(umThresholdCalcRange)); Gdx.app.debug("Threshold Calc Range M", String.valueOf(umThresholdCalcRange));
Gdx.app.debug("Threshold Calc Range Bass", String.valueOf(bassThresholdCalcRange)); Gdx.app.debug("Threshold Calc Range Bass", String.valueOf(bassThresholdCalcRange));
fft = new FloatFFT_1D(audioData.getReadWindowSize()); fft = new FloatFFT_1D(musicInfo.getReadWindowSize());
int seedDigit = 0; int seedDigit = 0;
while (audioData.readSamples(audioPCM) > 0 && work) { while (musicInfo.readSamples(audioPCM) > 0 && work) {
fft.realForward(audioPCM); fft.realForward(audioPCM);
@ -188,7 +188,6 @@ public class AudioAnalyzer {
Gdx.app.debug("Audio Analyzer", "Threshold calculated."); Gdx.app.debug("Audio Analyzer", "Threshold calculated.");
//pruning data //pruning data
float prunnedCurrentVal; float prunnedCurrentVal;
FloatArray bassPrunned = new FloatArray(); FloatArray bassPrunned = new FloatArray();
@ -218,7 +217,7 @@ public class AudioAnalyzer {
} }
Gdx.app.debug("Audio Analyzer", "Data prunned."); Gdx.app.debug("Audio Analyzer", "Data prunned.");
secondsPerWindow = audioData.getReadWindowSize()/audioData.getSampleRate(); secondsPerWindow = musicInfo.getReadWindowSize()/musicInfo.getSampleRate();
//peak detection //peak detection
int lastID = 0; int lastID = 0;
@ -289,16 +288,20 @@ public class AudioAnalyzer {
pack = new AudioDataPackage(); pack = new AudioDataPackage();
pack.setBassData(bassPeaks, bassMaxValue, bassAvg); pack.setBassData(bassPeaks, bassMaxValue, bassAvg);
pack.setmPeaks(mPeaks, mMaxValue, mAvg); pack.setmData(mPeaks, mMaxValue, mAvg);
pack.setUmPeaks(umPeaks, umMaxValue, umAvg); pack.setUmData(umPeaks, umMaxValue, umAvg);
pack.setPUID(PUID); pack.setPUID(PUID);
pack.setAvgSPB(avgSPB); pack.setAvgSPB(avgSPB);
pack.setSecPerWin(secondsPerWindow); pack.setSecPerWin(secondsPerWindow);
pack.setMusicInfo(musicInfo);
sender.send(MiniEvents.MUSIC_DATA_CLEANED); if (work) {
finalized = true;
Gdx.app.debug("Audio Analyzer", "data cleaned and ready for map gen.");
sender.send(MiniEvents.MUSIC_DATA_CLEANED);
}
}; };
} }
public void shrinkData() { public void shrinkData() {
@ -307,11 +310,11 @@ public class AudioAnalyzer {
umSpectralFlux = null; umSpectralFlux = null;
} }
public void startAnalyticalThread(BasicMusicInfo audiofile) { public void startAnalyticalThread(CoreMusicInfo audiofile) {
audioPCM = new float[audiofile.getReadWindowSize()]; audioPCM = new float[audiofile.getReadWindowSize()];
spectrum = new float[(audiofile.getReadWindowSize()/2)+1]; spectrum = new float[(audiofile.getReadWindowSize()/2)+1];
lastSpectrum = new float[(audiofile.getReadWindowSize()/2)+1]; lastSpectrum = new float[(audiofile.getReadWindowSize()/2)+1];
this.audioData = audiofile; this.musicInfo = audiofile;
work = true; work = true;
ExecutorService exec = Executors.newSingleThreadExecutor(); ExecutorService exec = Executors.newSingleThreadExecutor();
@ -342,7 +345,7 @@ public class AudioAnalyzer {
} }
private int thresholdRangeCalc(float durationOfRange) { private int thresholdRangeCalc(float durationOfRange) {
return (int) (durationOfRange/(audioData.getReadWindowSize()/audioData.getSampleRate())); return (int) (durationOfRange/(musicInfo.getReadWindowSize()/musicInfo.getSampleRate()));
} }
public float getBassMaxValue() { public float getBassMaxValue() {
@ -377,8 +380,8 @@ public class AudioAnalyzer {
return PUID; return PUID;
} }
public BasicMusicInfo getAudioData() { public CoreMusicInfo getAudioData() {
return audioData; return musicInfo;
} }
public float getAvgSPB() { public float getAvgSPB() {

View File

@ -9,7 +9,7 @@ public class AudioDataPackage {
private FloatArray mPeaks; private FloatArray mPeaks;
private FloatArray umPeaks; private FloatArray umPeaks;
private BasicMusicInfo musicInfo; private CoreMusicInfo musicInfo;
private float bassMaxVal, bassAvg; private float bassMaxVal, bassAvg;
private float mMaxVal, mAvg; private float mMaxVal, mAvg;
@ -25,13 +25,12 @@ public class AudioDataPackage {
* @param bassAvg * @param bassAvg
*/ */
public void setBassData(FloatArray bassPeaks, float bassMaxVal, float bassAvg) { public void setBassData(FloatArray bassPeaks, float bassMaxVal, float bassAvg) {
if (bassPeaks != null) { if (this.bassPeaks != null) {
this.bassPeaks = bassPeaks;
this.bassMaxVal = bassMaxVal;
this.bassAvg = bassAvg;
} else {
throw new InvalidParameterException("The bass peaks of this audio pack has already been set."); throw new InvalidParameterException("The bass peaks of this audio pack has already been set.");
} }
this.bassPeaks = bassPeaks;
this.bassMaxVal = bassMaxVal;
this.bassAvg = bassAvg;
} }
/** /**
@ -40,8 +39,8 @@ public class AudioDataPackage {
* @param mMaxVal * @param mMaxVal
* @param mAvg * @param mAvg
*/ */
public void setmPeaks(FloatArray mPeaks, float mMaxVal, float mAvg) { public void setmData(FloatArray mPeaks, float mMaxVal, float mAvg) {
if (mPeaks != null) { if (this.mPeaks != null) {
throw new InvalidParameterException("The midrange peaks of this audio pack has already been set."); throw new InvalidParameterException("The midrange peaks of this audio pack has already been set.");
} }
@ -56,8 +55,8 @@ public class AudioDataPackage {
* @param uMMaxVal * @param uMMaxVal
* @param uMAvg * @param uMAvg
*/ */
public void setUmPeaks(FloatArray umPeaks, float uMMaxVal, float uMAvg) { public void setUmData(FloatArray umPeaks, float uMMaxVal, float uMAvg) {
if (umPeaks != null) { if (this.umPeaks != null) {
throw new InvalidParameterException("The upper midrange peaks have already been set."); throw new InvalidParameterException("The upper midrange peaks have already been set.");
} }
this.umPeaks = umPeaks; this.umPeaks = umPeaks;
@ -65,8 +64,8 @@ public class AudioDataPackage {
this.uMAvg = uMAvg; this.uMAvg = uMAvg;
} }
public void setMusicInfo(BasicMusicInfo musicInfo) { public void setMusicInfo(CoreMusicInfo musicInfo) {
if (musicInfo != null) { if (this.musicInfo != null) {
throw new InvalidParameterException("There is already music information in this package."); throw new InvalidParameterException("There is already music information in this package.");
} }
this.musicInfo = musicInfo; this.musicInfo = musicInfo;
@ -109,7 +108,7 @@ public class AudioDataPackage {
} }
} }
public BasicMusicInfo getMusicInfo() { public CoreMusicInfo getMusicInfo() {
if (musicInfo == null) { if (musicInfo == null) {
throw new NullPointerException("Music info hasn't been baked in..."); throw new NullPointerException("Music info hasn't been baked in...");
} }

View File

@ -4,7 +4,7 @@ package zero1hd.rhythmbullet.audio;
import com.badlogic.gdx.audio.Music; import com.badlogic.gdx.audio.Music;
import com.badlogic.gdx.utils.Disposable; import com.badlogic.gdx.utils.Disposable;
public interface BasicMusicInfo extends Disposable { public interface CoreMusicInfo extends Disposable {
/** /**
* sets a integer variable to the current window of audio data the playback is at. * sets a integer variable to the current window of audio data the playback is at.
* Useful for efficiency because we compute once for that frame then get the values everytime it is required instead of calculating every time we get the index. * Useful for efficiency because we compute once for that frame then get the values everytime it is required instead of calculating every time we get the index.

View File

@ -20,7 +20,7 @@ import javazoom.jl.decoder.Header;
import javazoom.jl.decoder.MP3Decoder; import javazoom.jl.decoder.MP3Decoder;
import javazoom.jl.decoder.OutputBuffer; import javazoom.jl.decoder.OutputBuffer;
public class Mp3AudioData implements BasicMusicInfo { public class Mp3AudioData implements CoreMusicInfo {
private int readWindowSize = 1024; private int readWindowSize = 1024;
private Music playbackMusic; private Music playbackMusic;

View File

@ -11,7 +11,7 @@ import com.badlogic.gdx.files.FileHandle;
import zero1hd.wavedecoder.WavDecoder; import zero1hd.wavedecoder.WavDecoder;
public class WavAudioData implements BasicMusicInfo { public class WavAudioData implements CoreMusicInfo {
private int readWindowSize = 1024; private int readWindowSize = 1024;
private AudioFormat format; private AudioFormat format;
int readIndex; int readIndex;

View File

@ -1,13 +1,13 @@
package zero1hd.rhythmbullet.audio.map; package zero1hd.rhythmbullet.audio.map;
import zero1hd.rhythmbullet.audio.BasicMusicInfo; import zero1hd.rhythmbullet.audio.CoreMusicInfo;
import zero1hd.rhythmbullet.entity.Entity; import zero1hd.rhythmbullet.entity.Entity;
import zero1hd.rhythmbullet.entity.EntityFrame; import zero1hd.rhythmbullet.entity.EntityFrame;
import zero1hd.rhythmbullet.entity.coordinator.Coordinator; import zero1hd.rhythmbullet.entity.coordinator.Coordinator;
import zero1hd.rhythmbullet.entity.coordinator.CoordinatorFrame; import zero1hd.rhythmbullet.entity.coordinator.CoordinatorFrame;
public class GamePlayMap { public class GamePlayMap {
private BasicMusicInfo musicData; private CoreMusicInfo musicData;
private MapWindowData[] spawnList; private MapWindowData[] spawnList;
private boolean building; private boolean building;
private int index; private int index;
@ -17,7 +17,7 @@ public class GamePlayMap {
* GamePlayMap is what the game area will use to generate entities and judge current audio data * GamePlayMap is what the game area will use to generate entities and judge current audio data
* @param audioData audio data * @param audioData audio data
*/ */
public GamePlayMap(BasicMusicInfo audioData, int totalWindows) { public GamePlayMap(CoreMusicInfo audioData, int totalWindows) {
this.musicData = audioData; this.musicData = audioData;
spawnList = new MapWindowData[totalWindows]; spawnList = new MapWindowData[totalWindows];
hudType = new byte[totalWindows]; hudType = new byte[totalWindows];
@ -68,7 +68,7 @@ public class GamePlayMap {
index = spawnList.length-1; index = spawnList.length-1;
} }
public BasicMusicInfo getMusicData() { public CoreMusicInfo getMusicData() {
return musicData; return musicData;
} }

View File

@ -153,8 +153,4 @@ public class RhythmMapAlgorithm implements Runnable {
public MiniSender getSender() { public MiniSender getSender() {
return sender; return sender;
} }
public EntityManager getEm() {
return em;
}
} }

View File

@ -13,7 +13,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.ImageButton;
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
import zero1hd.rhythmbullet.RhythmBullet; import zero1hd.rhythmbullet.RhythmBullet;
import zero1hd.rhythmbullet.audio.BasicMusicInfo; import zero1hd.rhythmbullet.audio.CoreMusicInfo;
import zero1hd.rhythmbullet.audio.map.GamePlayMap; import zero1hd.rhythmbullet.audio.map.GamePlayMap;
import zero1hd.rhythmbullet.stages.GamePlayArea; import zero1hd.rhythmbullet.stages.GamePlayArea;
import zero1hd.rhythmbullet.stages.ui.GameHUD; import zero1hd.rhythmbullet.stages.ui.GameHUD;
@ -26,7 +26,7 @@ public class GameScreen extends ScreenAdapter {
public RhythmBullet core; public RhythmBullet core;
private BasicMusicInfo music; private CoreMusicInfo music;
SpriteBatch bgBatch; SpriteBatch bgBatch;
private ShaderProgram bgShader; private ShaderProgram bgShader;

View File

@ -18,7 +18,7 @@ import com.badlogic.gdx.utils.Align;
import zero1hd.rhythmbullet.RhythmBullet; import zero1hd.rhythmbullet.RhythmBullet;
import zero1hd.rhythmbullet.audio.AudioAnalyzer; import zero1hd.rhythmbullet.audio.AudioAnalyzer;
import zero1hd.rhythmbullet.audio.BasicMusicInfo; import zero1hd.rhythmbullet.audio.CoreMusicInfo;
import zero1hd.rhythmbullet.audio.AudioInfo; import zero1hd.rhythmbullet.audio.AudioInfo;
import zero1hd.rhythmbullet.audio.map.GamePlayMap; import zero1hd.rhythmbullet.audio.map.GamePlayMap;
import zero1hd.rhythmbullet.audio.map.RhythmMapAlgorithm; import zero1hd.rhythmbullet.audio.map.RhythmMapAlgorithm;
@ -31,7 +31,7 @@ public class AnalyzePage extends Page implements MiniListener {
private AnalyzePage ap = this; private AnalyzePage ap = this;
AudioAnalyzer audioAnalyzer; AudioAnalyzer audioAnalyzer;
BasicMusicInfo music; CoreMusicInfo music;
RhythmMapAlgorithm mapGenAlgorithm; RhythmMapAlgorithm mapGenAlgorithm;
private Table songInfo; private Table songInfo;
@ -86,7 +86,7 @@ public class AnalyzePage extends Page implements MiniListener {
@Override @Override
public void changed(ChangeEvent event, Actor actor) { public void changed(ChangeEvent event, Actor actor) {
sensitivityRatingTitle.setText("Base Difficulty: " + MathUtils.round(sensitivityRating.getValue()*100) +"%"); sensitivityRatingTitle.setText("Base Difficulty: " + MathUtils.round(sensitivityRating.getValue()*100) + "%");
} }
}); });
@ -185,7 +185,7 @@ public class AnalyzePage extends Page implements MiniListener {
addActor(back); addActor(back);
} }
public void setSong(BasicMusicInfo music, AudioInfo audioInfo, MiniListener listener) { public void setSong(CoreMusicInfo music, AudioInfo audioInfo, MiniListener listener) {
confirmed = false; confirmed = false;
confirmDiffButton.setDisabled(false); confirmDiffButton.setDisabled(false);
sensitivityRating.setDisabled(false); sensitivityRating.setDisabled(false);

View File

@ -4,12 +4,12 @@ import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.scenes.scene2d.ui.Window; import com.badlogic.gdx.scenes.scene2d.ui.Window;
import com.badlogic.gdx.utils.FloatArray; import com.badlogic.gdx.utils.FloatArray;
import zero1hd.rhythmbullet.audio.BasicMusicInfo; import zero1hd.rhythmbullet.audio.CoreMusicInfo;
import zero1hd.rhythmbullet.ui.builders.AudioGraph; import zero1hd.rhythmbullet.ui.builders.AudioGraph;
public class BassUMGraphWindow extends Window { public class BassUMGraphWindow extends Window {
AudioGraph graph; AudioGraph graph;
BasicMusicInfo audioData; CoreMusicInfo audioData;
public BassUMGraphWindow(String title, Skin skin) { public BassUMGraphWindow(String title, Skin skin) {
super(title, skin, "tinted"); super(title, skin, "tinted");
@ -30,7 +30,7 @@ public class BassUMGraphWindow extends Window {
return graph; return graph;
} }
public void setData(FloatArray dataSet1, FloatArray dataSet2, BasicMusicInfo audioData) { public void setData(FloatArray dataSet1, FloatArray dataSet2, CoreMusicInfo audioData) {
this.audioData = audioData; this.audioData = audioData;
graph.setGraphingData(dataSet1, dataSet2); graph.setGraphingData(dataSet1, dataSet2);
} }

View File

@ -10,12 +10,12 @@ import com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup;
import com.badlogic.gdx.scenes.scene2d.ui.Window; import com.badlogic.gdx.scenes.scene2d.ui.Window;
import zero1hd.rhythmbullet.audio.AudioDataPackage; import zero1hd.rhythmbullet.audio.AudioDataPackage;
import zero1hd.rhythmbullet.audio.BasicMusicInfo; import zero1hd.rhythmbullet.audio.CoreMusicInfo;
public class BeatViewer extends Window { public class BeatViewer extends Window {
Pixmap lights; Pixmap lights;
int songIndex; int songIndex;
BasicMusicInfo music; CoreMusicInfo music;
Texture lightOn; Texture lightOn;
private AudioDataPackage data; private AudioDataPackage data;
@ -125,7 +125,7 @@ public class BeatViewer extends Window {
super.act(delta); super.act(delta);
} }
public void setMusic(BasicMusicInfo audioData, AudioDataPackage adp) { public void setMusic(CoreMusicInfo audioData, AudioDataPackage adp) {
this.music = audioData; this.music = audioData;
this.data = adp; this.data = adp;
} }

View File

@ -4,12 +4,12 @@ import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.scenes.scene2d.ui.Window; import com.badlogic.gdx.scenes.scene2d.ui.Window;
import com.badlogic.gdx.utils.FloatArray; import com.badlogic.gdx.utils.FloatArray;
import zero1hd.rhythmbullet.audio.BasicMusicInfo; import zero1hd.rhythmbullet.audio.CoreMusicInfo;
import zero1hd.rhythmbullet.ui.builders.AudioGraph; import zero1hd.rhythmbullet.ui.builders.AudioGraph;
public class MGraphWindow extends Window { public class MGraphWindow extends Window {
private AudioGraph graph; private AudioGraph graph;
private BasicMusicInfo audioData; private CoreMusicInfo audioData;
public MGraphWindow(String title, Skin skin) { public MGraphWindow(String title, Skin skin) {
super(title, skin, "tinted"); super(title, skin, "tinted");
@ -30,7 +30,7 @@ public class MGraphWindow extends Window {
return graph; return graph;
} }
public void setData(FloatArray dataSet1, FloatArray dataSet2, BasicMusicInfo audioData) { public void setData(FloatArray dataSet1, FloatArray dataSet2, CoreMusicInfo audioData) {
this.audioData = audioData; this.audioData = audioData;
graph.setGraphingData(dataSet1, dataSet2); graph.setGraphingData(dataSet1, dataSet2);
} }

View File

@ -15,13 +15,13 @@ import com.badlogic.gdx.scenes.scene2d.ui.Window;
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import zero1hd.rhythmbullet.audio.BasicMusicInfo; import zero1hd.rhythmbullet.audio.CoreMusicInfo;
public class MusicController extends Window implements OnCompletionListener { public class MusicController extends Window implements OnCompletionListener {
Skin skin; Skin skin;
private Image togglePlay; private Image togglePlay;
private TextField info; private TextField info;
private BasicMusicInfo audiofile; private CoreMusicInfo audiofile;
public MusicController(final Skin skin) { public MusicController(final Skin skin) {
super("Playback Controller", skin, "tinted"); super("Playback Controller", skin, "tinted");
@ -110,7 +110,7 @@ public class MusicController extends Window implements OnCompletionListener {
setSize(260, 75); setSize(260, 75);
} }
public void setAudiofile(BasicMusicInfo audiofile) { public void setAudiofile(CoreMusicInfo audiofile) {
this.audiofile = audiofile; this.audiofile = audiofile;
if (audiofile == null) { if (audiofile == null) {
togglePlay.setDrawable(skin.getDrawable("loading")); togglePlay.setDrawable(skin.getDrawable("loading"));
@ -125,7 +125,7 @@ public class MusicController extends Window implements OnCompletionListener {
} }
} }
public BasicMusicInfo getAudiofile() { public CoreMusicInfo getAudiofile() {
return audiofile; return audiofile;
} }

View File

@ -12,7 +12,7 @@ import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.Array;
import zero1hd.rhythmbullet.audio.Audio; import zero1hd.rhythmbullet.audio.Audio;
import zero1hd.rhythmbullet.audio.BasicMusicInfo; import zero1hd.rhythmbullet.audio.CoreMusicInfo;
import zero1hd.rhythmbullet.util.MiniEvents; import zero1hd.rhythmbullet.util.MiniEvents;
import zero1hd.rhythmbullet.util.MiniSender; import zero1hd.rhythmbullet.util.MiniSender;
@ -95,7 +95,7 @@ public class MusicSelector extends Window {
return isBack; return isBack;
} }
public BasicMusicInfo getSelectedMusic() { public CoreMusicInfo getSelectedMusic() {
if (selectedMusic != null) { if (selectedMusic != null) {
return Audio.getAudioData(selectedMusic); return Audio.getAudioData(selectedMusic);
} else { } else {

View File

@ -9,7 +9,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.Slider;
import com.badlogic.gdx.scenes.scene2d.ui.Window; import com.badlogic.gdx.scenes.scene2d.ui.Window;
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
import zero1hd.rhythmbullet.audio.BasicMusicInfo; import zero1hd.rhythmbullet.audio.CoreMusicInfo;
public class VolumeWindow extends Window { public class VolumeWindow extends Window {
@ -17,7 +17,7 @@ public class VolumeWindow extends Window {
private Slider musicVolSlider; private Slider musicVolSlider;
private Preferences prefs; private Preferences prefs;
private BasicMusicInfo music; private CoreMusicInfo music;
public VolumeWindow(String title, Skin skin, Preferences prefs) { public VolumeWindow(String title, Skin skin, Preferences prefs) {
super(title, skin, "tinted"); super(title, skin, "tinted");
this.prefs = prefs; this.prefs = prefs;
@ -67,7 +67,7 @@ public class VolumeWindow extends Window {
prefs.flush(); prefs.flush();
} }
public void setMusic(BasicMusicInfo music) { public void setMusic(CoreMusicInfo music) {
this.music = music; this.music = music;
if (music != null) { if (music != null) {
music.getPlaybackMusic().setVolume(prefs.getFloat("music vol")/100f); music.getPlaybackMusic().setVolume(prefs.getFloat("music vol")/100f);