// Статический метод, для удобства public static Sound playSound(String s, float volume) { File f = new File(s); Sound snd = new Sound(f); snd.setVolume(volume); snd.play(); return snd; }
/** * Plays a sound with an optional SoundFilter, and optionally looping. This method returns * immediately. */ public InputStream play(Sound sound, SoundFilter filter, boolean loop) { InputStream is; if (sound != null) { if (loop) { is = new LoopingByteInputStream(sound.getSamples()); } else { is = new ByteArrayInputStream(sound.getSamples()); } return play(is, filter); } return null; }