can some one help me with my sound problem ?
I need to play a sound in my Applecation but the code i got and read from the sun site dosnt cover Applecation's just Applets can some one help please
Printable View
can some one help me with my sound problem ?
I need to play a sound in my Applecation but the code i got and read from the sun site dosnt cover Applecation's just Applets can some one help please
Here's a simple app that plays the file passed as argument. Problem is that it doesn't exit...
Code:import javax.sound.sampled.*;
import java.io.*;
class SimpleAudio
{
public static void main(String[] args)
{
if(args.length < 1) {
System.out.println("Usage: java SimpleAudio <file>");
return;
}
try {
File f = new File(args[0]);
Clip sound = (Clip)AudioSystem.getLine(new Line.Info(Clip.class));
sound.open(AudioSystem.getAudioInputStream(f));
sound.start();
} catch(Exception e) {
System.out.println(e.toString());
}
}
}