From fd42222339655443d6537dde9293482d8c9bfa5e Mon Sep 17 00:00:00 2001 From: falkTX Date: Mon, 8 May 2023 03:51:57 +0200 Subject: [PATCH] Add getBinaryTypeAsString utility function Signed-off-by: falkTX --- source/utils/CarlaBackendUtils.hpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/source/utils/CarlaBackendUtils.hpp b/source/utils/CarlaBackendUtils.hpp index 216125f61..6c8b517a4 100644 --- a/source/utils/CarlaBackendUtils.hpp +++ b/source/utils/CarlaBackendUtils.hpp @@ -500,6 +500,34 @@ const char* PatchbayIcon2Str(const PatchbayIcon icon) noexcept // ----------------------------------------------------------------------- +static inline +const char* getBinaryTypeAsString(const BinaryType type) noexcept +{ + carla_debug("CarlaBackend::getBinaryTypeAsString(%i:%s)", type, BinaryType2Str(type)); + + if (type == BINARY_NATIVE) + return "native"; + + switch (type) + { + case BINARY_NONE: + return "none"; + case BINARY_POSIX32: + return "posix32"; + case BINARY_POSIX64: + return "posix64"; + case BINARY_WIN32: + return "win32"; + case BINARY_WIN64: + return "win64"; + case BINARY_OTHER: + return "other"; + } + + carla_stderr("CarlaBackend::getBinaryTypeAsString(%i) - invalid type", type); + return "NONE"; +} + static inline BinaryType getBinaryTypeFromString(const char* const ctype) noexcept { @@ -525,6 +553,8 @@ BinaryType getBinaryTypeFromString(const char* const ctype) noexcept return BINARY_WIN32; if (stype == "win64") return BINARY_WIN64; + if (stype == "other") + return BINARY_OTHER; carla_stderr("CarlaBackend::getBinaryTypeFromString(\"%s\") - invalid string type", ctype); return BINARY_NONE;