fixed memory leak (ther is still one left who can cause an native crash...)
This commit is contained in:
parent
f78dc29751
commit
560f579d2d
@ -59,6 +59,9 @@ public class AudioDataManager {
|
||||
public boolean initialize(GameSettings settings, MediaPlayer player) {
|
||||
try {
|
||||
this.player = player;
|
||||
if (settings.getAudioFile() == null) {
|
||||
settings.setAudioFile(settings.getVideoFile());
|
||||
}
|
||||
SampleBuffer samples = SampleHelper.createSampleBuffer(
|
||||
DecoderFactory.create(settings.getAudioFile()));
|
||||
this.samplingRate = samples.samplingRate;
|
||||
@ -67,6 +70,7 @@ public class AudioDataManager {
|
||||
this.audioProcessorHighBand = new AudioProcessor(samples, HIGH_BAND);
|
||||
return true;
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -240,4 +244,12 @@ public class AudioDataManager {
|
||||
lastSpawnDataPollIndex = index;
|
||||
return data;
|
||||
}
|
||||
|
||||
public void cleanup() {
|
||||
speedData = null;
|
||||
// movementData = null;
|
||||
flashData = null;
|
||||
groundMoveData = null;
|
||||
spawnData = null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -207,6 +207,7 @@ public class GameState extends AbstractAppState implements GameListener, ActionL
|
||||
ground = null;
|
||||
cinema = null;
|
||||
starManager = null;
|
||||
audioDataManager.cleanup();
|
||||
}
|
||||
|
||||
public DirectMediaPlayer getMediaPlayer() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user