Ola galera,
Alguém conhece algum framework bom de som ao qual eu possa executar vários sons num aplicativo?!
abraço,
Ola galera,
Alguém conhece algum framework bom de som ao qual eu possa executar vários sons num aplicativo?!
abraço,
Ola galera,Alguém conhece algum framework bom de som ao qual eu possa executar vários sons num aplicativo?!
abraço,
Tente o jLayer
http://www.javazoom.net/javalayer/javalayer.html
Eu pequeno exemplo para tocar MP3, só não lembro onde achei :D
public class MP3 {
private String filename;
private Player player;
private boolean isPlaying;
// constructor that takes the name of an MP3 file
public MP3(String filename) {
this.filename = filename;
isPlaying=false;
}
public boolean isPlaying(){
return isPlaying;
}
public void close() { if (player != null) player.close(); }
// play the MP3 file to the sound card
public void play() {
for (Audio audio : Dados.audios) {
if (audio!=null)
audio.stop();
}
try {
FileInputStream fis = new FileInputStream(filename);
BufferedInputStream bis = new BufferedInputStream(fis);
player = new Player(bis);
}
catch (Exception e) {
System.out.println("Problem playing file " + filename);
System.out.println(e);
}
new Thread() {
public void run() {
try {
isPlaying=true;
player.play();
isPlaying=false;
}
catch (Exception e) { System.out.println(e); }
}
}.start();
}
}