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 { 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:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion" compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion" compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
compile "com.badlogicgames.box2dlights:box2dlights:$box2DLightsVersion" 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 "org.apache.commons:commons-math3:3.2"
compile "com.github.rwl:jtransforms:2.4.0" compile "com.github.rwl:jtransforms:2.4.0"

View File

@ -74,18 +74,6 @@ public class Mp3AudioData implements AudioData {
public void reset() { public void reset() {
if (playbackMusic != null) { if (playbackMusic != null) {
playbackMusic.stop(); 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,13 +136,17 @@ public class Mp3AudioData implements AudioData {
@Override @Override
public void dispose() { public void dispose() {
reset();
playbackMusic.dispose(); playbackMusic.dispose();
if (din != null) {
try { try {
din.close();
in.close(); in.close();
} catch (IOException e) { } catch (IOException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} }
} }
}
} }

View File

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

View File

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