×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    May 2009
    Posts
    4

    Unhappy Problem playing sound on N70

    When I tried to play a sound for selecting adjacent tiles in an N70, no sound is been heard and the fps drops down.
    Concurrently I was playing a MIDI in as background music. I use only a single user thread.
    I turned off the background music, then sounds are ok.
    Please help me to play music and sound at the same time.
    Sound details: 7KB, 8bit, mono, WAV
    Code:
     private void playSound(String strSound)
       {
           try{
               if((getAudioStatus() & GameState.SOUND_BIT) != 0)
               {
                   InputStream is = getClass().getResourceAsStream(strSound);
                   if(soundPlayer != null)
                   {
                       soundPlayer.close();
                   }
                   soundPlayer = Manager.createPlayer(is, "audio/X-wav");
                   soundPlayer.realize();
                   soundPlayer.prefetch();
                   soundPlayer.start();
                   //Manager.playTone(MusicMaker.D4, 300, 90);
                   //long timeout = soundPlayer.getDuration()/1000L;
                   //microseconds = milliseconds*1000
                   //System.out.println(timeout);//millisecs
                   //if(timeout<=0)
                       //timeout =20L;
                   //synchronized(this){
                     //      wait(50L);
                   //}
                   is.close();
               }
               
           }catch(Exception e){
               e.printStackTrace();
           }
       }

  2. #2
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Re: Problem playing sound on N70

    Hi smallbug005,
    Welcome to the forum nokia developer Board,
    I understand your concern,and I guess that you are using just ONE player and you are trying to play the both file using the same player....correct..
    The reason why the file is not getting played is that one file is playing infinite loop,using the setLoopCount(),and hence this player is permanently assigned for this task,then how this can play the other file.I believe that you understand my point.

    Please try to take the different players,one for the background,and another for the tile shifting.Test this and let us know the results,

    Cheers!!!!
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  3. #3
    Regular Contributor
    Join Date
    Jan 2008
    Posts
    387

    Re: Problem playing sound on N70

    Quote Originally Posted by raj_J2ME View Post
    Hi smallbug005,
    Welcome to the forum nokia developer Board,
    I understand your concern,and I guess that you are using just ONE player and you are trying to play the both file using the same player....correct..
    The reason why the file is not getting played is that one file is playing infinite loop,using the setLoopCount(),and hence this player is permanently assigned for this task,then how this can play the other file.I believe that you understand my point.

    Please try to take the different players,one for the background,and another for the tile shifting.Test this and let us know the results,

    Cheers!!!!
    hi bug, does it helps? if not than simply make two player i.e
    Player p1,p2;

    try{

    InputStream is = getClass().getResourceAsStream(strSound);
    p1 = Manager.createPlayer(is, "audio/X-wav");
    p1.realize();
    p1.prefetch();

    InputStream is2 = getClass().getResourceAsStream(strSound);
    p2 = Manager.createPlayer(is, "audio/X-wav");
    p2.realize();
    p2.prefetch()
    }

    }catch(Exception e){
    e.printStackTrace();
    }


    now call p1.start() where you wana play it and call p1.stop() when you wana stop. and play other p2.start() do not forget to stop other player before you call start of other.
    Thanks and Regards,
    Manjul.

  4. #4
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Re: Problem playing sound on N70

    Hi,
    Thats the only way to play the two file out of these one is playing infinitely,smallbug005 please follow the code segment,this can be searched on the web too.
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

Similar Threads

  1. problem playing resource sound file
    By WinBase in forum Mobile Java Media (Graphics & Sounds)
    Replies: 1
    Last Post: 2008-01-21, 18:05
  2. problem when stop playing video on 3650 and try to play again
    By niko86 in forum Mobile Java General
    Replies: 5
    Last Post: 2007-08-03, 07:40
  3. PROBLEM with MMS created in N93 and received in N70
    By Summerman in forum Mobile Java Media (Graphics & Sounds)
    Replies: 1
    Last Post: 2007-01-14, 01:19
  4. Problem on playing sound in emulator
    By mhahn0106 in forum Symbian Tools & SDKs
    Replies: 0
    Last Post: 2004-01-12, 06:00
  5. strange problem playing Sound on 7650
    By Poldipold in forum Mobile Java Media (Graphics & Sounds)
    Replies: 1
    Last Post: 2003-07-11, 13:12

Posting Permissions

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