×

Discussion Board

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

    why sound breaks or cut on 7650

    I am writing a game for 7650 and and using the Sound API to produce some sounds on certain events like when character punches the other


    *******************
    First i load the sound as
    *******************


    tune = this.getClass().getResourceAsStream("/Dragon1/res/scn/ss2.wav");
    buffer4 = new byte[8000];
    tune.read(buffer4, 0, buffer4.length);
    sound4 = new Sound(buffer4, Sound.FORMAT_WAV);
    sound4.init(buffer4, Sound.FORMAT_WAV);
    sound4.setSoundListener(this);


    *******************
    then i play the sound as
    *******************



    public void playSound(int son)
    {


    if(blnEnableSounds == false)
    return;


    if(blnSoundPlaying == true)
    return;



    if(son == 1)
    sound1.play(1);
    //else if(son == 2)
    // sound2.play(1);
    else if(son == 3)
    sound3.play(1);
    else if(son == 4)
    sound4.play(1);

    blnSoundPlaying = true;
    }



    *******************
    so i play the sound by calling the function with this the no of sound to play..
    *******************



    *******************
    also notice i used a variable that indicates whether the sound is still playing or not, blnSoundPlaying is used to do so.... i make it true



    Also the class implements SoundListener and in event
    *******************





    public void soundStateChanged(Sound sound, int event)
    {
    if(event == Sound.SOUND_STOPPED)
    blnSoundPlaying = false;
    }



    *******************
    so to make sure that not two sounds play at the same time

    BUT sounds are broken i mean play half or play late when it supposed to play.. it does not happen all time ... it just happen randomly
    *******************





    Shahzad

  2. #2
    Registered User
    Join Date
    Mar 2003
    Posts
    1
    Hi, in Nokia UI Documents

    If a higher priority system sound interrupts a sound already being played the currently playing sound is stopped as if called to the stop method

    So I think it is the reason why the sound be cut.
    You may try to switch off the system keyboard sound.

Posting Permissions

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