The Artima Developer Community
Sponsored Link

Java Answers Forum
Adding Sound to Application

1 reply on 1 page. Most recent reply: Feb 22, 2004 11:47 PM by Viswanatha Basavalingappa

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
Kevin

Posts: 27
Nickname: quasi
Registered: Apr, 2003

Adding Sound to Application Posted: Feb 21, 2004 7:11 PM
Reply to this message Reply
Advertisement
Can someone tell me how to add sound to an application, an example would be very helpful.


Viswanatha Basavalingappa

Posts: 84
Nickname: viswagb
Registered: Nov, 2003

Re: Adding Sound to Application Posted: Feb 22, 2004 11:47 PM
Reply to this message Reply
YES, you can add sound capabilities into your Java applets and/or applications using the Java Sound API.

The full featured Java Sound API is available as a core API in the Java 2 SDK, Standard Edition, v. 1.3 and above. The full featured Java Sound API is also available as part of the Java Media Framework 2.x for use on older JDK 1.x platforms.

Please note that the Java 2 Runtime Environment, Standard Edition, v. 1.3 release for Win32 does not include a soundbank. To use the software synthesizer with this release bundle, you must manually install a soundbank. For more information

Example:
---------
import java.applet.*;
import java.awt.*;
import java.net.*;

public class MySound extends Applet implements Runnable
{
Thread th;
AudioClip bounce;
public void init()
{
setBackground (Color.blue);
bounce = getAudioClip (getCodeBase(), "bounce.au");
}
public void start ()
{
th = new Thread (this);
th.start ();
}
public void run ()
{
while(true)
{
bounce.play();
}
}
}
end of code....

Thanks
Hope this may help..you...
Viswa
--------

Flat View: This topic has 1 reply on 1 page
Topic: random acesses from a file Previous Topic   Next Topic Topic: Adding icons to JList

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use