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) {
|
public boolean initialize(GameSettings settings, MediaPlayer player) {
|
||||||
try {
|
try {
|
||||||
this.player = player;
|
this.player = player;
|
||||||
|
if (settings.getAudioFile() == null) {
|
||||||
|
settings.setAudioFile(settings.getVideoFile());
|
||||||
|
}
|
||||||
SampleBuffer samples = SampleHelper.createSampleBuffer(
|
SampleBuffer samples = SampleHelper.createSampleBuffer(
|
||||||
DecoderFactory.create(settings.getAudioFile()));
|
DecoderFactory.create(settings.getAudioFile()));
|
||||||
this.samplingRate = samples.samplingRate;
|
this.samplingRate = samples.samplingRate;
|
||||||
@ -67,6 +70,7 @@ public class AudioDataManager {
|
|||||||
this.audioProcessorHighBand = new AudioProcessor(samples, HIGH_BAND);
|
this.audioProcessorHighBand = new AudioProcessor(samples, HIGH_BAND);
|
||||||
return true;
|
return true;
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -240,4 +244,12 @@ public class AudioDataManager {
|
|||||||
lastSpawnDataPollIndex = index;
|
lastSpawnDataPollIndex = index;
|
||||||
return data;
|
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;
|
ground = null;
|
||||||
cinema = null;
|
cinema = null;
|
||||||
starManager = null;
|
starManager = null;
|
||||||
|
audioDataManager.cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
public DirectMediaPlayer getMediaPlayer() {
|
public DirectMediaPlayer getMediaPlayer() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user