boot-clj / boot

Build tooling for Clojure.
https://boot-clj.github.io/
Eclipse Public License 1.0
1.75k stars 180 forks source link

Check for available AudioDevice in speak task #520

Closed ghost closed 7 years ago

ghost commented 7 years ago

I would be great that in (speak) task, we use try catch or check for available AudioDevice before running the task to avoid error while using in the environment without AudioDevice.

  clojure.lang.ExceptionInfo: javazoom.jl.decoder.JavaLayerException: Cannot create AudioDevice
    data: {:file "/tmp/boot.user3476942433437848616.clj", :line 21}
java.util.concurrent.ExecutionException: javazoom.jl.decoder.JavaLayerException: Cannot create AudioDevice
 javazoom.jl.decoder.JavaLayerException: Cannot create AudioDevice
 javazoom.jl.decoder.JavaLayerException: cannot obtain source audio line
     java.lang.IllegalArgumentException: No line matching interface SourceDataLine supporting format PCM_SIGNED 22050.0 Hz, 16 bit, mono, 2 bytes/frame, little-endian is supported.
                         javax.sound.sampled.AudioSystem.getLine                  AudioSystem.java:  479
            javazoom.jl.player.JavaSoundAudioDevice.createSource         JavaSoundAudioDevice.java:  101
               javazoom.jl.player.JavaSoundAudioDevice.writeImpl         JavaSoundAudioDevice.java:  148
                        javazoom.jl.player.AudioDeviceBase.write              AudioDeviceBase.java:  133
                    javazoom.jl.player.JavaSoundAudioDevice.test         JavaSoundAudioDevice.java:  205
  javazoom.jl.player.JavaSoundAudioDeviceFactory.testAudioDevice  JavaSoundAudioDeviceFactory.java:   83
javazoom.jl.player.JavaSoundAudioDeviceFactory.createAudioDevice  JavaSoundAudioDeviceFactory.java:   42
            javazoom.jl.player.FactoryRegistry.createAudioDevice              FactoryRegistry.java:   87
                                javazoom.jl.player.Player.<init>                       Player.java:   97
                                javazoom.jl.player.Player.<init>                       Player.java:   82
                                            boot.notify/play!/fn                        notify.clj:   23
                             clojure.core/binding-conveyor-fn/fn                          core.clj: 1938
RadicalZephyr commented 7 years ago

The notify task will also need this check.