Problemer med at indlæse au filer
/*Jeg prøver at følge java.sun.com's tutorial om "Sound"men den AudioClip'sne bliver aldrig oprettet??
herunder er al den kode der har med indlæsningen af lyd at gøre. Hele programmet bliver kørt i en JFrame.*/
private AudioClip laserFireSound, collisionSound, explosionSound;
private String laserFireURL = "blast.au", collisionURL = "collision.au", explosionURL = "explosion.au";
private URL codeBase;
private SoundList soundList;
private void initSound ()
{
try
{
codeBase = new URL("file:" + System.getProperty("user.dir") + "/Sound/");
}
catch (MalformedURLException e)
{
System.err.println(e.getMessage());
}
System.out.println(codeBase);
soundList = new SoundList(codeBase);
soundList.startLoading(laserFireURL);
while (laserFireSound == null)
{
laserFireSound = soundList.getClip (laserFireURL);
//Den bliver hængende i denne while løkke dvs.
//laserFireSound bliver aldrig andet end en null pointer
}
soundList.startLoading(collisionURL);
collisionSound = soundList.getClip (collisionURL);
soundList.startLoading(explosionURL);
explosionSound = soundList.getClip (explosionURL);
}