×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    Jan 2005
    Posts
    7

    Angry problem with playing wav file

    Hi
    I am getting this error while trying to play a wav file.....I have just switched to Nokia Developer's Suite 2.2 for J2ME™ from SUN-WTK where everything was fine.

    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)


    Another question, for my work only nokia 6680/6681 can work, so is there any way to try my program on emulation tool of these phones only?

    Thanks
    Pushpendra

  2. #2
    Nokia Developer Expert
    Join Date
    Jul 2003
    Posts
    46
    Could you post the piece of code you're using?

    Is the wav file linear or is e.g. u-law?

  3. #3
    Registered User
    Join Date
    Jan 2005
    Posts
    7
    Hi buddy,
    thanks for replying...here is the code that is giving problem. I really do not know what kind of .wav file it is ( how do we find it out). It is of size ~20kb.


    try{
    in = getClass().getResourceAsStream("/correct.wav");
    p= Manager.createPlayer(in, "audio/x-wav");
    }
    catch(Exception e)
    {
    System.out.println("Exception in initiator: "+e);
    }

    This code runs fine with Sun WTK but somehow nokia toolkit is giving probem

    Thanks in advance,
    Regards
    Pushpendra

  4. #4
    Registered User
    Join Date
    Jan 2005
    Posts
    7

    also problem with nextInt

    Hi
    I am also getting
    Alert: no such method nextInt()...I have imported java.util.Random and using a simple code...


    Random random = new Random();
    int i = random.nextInt(1601);

    Why this is aproblem with nokia??

    Regards,

  5. #5
    Nokia Developer Expert
    Join Date
    Jul 2003
    Posts
    46
    How long is the wav file? If it's 20kb it shouldn't last more than 2.5 s. If you transfer the wav file alone to the phone, does it play?

    Random.nextInt() does not take a parameter.

  6. #6
    Registered User
    Join Date
    Jan 2005
    Posts
    7
    Hi
    Ya, it last for two secnds only. I actually don't have a phone yet to try it out.
    There are two nextInt()s. One of them takes a int number and generates random number between 0 and given number.
    I was tryng to use that..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×