The code sample below describes how to play two sounds at the same
time. This feature is supported by the Sony Ericsson JP-5 platform and
onwards.
Only one wav file can be played simultaniously but several midi files
might be played at the same time. The number of existing players is
only limited by available memory, and you have the possibility to play
more than one player at the same time. The example below shows how to
do this using one midi file and one wav file.
The code is straight-forward - just load the resource, create the player and start playing the file.
Here's the sample:
InputStream is = getClass().getResourceAsStream(file);
InputStream is1 = getClass().getResourceAsStream(file1);
player = Manager.createPlayer(is, " audio/midi");
player.setLoopCount(-1);
player.prefetch();
player.realize();
player1 = Manager.createPlayer(is1, "audio/x-wav");
player1.setLoopCount(1);
player1.prefetch();
player1.realize();
player.start();
player1.start();
example code