|
I have trouble playing a wave in a java application. Here is the code:
import java.io.*; import java.applet.*; import java.net.*;
public class PlayVariousMusicFiles{ private static AudioClip testClip; private static URL testUrl;
public static void main(String args[]){ String fileName="arf.wav"; SoundTest(fileName); testClip.loop(); }
public static void SoundTest(String fileName){ try{ testUrl = new URL("file://H:/arf.wav"); // Get current directory name, and build URL testClip=Applet.newAudioClip(testUrl); testClip.play(); System.out.println(testUrl.toString()); System.out.println("Should play"); }catch(Exception e){ System.out.println(e.toString()); } }
All I hear is a "poof" sound.
|