began work on making mp3spi work with libgdx

This commit is contained in:
2017-05-29 00:42:34 -05:00
parent 68422f0453
commit 2821db605e
4 changed files with 17 additions and 20 deletions

View File

@@ -74,18 +74,6 @@ public class Mp3AudioData implements AudioData {
public void reset() {
if (playbackMusic != null) {
playbackMusic.stop();
playbackMusic.dispose();
playbackMusic = null;
}
if (din != null) {
try {
din.close();
in.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
@@ -148,12 +136,16 @@ public class Mp3AudioData implements AudioData {
@Override
public void dispose() {
reset();
playbackMusic.dispose();
try {
in.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
if (din != null) {
try {
din.close();
in.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}

View File

@@ -76,6 +76,7 @@ public class WavAudioData implements AudioData {
@Override
public void dispose() {
reset();
playbackMusic.dispose();
decoder.cleanAndClose();
}

View File

@@ -203,6 +203,9 @@ public class CreativeStage extends Stage implements MiniListener {
beatViewer.setMusic(null, null);
volumeWindow.setMusic(null);
graphViewer.setData(null, null, null);
if (musicPlayBackControls.getAudiofile() != null) {
musicPlayBackControls.getAudiofile().dispose();
}
musicPlayBackControls.setAudiofile(null);
analyzer = new AudioAnalyzer();
analyzer.sender.addListener(this);