I use the library from Javazoom to play my ogg and mp3.
On my Athlon64@3.2 + XP it works very well but on my iBook G4@1.33 with Tiger I have a lag of one second, which is unacceptable.
When I load a song for the first time:
// Instantiate BasicPlayer.
player = new BasicPlayer();
// BasicPlayer is a BasicController.
BasicController control = (BasicController) player;
try {
// Open file, or URL or Stream (shoutcast) to play.
control.open(new File(mediaPath));
} catch (BasicPlayerException ex) {
ex.printStackTrace();
}
When I ask for the song to be played:
public void play() {
// BasicPlayer is a BasicController.
BasicController control = (BasicController) player;
try {
// Start playback in a thread.
control.play();
// Set Volume (0 to 1.0).
// setGain should be called after control.play().
control.setGain(volume);
// Set Pan (-1.0 to 1.0).
// setPan should be called after control.play().
control.setPan(0.0);
}
catch (BasicPlayerException e) {
e.printStackTrace();
}
}
The problem comes certainly from the thread creation, isn’t it ? Have you an other option for me ?
Regards,
Bernard.