J
Jeff
midp 2.0
Java SE 5.0
J2ME version 2.2
Below is a piece of code I've having problems with playing on my handset
(nokia 6630), it starts to play but the then stops... it doesn't finiesh the
song it play for ca 1 second and then stops....
This code below is my trouble code:
try {
System.out.println("Sound block starts");
InputStream is = getClass().getResourceAsStream("/test.mid");
Player player = Manager.createPlayer(is, "audio/midi");
player.start();
System.out.println("Sound block ends");
}
catch (IOException ioe) {
}
catch (MediaException me) {
}
Overview of threads in my midlet:
main thread (threadA)- this thread is listening for responses from the
handset for example....
-> a new thread (threadB) and this is the thread the program is executed
within
It's in the threadB my trouble code is within....
My midlet has 2 threads: threadA, threadB
I created a simple test midlet where my trouble code was executed on main
thread (the midlet had only one thread) and everything works fine...
But why is it playing only 1 second in my trouble code?.... what must I do
to fix this?.... I guess I maybe could have executed the music playing from
the main thread but that again will give me lots of trouble as the sound
should be syncronized with the actions in threadB
Please give me some advice....
Jeff
Java SE 5.0
J2ME version 2.2
Below is a piece of code I've having problems with playing on my handset
(nokia 6630), it starts to play but the then stops... it doesn't finiesh the
song it play for ca 1 second and then stops....
This code below is my trouble code:
try {
System.out.println("Sound block starts");
InputStream is = getClass().getResourceAsStream("/test.mid");
Player player = Manager.createPlayer(is, "audio/midi");
player.start();
System.out.println("Sound block ends");
}
catch (IOException ioe) {
}
catch (MediaException me) {
}
Overview of threads in my midlet:
main thread (threadA)- this thread is listening for responses from the
handset for example....
-> a new thread (threadB) and this is the thread the program is executed
within
It's in the threadB my trouble code is within....
My midlet has 2 threads: threadA, threadB
I created a simple test midlet where my trouble code was executed on main
thread (the midlet had only one thread) and everything works fine...
But why is it playing only 1 second in my trouble code?.... what must I do
to fix this?.... I guess I maybe could have executed the music playing from
the main thread but that again will give me lots of trouble as the sound
should be syncronized with the actions in threadB
Please give me some advice....
Jeff