From bc4592b88f99c1d366945133e7fb01e5ba4d2908 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Micha=C3=ABl=20Celerier?= Date: Sat, 23 Sep 2023 15:06:58 -0400 Subject: [PATCH] [ci] Work on build & test fixes --- 3rdparty/libremidi | 2 +- src/ossia-pd/src/object_base.cpp | 5 ++-- src/ossia-python/ossia_python.cpp | 4 +-- src/ossia/dataflow/execution_state.hpp | 2 ++ src/ossia/dataflow/nodes/messages.hpp | 9 +++++-- tests/Editor/ScenarioAlgoTest.cpp | 36 ++++++++++++++++---------- 6 files changed, 37 insertions(+), 21 deletions(-) diff --git a/3rdparty/libremidi b/3rdparty/libremidi index 7c3d3079874..c74a0a588b8 160000 --- a/3rdparty/libremidi +++ b/3rdparty/libremidi @@ -1 +1 @@ -Subproject commit 7c3d30798743fc039773e9a38ea9b917f8ba252c +Subproject commit c74a0a588b8e9a375a4ac4fdd96756ebd237fb2d diff --git a/src/ossia-pd/src/object_base.cpp b/src/ossia-pd/src/object_base.cpp index 74b98b2a67b..d74caf6c1f8 100644 --- a/src/ossia-pd/src/object_base.cpp +++ b/src/ossia-pd/src/object_base.cpp @@ -357,10 +357,11 @@ void object_base::set_description() switch(m_description[i].a_type) { case A_SYMBOL: - fmt::format_to(description, "{} ", m_description[i].a_w.w_symbol->s_name); + fmt::format_to( + fmt::appender(description), "{} ", m_description[i].a_w.w_symbol->s_name); break; case A_FLOAT: - fmt::format_to(description, "{} ", m_description[i].a_w.w_float); + fmt::format_to(fmt::appender(description), "{} ", m_description[i].a_w.w_float); break; default: break; diff --git a/src/ossia-python/ossia_python.cpp b/src/ossia-python/ossia_python.cpp index 336790df0f5..d8e6b5f2a53 100644 --- a/src/ossia-python/ossia_python.cpp +++ b/src/ossia-python/ossia_python.cpp @@ -585,8 +585,8 @@ PYBIND11_MODULE(ossia_python, m) py::class_(m, "MidiInfo") .def(py::init()) .def_readonly("type", &ossia::net::midi::midi_info::type) - .def_readonly("device", &ossia::net::midi::midi_info::device) - .def_readonly("port", &ossia::net::midi::midi_info::port); + .def_readonly("handle", &ossia::net::midi::midi_info::handle) + .def_readonly("virtual", &ossia::net::midi::midi_info::is_virtual); py::enum_(m, "MidiDeviceType", py::arithmetic()) .value("Output", ossia::net::midi::midi_info::Type::Output) diff --git a/src/ossia/dataflow/execution_state.hpp b/src/ossia/dataflow/execution_state.hpp index cf807eb6e31..c815b5acd02 100644 --- a/src/ossia/dataflow/execution_state.hpp +++ b/src/ossia/dataflow/execution_state.hpp @@ -105,7 +105,9 @@ struct OSSIA_EXPORT execution_state : public Nano::Observer double start_date{}; // in ns, for vst double cur_date{}; +#if !defined(OSSIA_TESTING) private: +#endif void get_new_values(); void register_parameter(ossia::net::parameter_base& p); diff --git a/src/ossia/dataflow/nodes/messages.hpp b/src/ossia/dataflow/nodes/messages.hpp index 68d06a5b219..15849a086a6 100644 --- a/src/ossia/dataflow/nodes/messages.hpp +++ b/src/ossia/dataflow/nodes/messages.hpp @@ -1,10 +1,13 @@ #pragma once #include +#include #include +#include #include namespace ossia::nodes { +// This is only used for testing so not very efficient by design class messages final : public ossia::graph_node { public: @@ -14,9 +17,11 @@ class messages final : public ossia::graph_node { for(auto& msg : data) { - e.insert( - msg.dest.address(), + ossia::value_port p; + p.add_local_value( ossia::typed_value{msg.message_value, msg.dest.index, msg.dest.unit}); + + e.impl->insert(msg.dest.address(), p); } } diff --git a/tests/Editor/ScenarioAlgoTest.cpp b/tests/Editor/ScenarioAlgoTest.cpp index 3dab4b870f8..e2f2b5dc247 100644 --- a/tests/Editor/ScenarioAlgoTest.cpp +++ b/tests/Editor/ScenarioAlgoTest.cpp @@ -5,6 +5,7 @@ #include +#include #include #include #include @@ -910,6 +911,12 @@ TEST_CASE("test_autom_and_state", "test_autom_and_state") // s.interval->tick(1_tv); } +static auto& get_value_state(ossia::execution_state& s) +{ + return static_cast(s.m_policy.get()) + ->m_valueState; +}; + TEST_CASE("test_percentage", "test_percentage") { @@ -937,31 +944,31 @@ TEST_CASE("test_percentage", "test_percentage") { ossia::execution_state s; g.state(s); - REQUIRE(s.m_valueState.size() == 1); - REQUIRE(s.m_valueState.begin()->second.back().first.value == ossia::value(0.f)); + REQUIRE(get_value_state(s).size() == 1); + REQUIRE(get_value_state(s).begin()->second.back().first.value == ossia::value(0.f)); } s.interval->tick(1_tv, default_request()); { ossia::execution_state s; g.state(s); - REQUIRE(s.m_valueState.size() == 1); - REQUIRE(s.m_valueState.begin()->second.back().first.value == ossia::value(0.5f)); + REQUIRE(get_value_state(s).size() == 1); + REQUIRE(get_value_state(s).begin()->second.back().first.value == ossia::value(0.5f)); } s.interval->tick(1_tv, default_request()); { ossia::execution_state s; g.state(s); - REQUIRE(s.m_valueState.size() == 1); - REQUIRE(s.m_valueState.begin()->second.back().first.value == ossia::value(1.f)); + REQUIRE(get_value_state(s).size() == 1); + REQUIRE(get_value_state(s).begin()->second.back().first.value == ossia::value(1.f)); } s.interval->tick(1_tv, default_request()); { ossia::execution_state s; g.state(s); - REQUIRE(s.m_valueState.empty()); + REQUIRE(get_value_state(s).empty()); } } @@ -991,31 +998,32 @@ TEST_CASE("test_percentage_long", "test_percentage_long") { ossia::execution_state s; g.state(s); - REQUIRE(s.m_valueState.size() == 1); - REQUIRE(s.m_valueState.begin()->second.back().first.value == ossia::value(0.f)); + REQUIRE(get_value_state(s).size() == 1); + REQUIRE(get_value_state(s).begin()->second.back().first.value == ossia::value(0.f)); } s.interval->tick(3_tv, default_request()); { ossia::execution_state s; g.state(s); - REQUIRE(s.m_valueState.size() == 1); - REQUIRE(s.m_valueState.begin()->second.back().first.value == ossia::value(3. / 5.)); + REQUIRE(get_value_state(s).size() == 1); + REQUIRE( + get_value_state(s).begin()->second.back().first.value == ossia::value(3. / 5.)); } s.interval->tick(7_tv, default_request()); { ossia::execution_state s; g.state(s); - REQUIRE(s.m_valueState.size() == 1); - REQUIRE(s.m_valueState.begin()->second.back().first.value == ossia::value(1.f)); + REQUIRE(get_value_state(s).size() == 1); + REQUIRE(get_value_state(s).begin()->second.back().first.value == ossia::value(1.f)); } s.interval->tick(1_tv, default_request()); { ossia::execution_state s; g.state(s); - REQUIRE(s.m_valueState.empty()); + REQUIRE(get_value_state(s).empty()); } }