From 3993993a2573291d3903ae6426578cede7c9f639 Mon Sep 17 00:00:00 2001 From: Apehum <36326454+Apehum@users.noreply.github.com> Date: Fri, 4 Oct 2024 22:17:26 +0800 Subject: [PATCH] fix(client): close devices on DeviceManager#clear --- .../su/plo/voice/api/client/audio/device/DeviceManager.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/api/client/src/main/java/su/plo/voice/api/client/audio/device/DeviceManager.java b/api/client/src/main/java/su/plo/voice/api/client/audio/device/DeviceManager.java index 34a646a0..91ddacc4 100644 --- a/api/client/src/main/java/su/plo/voice/api/client/audio/device/DeviceManager.java +++ b/api/client/src/main/java/su/plo/voice/api/client/audio/device/DeviceManager.java @@ -45,10 +45,12 @@ public interface DeviceManager { void setInputDevice(@Nullable InputDevice device); /** - * Removes the output and input devices. + * Closes and removes the output and input devices. */ default void clear() { + getOutputDevice().ifPresent(OutputDevice::close); setOutputDevice(null); + getInputDevice().ifPresent(InputDevice::close); setInputDevice(null); }