×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    17

    Problem with sound api[waiting for you reply]

    We r a group of J2ME programmers and we are facing a problem in Nokia Sound UI. An exception(NullPointer) is thrown when we try to use FORMAT_WAV in our sound constructor. But the same thing works fine when we use FORMAT_TONE, but this is not the desired result that we want. We urgently need a solution for this.

    More Info
    Sound Constructor:- Sound(byte[] data,int type)
    We currently using:- Sun One Studio(update 1), Nokia Series 60 MIDP SDK

  2. #2
    Registered User
    Join Date
    Mar 2003
    Posts
    36

    RE: Problem with sound api[waiting for you reply]

    void loadRoll() {
    try {
    inStream = this.getClass().getResourceAsStream("/ballRoll.wav"
    inStream.read(soundByte, 0, soundByte.length);

    soundRoll = new Sound(soundByte, Sound.FORMAT_WAV);
    soundRoll.init(soundByte, Sound.FORMAT_WAV);
    soundRoll.setSoundListener(this);
    } catch (Exception e) {
    System.out.println("Error loading ball roll: " + e.toString());
    }
    }

    void playRoll(int numRolls) {
    try {
    stopAllSounds();
    soundRoll.play(numRolls);
    } catch (Exception e) {
    System.out.println("Error playing sound: " + e.toString());
    }
    }

    Works on Nokia 7650. HTH!



    Adrian.

Posting Permissions

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