ao iniciar um jogo carrego o somdefundo que fica rodando infinitamente. o problema eh quando mando rodar o somSoco ou somChute ele não tá funcionando? ou seja, o som do soco ou chute não executa.
ACHO QUE O PROBLEMA ERA PORQUE EU ESTAVA TENTANDO EXECUTAR DOIS ARQUIVOS MIDI. NO CASO TERIA QUE SER O MIDI PARA SOM DE FUNDO E WAV PARA OS GOLPES ,MAS, MESMO ASSIM NAO TA FUNCINANDO DEVERIA MAS NAO TÁ
public void inicializarMusica() {
if (p==null){
try{
InputStream in = getClass().getResourceAsStream ("/musicadefundo.mid");
this.p = Manager.createPlayer(in, "audio/midi"); // Instanciando Varialvel
this.p.setLoopCount(-1); //loop infinito
}
catch (Exception e){};
}
}
public void iniciarMusica() {
try {this.p.start();} catch (MediaException e) {}
}
public void pausarMusica(){
try { p.stop(); } catch ( MediaException e) {}
}
/* carrega os sons de soco e chute */
public void inicializarSom(){
try{
InputStream in1 = getClass().getResourceAsStream("/soco.mid");
this.p1 = Manager.createPlayer(in1, "audio/midi");
InputStream in2 = getClass().getResourceAsStream("/chute.mid");
this.p2 = Manager.createPlayer(in2, "audio/midi");
}
catch (Exception e){}
}
/*executa o som de soco*/
public void somSoco(){
try {p1.start();} catch (MediaException e) {}
}
/* executa o som de chute */
public void somChute(){
try {p2.start();} catch (MediaException e) {}
}
PS.: estou usando emulador da motorola