×

Discussion Board

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

    7650 sounds... it freezes the program

    Hi i am trying to play sounds in 7650 and using the emulator to test the application. its a game application. here is the code i am using the load the sounds. what is happening is that the application freezes after making 1 or 2 sounds.

    i use this statement to play the sound
    sound1.play(1); to play once.

    Also i use the following statement to play the sound
    sound5.play(0); to play the background continuous music sound.


    please tell me what is making the program to ferrze
    also what i want to do is that there should be a continuous sound and some sounds that are hear when there is some event in the game.


    Shahzad





    tune = this.getClass().getResourceAsStream("/Dragon1/res/scn/punch1.wav"
    byte[] buffer = new byte[8000];
    tune.read(buffer, 0, buffer.length);
    sound1 = new Sound(buffer, Sound.FORMAT_WAV);
    sound1.init(buffer, Sound.FORMAT_WAV);


    tune = this.getClass().getResourceAsStream("/Dragon1/res/scn/punch2.wav"
    tune.read(buffer, 0, buffer.length);
    sound2 = new Sound(buffer, Sound.FORMAT_WAV);
    sound2.init(buffer, Sound.FORMAT_WAV);

    tune = this.getClass().getResourceAsStream("/Dragon1/res/scn/ss1.wav"
    tune.read(buffer, 0, buffer.length);
    sound3 = new Sound(buffer, Sound.FORMAT_WAV);
    sound3.init(buffer, Sound.FORMAT_WAV);

    tune = this.getClass().getResourceAsStream("/Dragon1/res/scn/ss2.wav"
    tune.read(buffer, 0, buffer.length);
    sound4 = new Sound(buffer, Sound.FORMAT_WAV);
    sound4.init(buffer, Sound.FORMAT_WAV);


    tune = this.getClass().getResourceAsStream("/Dragon1/res/scn/back.wav"
    buffer = new byte[40000];
    tune.read(buffer, 0, buffer.length);
    sound5 = new Sound(buffer, Sound.FORMAT_WAV);
    sound5.init(buffer, Sound.FORMAT_WAV);

    buffer = null;

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

    RE: 7650 sounds... it freezes the program

    ok now its working.. what i did was that i first stop a sound as sound1.stop() and then i call the sound1.play(1); may be the program is calling the sound.play(1) function when it is already been playing.


    now the problem is left with sound5.play(0); what i want to do is that this sound should play a background music that is the continuous music in a loop. 0 mean this will not stop and reply for ever so creates a back ground music... its not working


    Shahzad

Posting Permissions

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