Skip to main content
gamedev.net
🔒 Locked

[java] Loading sounds in a Java APPLICATION

Started by dannyxyz23 2 replies 300+ views
Original Post
dannyxyz23
dannyxyz23
Hi every1, I''m trying to load sounds in my Java Application (not an Applet) and I am having a hard time. I could turn around loading images using the Toolkit''s getImage, but getAudioClip was not avaliable(does this word spells that way?). Anyway, I have considered the InputStream, but don''t know if that could work. So my questions could be: 1- How do I play an AudioClip in an Application? 2- How do I know if my image has already been loaded using the Toolkit''s getImage? 3- Should a bitmap background, 640x480, 16 bits, delay around 50 secs to load when I first load my application? 4- Is there a Java Compiler that can make an Executable? Thank you all! Long life to JAVA!
markuskidd
markuskidd
I think there is a package in the javax heierarchy that has sound... maybe around javax.media??? Some google will turn it up I''m sure.
Star Dart - Java Multiplayer Space Combat at http://www.stardart.net/
mc3712
mc3712
1)An example:

try {
URL url = new URL("file:" + System.getProperty("user.dir") + "/sound1.au");
kuolemaSound = Applet.newAudioClip(url);

} catch (Exception e) { System.err.println(e.getMessage());}


3)You need to use MediaTracker.
Read this: http://www.javacoffeebreak.com/articles/mediatracker/

4)Yes there are, though I have never used a one. Try google.

ps. The word is spelled "available".

[edited by - mc3712 on January 9, 2003 2:13:33 PM]
Alan Kemp
Alan Kemp
Thats "The word is spelt "available""

:-)

Alan
"There will come a time when you believe everything is finished. That will be the beginning." -Louis L'Amour

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.