From 1e0172226a04a78954ea3d45cc39835c2d5c8416 Mon Sep 17 00:00:00 2001 From: Pedro Date: Mon, 12 Aug 2024 23:08:11 +0000 Subject: [PATCH] Add empty string handling in AudioStream constructor --- pedalboard/io/AudioStream.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pedalboard/io/AudioStream.h b/pedalboard/io/AudioStream.h index 7529727d..103f7dda 100644 --- a/pedalboard/io/AudioStream.h +++ b/pedalboard/io/AudioStream.h @@ -81,7 +81,10 @@ class AudioStream : public std::enable_shared_from_this "`allow_feedback=True` to the AudioStream constructor."); } - if (!inputDeviceName && !outputDeviceName) { + if ((!inputDeviceName || + (inputDeviceName.has_value() && inputDeviceName.value().empty())) && + (!outputDeviceName || + (outputDeviceName.has_value() && outputDeviceName.value().empty()))) { throw std::runtime_error("At least one of `input_device_name` or " "`output_device_name` must be provided."); }