Throw helpful error if no default device is found

pull/35/head
James Ball 2021-06-18 18:49:23 +01:00
rodzic e711db34d9
commit 84dc5ee6d0
2 zmienionych plików z 4 dodań i 1 usunięć

Wyświetl plik

@ -6,7 +6,7 @@
<groupId>sh.ball</groupId>
<artifactId>osci-render</artifactId>
<version>1.7.1</version>
<version>1.7.2</version>
<name>osci-render</name>

Wyświetl plik

@ -133,6 +133,9 @@ public class Controller implements Initializable, FrequencyListener, Listener {
frames.addListener(this);
this.producer = new FrameProducer<>(audioPlayer, frames);
this.defaultDevice = audioPlayer.getDefaultDevice();
if (defaultDevice == null) {
throw new RuntimeException("No default audio device found!");
}
this.sampleRate = defaultDevice.sampleRate();
this.rotateEffect = new RotateEffect(sampleRate);
this.translateEffect = new TranslateEffect(sampleRate);