diff --git a/minimal/CMakeLists.txt b/minimal/CMakeLists.txt index 2a7715a1656..b662458c912 100644 --- a/minimal/CMakeLists.txt +++ b/minimal/CMakeLists.txt @@ -10,12 +10,18 @@ include(${OSSIA_ROOT}/src/ossia_sources.cmake) configure_file(${OSSIA_ROOT}/src/ossia-config.hpp.in ossia-config.hpp) add_library(ossia) -target_compile_options(ossia PRIVATE -std=c++23 -fno-exceptions -fno-rtti -fno-asynchronous-unwind-tables) -target_compile_definitions(ossia PRIVATE OSSIA_EXPORTS=1 OSSIA_FREESTANDING=1 OSSIA_EDITOR=1 OSSIA_SCENARIO_DATAFLOW=1) -target_link_libraries(ossia PRIVATE -Wl,-z,defs -fuse-ld=mold) -target_include_directories(ossia PRIVATE /home/jcelerier/ossia/score/3rdparty/libossia/3rdparty/boost_1_86_0) +target_compile_options(ossia PUBLIC -std=c++23 -fno-exceptions -fno-rtti -fno-asynchronous-unwind-tables) +target_compile_definitions(ossia PUBLIC + OSSIA_EXPORTS=1 + OSSIA_FREESTANDING=1 + OSSIA_EDITOR=1 + OSSIA_SCENARIO_DATAFLOW=1 + LIBREMIDI_HEADER_ONLY=1 +) +target_link_libraries(ossia PUBLIC -Wl,-z,defs -fuse-ld=mold) +target_include_directories(ossia PUBLIC /home/jcelerier/ossia/score/3rdparty/libossia/3rdparty/boost_1_86_0) -target_include_directories(ossia SYSTEM PRIVATE +target_include_directories(ossia SYSTEM PUBLIC ${OSSIA_ROOT}/src #$ $ @@ -33,6 +39,10 @@ set(SOURCE_FILES "${SRC}/detail/thread.cpp" "${SRC}/detail/any_map.cpp" +"${SRC}/audio/audio_parameter.cpp" +"${SRC}/audio/audio_device.cpp" +"${SRC}/audio/audio_engine.cpp" + "${SRC}/network/base/device.cpp" "${SRC}/network/base/protocol.cpp" "${SRC}/network/base/parameter.cpp" @@ -60,7 +70,12 @@ set(SOURCE_FILES "${SRC}/dataflow/data.cpp" "${SRC}/dataflow/port.cpp" "${SRC}/dataflow/graph_node.cpp" +"${SRC}/dataflow/graph/graph.cpp" "${SRC}/dataflow/execution_state.cpp" +"${SRC}/dataflow/execution/execution_policy.cpp" +"${SRC}/dataflow/execution/default_policy.cpp" +"${SRC}/dataflow/execution/merged_policy.cpp" +"${SRC}/dataflow/execution/local_state_execution_policy.cpp" "${SRC}/dataflow/nodes/state.cpp" "${SRC}/editor/curve/curve.cpp" @@ -89,6 +104,8 @@ set(SOURCE_FILES "${SRC}/editor/scenario/detail/scenario_execution.cpp" ) +add_executable(test_minimal test.cpp) +target_link_libraries(test_minimal PRIVATE ossia) target_sources(ossia PRIVATE ${SOURCE_FILES}) @@ -102,19 +119,19 @@ install(DIRECTORY "${SRC}" DESTINATION src FILES_MATCHING PATTERN "*.hpp") -install(DIRECTORY "${OSSIA_3RDPARTY_FOLDER}/nano-signal-slot/include/" DESTINATION src) -install(DIRECTORY "${OSSIA_3RDPARTY_FOLDER}/tuplet/include/" DESTINATION src) -install(DIRECTORY "${OSSIA_3RDPARTY_FOLDER}/SmallFunction/smallfun/include/" DESTINATION src) -install(DIRECTORY "${OSSIA_3RDPARTY_FOLDER}/span/include/" DESTINATION src) -install(DIRECTORY "${OSSIA_3RDPARTY_FOLDER}/unordered_dense/include/" DESTINATION src) -install(DIRECTORY "${OSSIA_3RDPARTY_FOLDER}/libremidi/include/" DESTINATION src) -install(DIRECTORY "${OSSIA_3RDPARTY_FOLDER}/concurrentqueue/" DESTINATION src - FILES_MATCHING - PATTERN "*.h" - PATTERN "*/build*" EXCLUDE - PATTERN "*/tests*" EXCLUDE - PATTERN "*/benchmarks*" EXCLUDE -) +# install(DIRECTORY "${OSSIA_3RDPARTY_FOLDER}/nano-signal-slot/include/" DESTINATION src) +# install(DIRECTORY "${OSSIA_3RDPARTY_FOLDER}/tuplet/include/" DESTINATION src) +# install(DIRECTORY "${OSSIA_3RDPARTY_FOLDER}/SmallFunction/smallfun/include/" DESTINATION src) +# install(DIRECTORY "${OSSIA_3RDPARTY_FOLDER}/span/include/" DESTINATION src) +# install(DIRECTORY "${OSSIA_3RDPARTY_FOLDER}/unordered_dense/include/" DESTINATION src) +# install(DIRECTORY "${OSSIA_3RDPARTY_FOLDER}/libremidi/include/" DESTINATION src) +# install(DIRECTORY "${OSSIA_3RDPARTY_FOLDER}/concurrentqueue/" DESTINATION src +# FILES_MATCHING +# PATTERN "*.h" +# PATTERN "*/build*" EXCLUDE +# PATTERN "*/tests*" EXCLUDE +# PATTERN "*/benchmarks*" EXCLUDE +# ) install(DIRECTORY "${OSSIA_3RDPARTY_FOLDER}/boost_1_86_0/boost" DESTINATION include) install(DIRECTORY "${OSSIA_3RDPARTY_FOLDER}/nano-signal-slot/include/" DESTINATION include) install(DIRECTORY "${OSSIA_3RDPARTY_FOLDER}/tuplet/include/" DESTINATION include) @@ -134,8 +151,6 @@ foreach(file ${SOURCE_FILES}) get_filename_component(_fileName "${file}" NAME) string(REPLACE "${SRC}/" "" _fileDir "${file}") string(REPLACE "${_fileName}" "" _fileDir "${_fileDir}") - # get_filename_component(_fileDir "${file}" ABSOLUTE BASE_DIR "${SRC}") - message(" => '${_fileName}' :: '${_fileDir}'") install(FILES "${file}" DESTINATION "src/ossia/${_fileDir}") endforeach() diff --git a/src/ossia/audio/audio_engine.hpp b/src/ossia/audio/audio_engine.hpp index f1fb0ef86ea..c5e530e9c5c 100644 --- a/src/ossia/audio/audio_engine.hpp +++ b/src/ossia/audio/audio_engine.hpp @@ -5,6 +5,8 @@ #include +#include + #include namespace ossia diff --git a/src/ossia/audio/audio_parameter.cpp b/src/ossia/audio/audio_parameter.cpp index 61b104245e8..774d90f9af0 100644 --- a/src/ossia/audio/audio_parameter.cpp +++ b/src/ossia/audio/audio_parameter.cpp @@ -14,6 +14,8 @@ audio_parameter::audio_parameter(net::node_base& n) m_type = parameter_type::AUDIO; } +audio_parameter::~audio_parameter() = default; + void audio_parameter::clone_value(audio_vector& res_vec) const { if(res_vec.size() < audio.size()) diff --git a/src/ossia/context.cpp b/src/ossia/context.cpp index 94f5fc392a4..afe6f982083 100644 --- a/src/ossia/context.cpp +++ b/src/ossia/context.cpp @@ -37,6 +37,20 @@ boost::asio::detail::winsock_init<2, 2>::manual manual_winsock_init; #include #endif +#if !defined(__cpp_exceptions) +#include +namespace boost +{ +void throw_exception(std::exception const& e) +{ + std::terminate(); +} +void throw_exception(std::exception const& e, boost::source_location const& loc) +{ + std::terminate(); +} +} +#endif namespace ossia { #if defined(__cpp_exceptions) diff --git a/src/ossia/dataflow/execution/merged_policy.cpp b/src/ossia/dataflow/execution/merged_policy.cpp index 6beb89e5525..0e861ecc9c6 100644 --- a/src/ossia/dataflow/execution/merged_policy.cpp +++ b/src/ossia/dataflow/execution/merged_policy.cpp @@ -39,6 +39,7 @@ void merged_execution_state_policy::commit() commit_common(); } +#if !defined(OSSIA_FREESTANDING) threaded_merged_execution_state_policy::threaded_merged_execution_state_policy() { m_valuesOutputThread = std::thread{[this] { @@ -112,4 +113,5 @@ void threaded_merged_execution_state_policy::commit() commit_common(); } +#endif } diff --git a/src/ossia/dataflow/execution_state.cpp b/src/ossia/dataflow/execution_state.cpp index 2ce5ada026e..3e31ef4f5ac 100644 --- a/src/ossia/dataflow/execution_state.cpp +++ b/src/ossia/dataflow/execution_state.cpp @@ -29,6 +29,7 @@ void execution_state::set_policy(const tick_setup_options& opt) { switch(opt.commit) { +#if !defined(OSSIA_FREESTANDING) case tick_setup_options::Default: m_policy = std::make_unique(); return; @@ -38,6 +39,7 @@ void execution_state::set_policy(const tick_setup_options& opt) case tick_setup_options::Priorized: m_policy = std::make_unique(); return; +#endif case tick_setup_options::Merged: m_policy = std::make_unique(); return; diff --git a/src/ossia/dataflow/graph/graph.cpp b/src/ossia/dataflow/graph/graph.cpp index 547b27c04d8..e3037881bfe 100644 --- a/src/ossia/dataflow/graph/graph.cpp +++ b/src/ossia/dataflow/graph/graph.cpp @@ -13,8 +13,9 @@ #include #include - +#if !defined(OSSIA_FREESTANDING) #include +#endif namespace ossia { using boost_pool = boost::pool; @@ -79,8 +80,10 @@ graph_interface::graph_interface() : pool{std::make_shared()} { // Reserve some space +#if !defined(OSSIA_FREESTANDING) auto arr = pool->pool.ordered_malloc(1000); pool->pool.ordered_free(arr); +#endif } edge_ptr graph_interface::allocate_edge( @@ -406,6 +409,7 @@ void graph_util::check_outputs( } void graph_util::log_inputs(const graph_node& n, ossia::logger_type& logger) { +#if !defined(OSSIA_FREESTANDING) int i = 0; struct { @@ -462,10 +466,12 @@ void graph_util::log_inputs(const graph_node& n, ossia::logger_type& logger) } vis{logger, i, n.processed_frames()}; for_each_inlet(n, [&](auto& in) { in.visit(vis); }); +#endif } void graph_util::log_outputs(const graph_node& n, ossia::logger_type& logger) { +#if !defined(OSSIA_FREESTANDING) int i = 0; struct { @@ -521,10 +527,9 @@ void graph_util::log_outputs(const graph_node& n, ossia::logger_type& logger) } vis{logger, i, n.processed_frames()}; for_each_outlet(n, [&](auto& out) { out.visit(vis); }); +#endif } graph_interface::~graph_interface() = default; -audio_parameter::~audio_parameter() = default; - graph::~graph() { clear(); diff --git a/src/ossia/dataflow/graph/graph_static.hpp b/src/ossia/dataflow/graph/graph_static.hpp index 7ec9b7eefde..18bfb96d462 100644 --- a/src/ossia/dataflow/graph/graph_static.hpp +++ b/src/ossia/dataflow/graph/graph_static.hpp @@ -29,11 +29,13 @@ struct graph_static final explicit graph_static(const ossia::graph_setup_options& opt = {}) : update_fun{*this, opt} { +#if !defined(OSSIA_FREESTANDING) m_all_nodes.reserve(1024); m_enabled_cache.reserve(1024); m_topo_order_cache.reserve(1024); m_color_map_cache.reserve(1024); m_stack_cache.reserve(1024); +#endif } ~graph_static() override { clear(); } diff --git a/src/ossia/dataflow/graph/graph_utils.hpp b/src/ossia/dataflow/graph/graph_utils.hpp index 4423cc9e30a..1c1fac6db2b 100644 --- a/src/ossia/dataflow/graph/graph_utils.hpp +++ b/src/ossia/dataflow/graph/graph_utils.hpp @@ -704,9 +704,11 @@ struct OSSIA_EXPORT graph_base : graph_interface { graph_base() noexcept { +#if !defined(OSSIA_FREESTANDING) m_nodes.reserve(1024); m_node_list.reserve(1024); m_edges.reserve(1024); +#endif } [[nodiscard]] tcb::span get_nodes() const noexcept final override @@ -877,7 +879,11 @@ struct OSSIA_EXPORT graph_base : graph_interface node_map m_nodes; edge_map m_edges; +#if defined(OSSIA_FREESTANDING) + ossia::small_vector m_node_list; +#else ossia::small_vector m_node_list; +#endif graph_t m_graph; diff --git a/src/ossia/dataflow/graph/small_graph.hpp b/src/ossia/dataflow/graph/small_graph.hpp index 61d2b622f1b..f090bc3a61d 100644 --- a/src/ossia/dataflow/graph/small_graph.hpp +++ b/src/ossia/dataflow/graph/small_graph.hpp @@ -35,7 +35,7 @@ struct container_gen // using Allocator = typename Alloc::template rebind::other Allocator; // Needed because tests allocate graphs on the stack and that's too much -#if defined(OSSIA_TESTNG) +#if defined(OSSIA_TESTING) || defined(OSSIA_FREESTANDING) static constexpr std::size_t small_vec_size = 16; #else static constexpr std::size_t small_vec_size = 1024; diff --git a/src/ossia/dataflow/nodes/sine.hpp b/src/ossia/dataflow/nodes/sine.hpp index 3c5e227bece..b66a4d76bbc 100644 --- a/src/ossia/dataflow/nodes/sine.hpp +++ b/src/ossia/dataflow/nodes/sine.hpp @@ -61,4 +61,46 @@ struct sine final : public ossia::nonowning_graph_node } } }; + +struct sine_value final : public ossia::nonowning_graph_node +{ + ossia::value_inlet freq_in; + ossia::value_outlet sin_out; + + double m_cos = 1.; + double m_sin = 0.; + +public: + double freq = 440.; + double amplitude = 0.8; + sine_value() + { + m_inlets.push_back(&freq_in); + m_outlets.push_back(&sin_out); + } + + std::string label() const noexcept override { return "sine"; } + void run(const ossia::token_request& t, ossia::exec_state_facade st) noexcept override + { + auto& vals = freq_in.target()->get_data(); + if(!vals.empty()) + { + freq = ossia::clamp(ossia::convert(vals.back().value), 0.f, 20000.f); + } + + ossia::value_port& out = *sin_out; + const auto [tick_start, N] = st.timings(t); + + const auto fs = st.sampleRate(); + auto frequ_cos = std::cos(ossia::two_pi * freq / fs); + auto frequ_sin = std::sin(ossia::two_pi * freq / fs); + auto new_cos = m_cos * frequ_cos - m_sin * frequ_sin; + auto new_sin = m_cos * frequ_sin + m_sin * frequ_cos; + auto norm = (new_cos * new_cos + new_sin * new_sin); + m_cos = new_cos / norm; + m_sin = new_sin / norm; + + out.write_value(amplitude * m_sin, tick_start); + } +}; } diff --git a/src/ossia/dataflow/token_request_format.hpp b/src/ossia/dataflow/token_request_format.hpp index 442bae402a5..4ceeb18d2d2 100644 --- a/src/ossia/dataflow/token_request_format.hpp +++ b/src/ossia/dataflow/token_request_format.hpp @@ -1,7 +1,7 @@ #pragma once #include #include - +#if !defined(OSSIA_FREESTANDING) namespace fmt { template <> @@ -23,3 +23,4 @@ struct formatter final : formatter } }; } +#endif diff --git a/src/ossia/editor/curve/curve.cpp b/src/ossia/editor/curve/curve.cpp index f28b092ab0f..cf3c9d2017a 100644 --- a/src/ossia/editor/curve/curve.cpp +++ b/src/ossia/editor/curve/curve.cpp @@ -1,9 +1,7 @@ // This is an open source non-commercial project. Dear PVS-Studio, please check // it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com -#include - -#if defined(__cpp_exceptions) #include +#include #include namespace ossia @@ -37,4 +35,3 @@ void behavior::reset() ossia::apply(behavior_reset{}, *this); } } -#endif diff --git a/src/ossia/network/base/node_functions.cpp b/src/ossia/network/base/node_functions.cpp index 67198f23867..62fab7dfdcc 100644 --- a/src/ossia/network/base/node_functions.cpp +++ b/src/ossia/network/base/node_functions.cpp @@ -180,7 +180,6 @@ static constexpr int strnatcmp(nat_char const* a, nat_char const* b) } } -#if defined(OSSIA_HAS_CTRE) namespace ossia::net { namespace @@ -271,7 +270,13 @@ static node_base& create_node_rec( // Create a node auto child = node.create_child(std::string(cur)); if(!child) + { +#if defined(__cpp_exceptions) throw std::runtime_error{"create_node_rec: cannot create the node"}; +#else + std::terminate(); +#endif + } // Recurse on it return create_node_rec(*child, address.substr(first_slash_index + 1)); @@ -282,7 +287,13 @@ static node_base& create_node_rec( // Create and return the node auto child = node.create_child(std::string(address)); if(!child) + { +#if defined(__cpp_exceptions) throw std::runtime_error{"create_node_rec: cannot create the node"}; +#else + std::terminate(); +#endif + } return *child; } } @@ -369,7 +380,11 @@ std::vector find_nodes(node_base& root, string_view pattern) return {}; } } +} +#if defined(OSSIA_HAS_CTRE) +namespace ossia::net +{ // The following code, up to and including `List expand(const Range & range)` // originates from Rosetta Code, under GNU FDL: // https://rosettacode.org/wiki/Brace_expansion#C.2B.2B @@ -771,7 +786,27 @@ std::string canonicalize_str(std::string str) expand_ranges(str); return str; } +} +#else +namespace ossia::net +{ +// FIXME +std::vector expand(const std::string& range) +{ + return {range}; +} +// FIXME +std::string canonicalize_str(std::string str) +{ + return str; +} +void expand_ranges(std::string& str) { } +} +#endif + +namespace ossia::net +{ std::vector create_nodes(node_base& dev, string_view pattern) { std::vector v; @@ -1079,6 +1114,4 @@ value_map_type to_map(const node_base& n) noexcept } return map; } - } -#endif diff --git a/src/ossia/network/common/parameter_properties.hpp b/src/ossia/network/common/parameter_properties.hpp index efb9a471bff..240922300a2 100644 --- a/src/ossia/network/common/parameter_properties.hpp +++ b/src/ossia/network/common/parameter_properties.hpp @@ -54,12 +54,12 @@ enum class access_mode : int8_t */ enum class bounding_mode : int8_t { - FREE, //! The bounds are ignored - CLIP, //! \see ossia::clamp - WRAP, //! \see ossia::wrap - FOLD, //! \see ossia::fold - LOW, //! \see ossia::clamp_min - HIGH, //! \see ossia::clamp_max + FREE, //! The bounds are ignored + CLIP, //! \see ossia::clamp + WRAP, //! \see ossia::wrap + FOLD, //! \see ossia::fold + CLAMP_LOW, //! \see ossia::clamp_min + CLAMP_HIGH, //! \see ossia::clamp_max }; /** diff --git a/src/ossia/network/dataspace/gain.hpp b/src/ossia/network/dataspace/gain.hpp index 2fc54531328..1b51c18e81a 100644 --- a/src/ossia/network/dataspace/gain.hpp +++ b/src/ossia/network/dataspace/gain.hpp @@ -106,7 +106,7 @@ struct OSSIA_EXPORT linear_u : public gain_unit static ossia::domain_base domain() { return {0.f, 1.f}; } - static constexpr auto bounding() { return ossia::bounding_mode::LOW; } + static constexpr auto bounding() { return ossia::bounding_mode::CLAMP_LOW; } }; struct OSSIA_EXPORT midigain_u : public gain_unit @@ -128,7 +128,7 @@ struct OSSIA_EXPORT midigain_u : public gain_unit static ossia::domain_base domain() { return {0.f, 127.f}; } - static constexpr auto bounding() { return ossia::bounding_mode::LOW; } + static constexpr auto bounding() { return ossia::bounding_mode::CLAMP_LOW; } }; struct OSSIA_EXPORT decibel_u : public gain_unit @@ -150,7 +150,7 @@ struct OSSIA_EXPORT decibel_u : public gain_unit static ossia::domain_base domain() { return {-96.f, 12.f}; } - static constexpr auto bounding() { return ossia::bounding_mode::LOW; } + static constexpr auto bounding() { return ossia::bounding_mode::CLAMP_LOW; } }; struct OSSIA_EXPORT decibel_raw_u : public gain_unit diff --git a/src/ossia/network/dataspace/time.hpp b/src/ossia/network/dataspace/time.hpp index 5d5cd669ed8..4b91b77086b 100644 --- a/src/ossia/network/dataspace/time.hpp +++ b/src/ossia/network/dataspace/time.hpp @@ -117,7 +117,7 @@ struct frequency_u : public timing_unit static ossia::domain_base domain() { return {0.f, 24000.f}; } - static constexpr auto bounding() { return ossia::bounding_mode::LOW; } + static constexpr auto bounding() { return ossia::bounding_mode::CLAMP_LOW; } }; struct mel_u : public timing_unit @@ -136,7 +136,7 @@ struct mel_u : public timing_unit static ossia::domain_base domain() { return {0.f, 4016.f}; } - static constexpr auto bounding() { return ossia::bounding_mode::LOW; } + static constexpr auto bounding() { return ossia::bounding_mode::CLAMP_LOW; } }; struct midi_pitch_u : public timing_unit @@ -158,7 +158,7 @@ struct midi_pitch_u : public timing_unit static ossia::domain_base domain() { return {0.f, 127.f}; } - static constexpr auto bounding() { return ossia::bounding_mode::LOW; } + static constexpr auto bounding() { return ossia::bounding_mode::CLAMP_LOW; } }; struct millisecond_u : public timing_unit @@ -203,7 +203,7 @@ struct sample_u : public timing_unit static ossia::domain_base domain() { return {0.f, 44100.f}; } - static constexpr auto bounding() { return ossia::bounding_mode::LOW; } + static constexpr auto bounding() { return ossia::bounding_mode::CLAMP_LOW; } }; template @@ -226,7 +226,7 @@ struct playback_speed_u : public timing_unit static ossia::domain_base domain() { return {0.f, 2.f}; } - static constexpr auto bounding() { return ossia::bounding_mode::LOW; } + static constexpr auto bounding() { return ossia::bounding_mode::CLAMP_LOW; } }; // template diff --git a/src/ossia/network/domain/detail/domain_impl.cpp b/src/ossia/network/domain/detail/domain_impl.cpp index 3896c34d936..efa5717272a 100644 --- a/src/ossia/network/domain/detail/domain_impl.cpp +++ b/src/ossia/network/domain/detail/domain_impl.cpp @@ -131,9 +131,9 @@ ossia::value numeric_clamp::operator()(bounding_mode b, U&& val) const return T(ossia::wrap(std::forward(val), min, max)); case bounding_mode::FOLD: return T(ossia::fold(std::forward(val), min, max)); - case bounding_mode::LOW: + case bounding_mode::CLAMP_LOW: return T(ossia::max(std::forward(val), min)); - case bounding_mode::HIGH: + case bounding_mode::CLAMP_HIGH: return T(ossia::min(std::forward(val), max)); default: break; @@ -145,7 +145,7 @@ ossia::value numeric_clamp::operator()(bounding_mode b, U&& val) const switch(b) { case bounding_mode::CLIP: - case bounding_mode::LOW: + case bounding_mode::CLAMP_LOW: return T(ossia::max(std::forward(val), min)); default: break; @@ -157,7 +157,7 @@ ossia::value numeric_clamp::operator()(bounding_mode b, U&& val) const switch(b) { case bounding_mode::CLIP: - case bounding_mode::HIGH: + case bounding_mode::CLAMP_HIGH: return T(ossia::min(val, max)); default: break; @@ -218,9 +218,9 @@ ossia::value numeric_clamp>::operator()(bounding_mode b, U&& v return bool(ossia::wrap(std::forward(val), false, true)); case bounding_mode::FOLD: return bool(ossia::fold(std::forward(val), false, true)); - case bounding_mode::LOW: + case bounding_mode::CLAMP_LOW: return bool(ossia::max(std::forward(val), false)); - case bounding_mode::HIGH: + case bounding_mode::CLAMP_HIGH: return bool(ossia::min(std::forward(val), true)); default: return std::forward(val); @@ -259,11 +259,11 @@ numeric_clamp::operator()(bounding_mode b, std::array val) const for(std::size_t i = 0; i < N; i++) val[i] = ossia::fold(val[i], min, max); break; - case bounding_mode::LOW: + case bounding_mode::CLAMP_LOW: for(std::size_t i = 0; i < N; i++) val[i] = ossia::max(val[i], min); break; - case bounding_mode::HIGH: + case bounding_mode::CLAMP_HIGH: for(std::size_t i = 0; i < N; i++) val[i] = ossia::min(val[i], max); break; @@ -277,7 +277,7 @@ numeric_clamp::operator()(bounding_mode b, std::array val) const switch(b) { case bounding_mode::CLIP: - case bounding_mode::LOW: + case bounding_mode::CLAMP_LOW: for(std::size_t i = 0; i < N; i++) val[i] = ossia::max(val[i], min); default: @@ -290,7 +290,7 @@ numeric_clamp::operator()(bounding_mode b, std::array val) const switch(b) { case bounding_mode::CLIP: - case bounding_mode::HIGH: + case bounding_mode::CLAMP_HIGH: for(std::size_t i = 0; i < N; i++) val[i] = ossia::min(val[i], max); default: @@ -363,10 +363,10 @@ value list_clamp::operator()(bounding_mode b, const std::vector& v case bounding_mode::FOLD: res[i] = ossia::fold(val[i], min[i], max[i]); break; - case bounding_mode::LOW: + case bounding_mode::CLAMP_LOW: res[i] = ossia::clamp_min(val[i], min[i]); break; - case bounding_mode::HIGH: + case bounding_mode::CLAMP_HIGH: res[i] = ossia::clamp_max(val[i], max[i]); break; default: @@ -379,7 +379,7 @@ value list_clamp::operator()(bounding_mode b, const std::vector& v switch(b) { case bounding_mode::CLIP: - case bounding_mode::LOW: + case bounding_mode::CLAMP_LOW: res[i] = ossia::clamp_min(val[i], min[i]); break; default: @@ -392,7 +392,7 @@ value list_clamp::operator()(bounding_mode b, const std::vector& v switch(b) { case bounding_mode::CLIP: - case bounding_mode::HIGH: + case bounding_mode::CLAMP_HIGH: res[i] = ossia::clamp_max(val[i], max[i]); break; default: @@ -410,7 +410,7 @@ value list_clamp::operator()(bounding_mode b, const std::vector& v switch(b) { case bounding_mode::CLIP: - case bounding_mode::LOW: + case bounding_mode::CLAMP_LOW: res[i] = ossia::clamp_min(val[i], min[i]); break; default: @@ -423,7 +423,7 @@ value list_clamp::operator()(bounding_mode b, const std::vector& v switch(b) { case bounding_mode::CLIP: - case bounding_mode::HIGH: + case bounding_mode::CLAMP_HIGH: res[i] = ossia::clamp_max(val[i], max[i]); break; default: @@ -459,11 +459,11 @@ ossia::value numeric_clamp>::operator()( for(std::size_t i = 0; i < N; i++) val[i] = ossia::fold(bool(val[i]), min, max); break; - case bounding_mode::LOW: + case bounding_mode::CLAMP_LOW: for(std::size_t i = 0; i < N; i++) val[i] = ossia::max(bool(val[i]), min); break; - case bounding_mode::HIGH: + case bounding_mode::CLAMP_HIGH: for(std::size_t i = 0; i < N; i++) val[i] = ossia::min(bool(val[i]), max); break; @@ -518,10 +518,10 @@ value list_clamp::operator()(bounding_mode b, std::vector&& val) c case bounding_mode::FOLD: res[i] = ossia::fold(std::move(val[i]), min[i], max[i]); break; - case bounding_mode::LOW: + case bounding_mode::CLAMP_LOW: res[i] = ossia::clamp_min(std::move(val[i]), min[i]); break; - case bounding_mode::HIGH: + case bounding_mode::CLAMP_HIGH: res[i] = ossia::clamp_max(std::move(val[i]), max[i]); break; default: @@ -534,7 +534,7 @@ value list_clamp::operator()(bounding_mode b, std::vector&& val) c switch(b) { case bounding_mode::CLIP: - case bounding_mode::LOW: + case bounding_mode::CLAMP_LOW: res[i] = ossia::clamp_min(std::move(val[i]), min[i]); break; default: @@ -547,7 +547,7 @@ value list_clamp::operator()(bounding_mode b, std::vector&& val) c switch(b) { case bounding_mode::CLIP: - case bounding_mode::HIGH: + case bounding_mode::CLAMP_HIGH: res[i] = ossia::clamp_max(std::move(val[i]), max[i]); break; default: @@ -565,7 +565,7 @@ value list_clamp::operator()(bounding_mode b, std::vector&& val) c switch(b) { case bounding_mode::CLIP: - case bounding_mode::LOW: + case bounding_mode::CLAMP_LOW: res[i] = ossia::clamp_min(std::move(val[i]), min[i]); break; default: @@ -578,7 +578,7 @@ value list_clamp::operator()(bounding_mode b, std::vector&& val) c switch(b) { case bounding_mode::CLIP: - case bounding_mode::HIGH: + case bounding_mode::CLAMP_HIGH: res[i] = ossia::clamp_max(std::move(val[i]), max[i]); break; default: @@ -634,10 +634,10 @@ value vec_clamp::operator()(bounding_mode b, std::array val) const case bounding_mode::FOLD: res[i] = ossia::fold(val[i], *min[i], *max[i]); break; - case bounding_mode::LOW: + case bounding_mode::CLAMP_LOW: res[i] = ossia::max(val[i], *min[i]); break; - case bounding_mode::HIGH: + case bounding_mode::CLAMP_HIGH: res[i] = ossia::min(val[i], *max[i]); break; default: @@ -650,7 +650,7 @@ value vec_clamp::operator()(bounding_mode b, std::array val) const switch(b) { case bounding_mode::CLIP: - case bounding_mode::LOW: + case bounding_mode::CLAMP_LOW: res[i] = ossia::max(val[i], *min[i]); break; default: @@ -663,7 +663,7 @@ value vec_clamp::operator()(bounding_mode b, std::array val) const switch(b) { case bounding_mode::CLIP: - case bounding_mode::HIGH: + case bounding_mode::CLAMP_HIGH: res[i] = ossia::min(val[i], *max[i]); break; default: @@ -702,9 +702,9 @@ value generic_clamp::operator()(bounding_mode b, const value& v) const return ossia::wrap(v, min, max); case bounding_mode::FOLD: return ossia::fold(v, min, max); - case bounding_mode::LOW: + case bounding_mode::CLAMP_LOW: return ossia::clamp_min(v, min); - case bounding_mode::HIGH: + case bounding_mode::CLAMP_HIGH: return ossia::clamp_max(v, max); default: break; @@ -716,7 +716,7 @@ value generic_clamp::operator()(bounding_mode b, const value& v) const switch(b) { case bounding_mode::CLIP: - case bounding_mode::LOW: + case bounding_mode::CLAMP_LOW: return ossia::clamp_min(v, min); default: break; @@ -728,7 +728,7 @@ value generic_clamp::operator()(bounding_mode b, const value& v) const switch(b) { case bounding_mode::CLIP: - case bounding_mode::HIGH: + case bounding_mode::CLAMP_HIGH: return ossia::clamp_max(v, max); default: break; @@ -767,9 +767,9 @@ value generic_clamp::operator()(bounding_mode b, value&& v) const return ossia::wrap(std::move(v), min, max); case bounding_mode::FOLD: return ossia::fold(std::move(v), min, max); - case bounding_mode::LOW: + case bounding_mode::CLAMP_LOW: return ossia::clamp_min(std::move(v), min); - case bounding_mode::HIGH: + case bounding_mode::CLAMP_HIGH: return ossia::clamp_max(std::move(v), max); default: break; @@ -781,7 +781,7 @@ value generic_clamp::operator()(bounding_mode b, value&& v) const switch(b) { case bounding_mode::CLIP: - case bounding_mode::LOW: + case bounding_mode::CLAMP_LOW: return ossia::clamp_min(std::move(v), min); default: break; @@ -793,7 +793,7 @@ value generic_clamp::operator()(bounding_mode b, value&& v) const switch(b) { case bounding_mode::CLIP: - case bounding_mode::HIGH: + case bounding_mode::CLAMP_HIGH: return ossia::clamp_max(std::move(v), max); default: break; @@ -842,11 +842,11 @@ value generic_clamp::operator()( for(auto& v : val) res.push_back(ossia::fold(v, min, max)); break; - case bounding_mode::LOW: + case bounding_mode::CLAMP_LOW: for(auto& v : val) res.push_back(ossia::clamp_min(v, min)); break; - case bounding_mode::HIGH: + case bounding_mode::CLAMP_HIGH: for(auto& v : val) res.push_back(ossia::clamp_max(v, max)); break; @@ -861,7 +861,7 @@ value generic_clamp::operator()( switch(b) { case bounding_mode::CLIP: - case bounding_mode::LOW: { + case bounding_mode::CLAMP_LOW: { const auto& min = *domain.min; std::vector res; res.reserve(val.size()); @@ -880,7 +880,7 @@ value generic_clamp::operator()( switch(b) { case bounding_mode::CLIP: - case bounding_mode::HIGH: { + case bounding_mode::CLAMP_HIGH: { const auto& max = *domain.max; std::vector res; res.reserve(val.size()); @@ -942,11 +942,11 @@ value generic_clamp::operator()(bounding_mode b, std::vector&& val for(auto& v : val) v = ossia::fold(v, min, max); break; - case bounding_mode::LOW: + case bounding_mode::CLAMP_LOW: for(auto& v : val) v = ossia::clamp_min(v, min); break; - case bounding_mode::HIGH: + case bounding_mode::CLAMP_HIGH: for(auto& v : val) v = ossia::clamp_max(v, max); break; @@ -962,7 +962,7 @@ value generic_clamp::operator()(bounding_mode b, std::vector&& val switch(b) { case bounding_mode::CLIP: - case bounding_mode::LOW: { + case bounding_mode::CLAMP_LOW: { for(auto& v : val) v = ossia::clamp_min(v, min); return value{std::move(val)}; @@ -977,7 +977,7 @@ value generic_clamp::operator()(bounding_mode b, std::vector&& val switch(b) { case bounding_mode::CLIP: - case bounding_mode::HIGH: { + case bounding_mode::CLAMP_HIGH: { for(auto& v : val) v = ossia::clamp_max(v, max); return value{std::move(val)};