www.jpct.net

jPCT-AE - a 3d engine for Android => Support => Topic started by: ggp on February 14, 2014, 01:06:50 pm

Title: solved stop soundpool
Post by: ggp on February 14, 2014, 01:06:50 pm
I know isn't jpc-ae but it is helpful  :D

Add functions at class SoundManager

Code: [Select]
public synchronized int playID(int id) {
if (res == null || GameConfig.soundMul == 0) {
return 0;
}
times[id] = Ticker.getTime();
return soundPool.play(ids[id], 0.75f * GameConfig.soundMul, 0.75f * GameConfig.soundMul, 0, 0, 1);
}

public synchronized void stopID(int id) {
if (res == null || GameConfig.soundMul == 0) {
return;
}
soundPool.stop(id);

}


Code: [Select]

private int mStreamId;

//for play
mStreamId=SoundManager.getInstance().playID(SoundManager.COLLECTED);

//for stop
SoundManager.getInstance().stopID(mStreamId);