Results 1 to 3 of 3
  1. #1
    sgthale is offline Member
    Join Date
    Apr 2011
    Posts
    48
    Rep Power
    0

    Thumbs up Adding Sound to APPLICATIONS

    Ive been digging into Google for hours now and I cant find one tutorial for adding sounds to applications. They are all just for Applets. If I try to use the Applet tutorial code, I get this error in the line:

    Java Code:
    import java.applet.AudioClip;
    
    public class SoundManager {
    	private static AudioClip[] sounds = new AudioClip[32];
    	private static int count = 0;
    	
    	public void loadSound(String file){
    		sounds[count++] = getAudioClip(getCodeBase(), file);
    	}
    }
    "The Method getCodeBase() is undefined for the class"

    How do I fix this problem, OR how do I implement sounds into APPLICATIONS

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,783
    Blog Entries
    7
    Rep Power
    21

    Default Re: Adding Sound to APPLICATIONS

    There's a static method in the Applet class: newAudioClip( ... ); it loads an audio clip for you; there's no need to worry about that Applet class, i.e. you don't need to build an applet, you're just using a static method from that class (the method is in the wrong class i.m.h.o.)

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    Cosmos is offline Member
    Join Date
    Jul 2011
    Location
    New Delhi,India
    Posts
    56
    Rep Power
    0

    Default Re: Adding Sound to APPLICATIONS

    there can be one other way too.....but it will use your computer's pre-installed products like windows media player,etc...

    search for exec method that will indirectly use the command line to play audio files.....

Similar Threads

  1. Problems with sound in java and USB sound card
    By marblecatdog in forum New To Java
    Replies: 1
    Last Post: 04-19-2011, 01:02 PM
  2. Replies: 1
    Last Post: 04-05-2011, 09:58 PM
  3. Adding sound to an applet
    By Ryan10 in forum New To Java
    Replies: 1
    Last Post: 03-02-2011, 05:54 PM
  4. Adding wav sound into a JLabel.
    By hitmen in forum AWT / Swing
    Replies: 2
    Last Post: 02-17-2009, 06:59 AM
  5. Problem in adding sound.
    By shanky_sanks in forum Java Applets
    Replies: 6
    Last Post: 03-29-2008, 09:37 PM

Posting Permissions

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