That's a useful example :)
I removed some of the imports that aren't being used:
(ns sound-tests
(:import
(javax.sound.sampled AudioSystem LineEvent$Type LineListener)
(java.net URL)))
(defn simple-play
[url]
(let [stream (AudioSystem/getAudioInputStream url)
clip (AudioSystem/getClip)]
(.addLineListener clip
(proxy[LineListener] []
(update [event]
(when (and event
(= (.getType event)
(LineEvent$Type/STOP)))
(.close clip)
(.close stream)))))
(try
(.open clip stream)
(.start clip)
(catch Exception e nil))))
(simple-play (URL.
"file:///Developer/Examples/Java/Sound/JavaSoundDemo/audio/1-welcome.wav"))
--
Michael Wood <esio...@gmail.com>
I've googled around, and found several ways to do this in Java, but
I've not been successful in translating the less-complex examples. I'm
wondering, how would an experienced Clojurian go about doing this in
Clojure?