diff --git a/src/audio.cpp b/src/audio.cpp index 49b29d0b..7079df02 100644 --- a/src/audio.cpp +++ b/src/audio.cpp @@ -1,5 +1,6 @@ #include #include +#include namespace rack { @@ -288,7 +289,7 @@ int Port::getNumInputs() { if (!device) return 0; try { - return std::min(std::max(device->getNumInputs() - inputOffset, 0), maxInputs); + return math::clamp(device->getNumInputs() - inputOffset, 0, maxInputs); } catch (Exception& e) { WARN("Audio port could not get device number of inputs: %s", e.what()); @@ -300,7 +301,7 @@ int Port::getNumOutputs() { if (!device) return 0; try { - return std::min(std::max(device->getNumOutputs() - outputOffset, 0), maxOutputs); + return math::clamp(device->getNumOutputs() - outputOffset, 0, maxOutputs); } catch (Exception& e) { WARN("Audio port could not get device number of outputs: %s", e.what());