began work on making mp3spi work with libgdx

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

View File

@ -79,14 +79,15 @@ project(":core") {
dependencies {
compile group: 'com.googlecode.soundlibs', name: 'jlayer', version: '1.0.1.4'
compile group: 'com.googlecode.soundlibs', name: 'mp3spi', version: '1.9.5.4'
compile "com.badlogicgames.gdx:gdx:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
compile "com.badlogicgames.box2dlights:box2dlights:$box2DLightsVersion"
compile group: 'com.googlecode.soundlibs', name: 'mp3spi', version: '1.9.5-1'
compile group: 'com.googlecode.soundlibs', name: 'jlayer', version: '1.0.1-1'
compile "org.apache.commons:commons-math3:3.2"
compile "com.github.rwl:jtransforms:2.4.0"

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);