| Author |
PLAY several players simulaneouly ?
|
Ould Nadif
Ranch Hand
Joined: Jan 21, 2004
Posts: 184
|
|
Hi all, I would like play severals songs simulaneous. I could play both individually. How can i do to play severals simulaneouly. I tried that code but it failed: Player pMIDI, pMP3; InputStream isMIDI,isMP3; isMIDI = getClass().getResourceAsStream("/test.mid"); isMP3 = getClass().getResourceAsStream("/test.mp3"); pMIDI = Manager.createPlayer(isMIDI,"audio/midi"); pMP3 = Manager.createPlayer(isMP3,"audio/mpeg"); pMIDI .start(); pMP3.start(); OULD NADIF
|
We are ones that build the world, thus build it well.
|
 |
Eduardo Marques
Ranch Hand
Joined: Feb 19, 2005
Posts: 231
|
|
You must set the same TimeBase for the two players. It is not guaranteed that this works for all devices/media types, but give it a try: You may obtain the system timebase using: Timebase b = Manager.getSystemTimeBase(); and set it for the players using Player.setTimeBase(). You must set the same TimeBase for all Players you wish to synchronize.
|
Eduardo Marques
Get ready for your SCMAD certification at J2MECertificate.com - See what all the buzz is about ...
|
 |
Eduardo Marques
Ranch Hand
Joined: Feb 19, 2005
Posts: 231
|
|
It may happen that your device does not support simultaneous players though
|
 |
Ould Nadif
Ranch Hand
Joined: Jan 21, 2004
Posts: 184
|
|
Hi all, Thanks you for your reply. By the way I tried your code. I seems that it doesn't work:Maybe somethings are missing: I tried with 6680 Nokia and V600i of sony Ericsson. Both it doesn't work. try{ isMIDI = getClass().getResourceAsStream("/test2.mid"); isMP3 = getClass().getResourceAsStream("/test.mp3"); pMIDI = Manager.createPlayer(isMIDI,"audio/midi"); b = Manager.getSystemTimeBase(); pMIDI.setTimeBase(b); pMP3 = Manager.createPlayer(isMP3,"audio/mpeg"); pMP3.setTimeBase(b); pMIDI.start(); pMP3.start(); } catch (Exception ioe) { System.out.println( "Pb avec le stockage"); ioe.printStackTrace(); } Thanks in advance for your help. OULD NADIF
|
 |
 |
|
|
subject: PLAY several players simulaneouly ?
|
|
|