×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Jan 2008
    Posts
    4

    problem playing resource sound file

    Hi All

    i just cant seem to be able to play a WAV (or MID) sound file when i include it as a resource in my netbeans java app. i get a run time error that says:

    Illegal argument java/lang/illegalargumentexception param is null

    my resouce files are stored in a folder named 'res' off the main project folder, and i have added it using project > libraries & resources > add folder

    i am using the S40 SDK and have a routine that i call whenever i want to play the sound file as such:

    public void PlayResSound() {
    try {
    InputStream is = getClass().getResourceAsStream("Siren.wav");
    Player p = Manager.createPlayer(is, "audio/X-wav");
    p.start();
    }
    catch (IOException ioe) { }
    catch (MediaException me) { }
    }


    if i try playing .mid file using "audio/midi" i still get the same problem whenever i call this routine

    please does anyone have an idea why this is happening, what i have done wrong, and is there something else i can try


    many thanks in advance


    Bob

  2. #2
    Super Contributor
    Join Date
    Apr 2003
    Location
    USA, CA
    Posts
    7,191

    Re: problem playing resource sound file

    if the resources are stored in /res folder then the path should be also used in the method calls... getResourceAsStream("/res/Siren.wav")

    Hartti

Similar Threads

  1. problem in playing wav file
    By sridhar_ratna in forum Mobile Java Media (Graphics & Sounds)
    Replies: 3
    Last Post: 2009-02-11, 20:53
  2. problem in play sound MIDI and MP3 file
    By cman in forum Symbian
    Replies: 2
    Last Post: 2007-12-11, 17:36
  3. Problem in playing in an audio file.
    By PankajNeve in forum Symbian
    Replies: 3
    Last Post: 2007-03-09, 13:52
  4. Problem with resource s60 3rd edition
    By asmobease in forum Symbian Media (Closed)
    Replies: 4
    Last Post: 2006-09-22, 10:56
  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
  •  
×