Skip to content

Commit

Permalink
Add empty string handling in AudioStream constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
sarmentow committed Aug 12, 2024
1 parent 1ddd2c4 commit 1e01722
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pedalboard/io/AudioStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,10 @@ class AudioStream : public std::enable_shared_from_this<AudioStream>
"`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.");
}
Expand Down

0 comments on commit 1e01722

Please sign in to comment.