From 5283ceeb6a437636e103af88457b62de88dc5a5c Mon Sep 17 00:00:00 2001 From: James Ball Date: Sun, 4 Jul 2021 20:24:26 +0100 Subject: [PATCH] Detect if on MacOS and ignore XtAudio if so --- pom.xml | 2 +- .../sh/ball/audio/engine/ConglomerateAudioEngine.java | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index ec70da0..9b1e4a0 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ sh.ball osci-render - 1.8.0 + 1.8.1 osci-render diff --git a/src/main/java/sh/ball/audio/engine/ConglomerateAudioEngine.java b/src/main/java/sh/ball/audio/engine/ConglomerateAudioEngine.java index fffa89b..e9af3ee 100644 --- a/src/main/java/sh/ball/audio/engine/ConglomerateAudioEngine.java +++ b/src/main/java/sh/ball/audio/engine/ConglomerateAudioEngine.java @@ -4,10 +4,14 @@ import sh.ball.shapes.Vector2; import java.util.ArrayList; import java.util.List; +import java.util.Locale; import java.util.concurrent.Callable; public class ConglomerateAudioEngine implements AudioEngine { + private static final String OS = System.getProperty("os.name", "generic").toLowerCase(Locale.ENGLISH); + private static final boolean MAC_OS = OS.contains("mac") || OS.contains("darwin"); + private final XtAudioEngine xtEngine = new XtAudioEngine(); private final JavaAudioEngine javaEngine = new JavaAudioEngine(); @@ -42,7 +46,11 @@ public class ConglomerateAudioEngine implements AudioEngine { @Override public List devices() { if (xtDevices == null) { - xtDevices = xtEngine.devices(); + if (MAC_OS) { + xtDevices = new ArrayList<>(); + } else { + xtDevices = xtEngine.devices(); + } } if (javaDevice == null) { javaDevice = javaEngine.getDefaultDevice();