// SPDX-FileCopyrightText: 2021 Jean Pierre Cimalando // SPDX-FileCopyrightText: 2011-2025 Filipe Coelho // SPDX-License-Identifier: GPL-2.0-or-later #ifndef CARLA_JSFX_UTILS_HPP_INCLUDED #define CARLA_JSFX_UTILS_HPP_INCLUDED #include "CarlaBackend.h" #include "extra/String.hpp" #include "water/files/File.h" #ifdef YSFX_API # error YSFX_API is not private #endif #include "ysfx/include/ysfx.h" CARLA_BACKEND_START_NAMESPACE // -------------------------------------------------------------------------------------------------------------------- struct CarlaJsfxLogging { static void logAll(intptr_t, const ysfx_log_level level, const char* const message) { switch (level) { case ysfx_log_info: carla_stdout("%s: %s", ysfx_log_level_string(level), message); break; case ysfx_log_warning: carla_stderr("%s: %s", ysfx_log_level_string(level), message); break; case ysfx_log_error: carla_stderr2("%s: %s", ysfx_log_level_string(level), message); break; } }; static void logErrorsOnly(intptr_t, const ysfx_log_level level, const char* const message) { switch (level) { case ysfx_log_info: break; case ysfx_log_warning: carla_stderr("%s: %s", ysfx_log_level_string(level), message); break; case ysfx_log_error: carla_stderr2("%s: %s", ysfx_log_level_string(level), message); break; } }; }; // -------------------------------------------------------------------------------------------------------------------- struct CarlaJsfxCategories { static PluginCategory getFromEffect(ysfx_t* const effect) { PluginCategory category = PLUGIN_CATEGORY_OTHER; if (const uint32_t tagCount = ysfx_get_tags(effect, nullptr, 0)) { std::vector tags; tags.resize(tagCount); ysfx_get_tags(effect, tags.data(), tagCount); for (uint32_t i=0; i