Here you can find the source of loadSound(String soundLocation)
Parameter | Description |
---|---|
soundLocation | the location of the sound |
public static Clip loadSound(String soundLocation)
//package com.java2s; //License from project: Open Source License import javax.sound.sampled.*; import java.io.*; public class Main { /**//from ww w . java2s .c o m * Load a sound without cache-ing it. * @param soundLocation the location of the sound * @return the sound that was loaded */ public static Clip loadSound(String soundLocation) { try { AudioInputStream stream = AudioSystem.getAudioInputStream(new File(soundLocation)); try { Clip clip = AudioSystem.getClip(); return clip; } catch (LineUnavailableException e) { } } catch (UnsupportedAudioFileException e) { } catch (IOException e) { } return null; } }