Hi,
I am getting various problems when playing sounds on both emulator and physical phone.
When I try to play a wav file I get the following error:
java.lang.ClassCastException: com.sun.media.sound.RealTimeSequencer
at com.nokia.phone.sdk.concept.mirrors.mma.media.player.MidiPlayer.doRealize(MidiPlayer.java)
at com.nokia.phone.sdk.concept.mirrors.mma.media.player.TonePlayer.doRealize(TonePlayer.java)
at com.nokia.phone.sdk.concept.mirrors.mma.media.player.BasicPlayer.realize(BasicPlayer.java)
at com.nokia.phone.sdk.concept.mirrors.mma.media.MMAManager.init(MMAManager.java)
at com.nokia.phone.sdk.concept.mirrors.mma.media.MMAManager.createPlayer(MMAManager.java)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.nokia.phone.sdk.concept.gateway.e.a(e.java)
at com.nokia.phone.sdk.concept.gateway.e.run(e.java)
at java.lang.Thread.run(Thread.java:595)
but the sound in fact plays ok in the emulator.
This is the code I use:
InputStream is = Runtime.getRuntime().getClass().getResourceAsStream(fileSpec);
Player p = Manager.createPlayer(is, "audio/x-wav");
try
{
p.start();
}
catch (Exception ex)
{
System.out.println(ex.getMessage());
System.out.println(ex);
}
When I try playing a midi file I get the same error, but in this case the file does not play at all.
The same midis and wavs work fine on SE phones.

Reply With Quote


