×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    Mar 2010
    Posts
    3

    Question help with adding sound to application

    hi,
    i am very new to developing mobile applications.
    The probm that i am having with sound s that once i add sound using the Player interface. After adding the player other events that are suppose to take place with the keys are not working. Please give examples on how to use a player without other event handling being disturbed.

    Thanks and regards,
    haaris_86

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

    Thumbs up Re: help with adding sound to application

    Hi,
    Before writing anything as a reply to your problem, we would like to ask you to explain your issue in much more details,
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  3. #3
    Registered User
    Join Date
    Mar 2010
    Posts
    3

    Question Re: help with adding sound to application

    thanks for the response..

    i am trying to build an application usinc MVC in MIDP 2.0. I am using Canvas class for the display. Its an interactive application using the keypads. The application is working perfect without sound. I am supposed to add audio to the application. i tried doing it using the Player interface. The audio is playing bt the other event handling things of the application hav stopped working. Also the audio does'nt stop till the entire clip gets over.

    the audio is a trial song in .wav form.
    have also tried the .au format.

    reply soon,
    thanks in advance..

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

    Thumbs up Re: help with adding sound to application

    Quote Originally Posted by haaris_86 View Post
    The audio is playing bt the other event handling things of the application have stopped working. Also the audio doesn't stop till the entire clip gets over.

    reply soon,
    thanks in advance..
    Hello,

    I suspect that,you are starting/playing the sound file in the recursive loop,on a thread.is it so?
    Again kindly let us know the file size that you are trying to play.

    For your reference, I am sharing with you one code segment, please make sure that you have start the player once.

    Code:
    public void startPlayer(){
    try 
      { 
        InputStream is = getClass().getResourceAsStream("file.wav"); 
        Player p = Manager.createPlayer(is, "audio/X-wav"); 
        p.start(); 
      }
      catch (IOException ioe) { } 
      catch (MediaException me) { } 
    }
    please check this code,call this method just once,can check this by putting the sop's in this method.
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  5. #5
    Registered User
    Join Date
    Mar 2010
    Posts
    3

    Re: help with adding sound to application

    i will using a function calld music

    private void music(int x)
    {
    if(x==1)
    {
    if (null != ap)
    {
    ap.close();
    ap = null;
    System.gc(); //can help to free memory
    }
    try
    {

    InputStream is = getClass().getResourceAsStream("music.wav");
    Player ap=Manager.createPlayer(is, "audio/X-wav");
    ap.start();


    }
    catch (Exception ioe) {return;}
    }
    else
    {
    try
    {
    ap.stop();
    }
    catch (Exception ioe) {return;}
    }



    }


    am using music(1) to start audio. and music(0) to stop...
    but is not stopping
    the size is aorund 2 MB

  6. #6
    Nokia Developer Champion
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    3,087

    Re: help with adding sound to application

    Players should be used in seperate thread, to avoid these type of command dead lock in the main command thread of the application.

    Look at the WKT examples of playing MMAPI.

    thanks,
    ~Amitabh

Similar Threads

  1. Adding streaming WMA support to S60 Internet Radio application
    By unpaiktable in forum Symbian Media (Closed)
    Replies: 4
    Last Post: 2010-06-06, 22:20
  2. Sound Application
    By ash_21 in forum Symbian Media (Closed)
    Replies: 6
    Last Post: 2007-08-28, 14:54
  3. MIDI Sound problem (J2ME / Series 60)
    By JPapke in forum Mobile Java Media (Graphics & Sounds)
    Replies: 2
    Last Post: 2004-10-29, 08:17
  4. Application Locks When Playing Sound
    By virken in forum Mobile Java Media (Graphics & Sounds)
    Replies: 0
    Last Post: 2004-05-28, 00:40
  5. sound bug (possibly) on 6610
    By alex_crowther in forum Mobile Java Media (Graphics & Sounds)
    Replies: 2
    Last Post: 2004-02-05, 11:44

Posting Permissions

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