How do I play a local music *.wav file in an application???
Thanks!
sirkus
http://java.sun.com/j2se/1.3/docs/api/index.html
In article <8h19h2$526$1...@zingo.tninet.se>, "Torgny Johansson"
<torgny_j...@bigfoot.com> wrote:
> Can anyone please give me an example of how to make a stanalone
> application play a soundfile? I just can't get it to work.
>
> How do I play a local music *.wav file in an application???
>
> Thanks!
>
>
download at www.angelfire.com/games/cyroxx/files/CyroXXSound.zip
its just a single class file...
use the constructor CyroXXSound(String) or CyroXXSound(File)...
after that it works as a simple AudioClip....
good luck!
Sent via Deja.com http://www.deja.com/
Before you buy.
There's source for SoundPlayer here. It takes care of all
the messing around to get a sound file to play:
http://degroof.home.mindspring.com/java/index.html
Here's source that uses it:
import nightshade.audio.*;
public class Sound
{
public static void main(String argv[])
{
SoundPlayer player = new SoundPlayer();
player.add("c:\\windows\\media\\tada.wav","tada");
player.add("c:\\windows\\media\\canyon.mid","canyon");
player.add("c:\\windows\\media\\notify.wav","beeboop");
player.play("tada");
player.play("canyon");
player.loop("beeboop");
try{Thread.sleep(3000);}catch(Exception e){};
player.stop("beeboop");
try{Thread.sleep(3000);}catch(Exception e){};
}
}
--
=============================================================
Steve DeGroof (deg...@mindspring.com)
http://degroof.home.mindspring.com
=============================================================