From 84dc5ee6d004e744ffada4a63c19debcdccae741 Mon Sep 17 00:00:00 2001 From: James Ball Date: Fri, 18 Jun 2021 18:49:23 +0100 Subject: [PATCH] Throw helpful error if no default device is found --- pom.xml | 2 +- src/main/java/sh/ball/gui/Controller.java | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 1a194f9..730b079 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ sh.ball osci-render - 1.7.1 + 1.7.2 osci-render diff --git a/src/main/java/sh/ball/gui/Controller.java b/src/main/java/sh/ball/gui/Controller.java index 8d6c90c..1582e83 100644 --- a/src/main/java/sh/ball/gui/Controller.java +++ b/src/main/java/sh/ball/gui/Controller.java @@ -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);