2 #include <State/Address.hpp>
4 #include <Device/Address/AddressSettings.hpp>
5 #include <Device/Node/DeviceNode.hpp>
7 #include <Curve/CurveModel.hpp>
9 #include <ossia/network/domain/domain.hpp>
10 #include <ossia/network/value/value_conversion.hpp>
16 class CommandStackFacade;
17 struct DocumentContext;
25 void InterpolateStates(
31 template <std::
size_t N>
32 std::size_t operator()(
const std::array<float, N>& arr)
37 std::size_t operator()(
const std::vector<ossia::value>& arr) {
return arr.size(); }
39 std::size_t operator()() {
return 0; }
42 std::size_t operator()(
const T& other)
44 throw std::runtime_error(
"invalid type, should not happen");
51 const ossia::destination_index& idx;
54 template <std::
size_t N>
56 operator()(
const std::array<float, N>& start,
const std::array<float, N>& end)
58 SCORE_ASSERT(!idx.empty());
59 const auto i = idx[0];
62 if(
auto node = Device::try_getNodeFromAddress(rootNode, address.address))
66 if(
auto dom = as.domain.get().v.target<ossia::vecf_domain<N>>())
68 if(
auto min_v = dom->min[i])
69 d.min = std::min(d.min, (
double)*min_v);
70 if(
auto max_v = dom->max[i])
71 d.max = std::max(d.max, (
double)*max_v);
79 const std::vector<ossia::value>& start,
const std::vector<ossia::value>& end)
81 SCORE_ASSERT(!idx.empty());
82 const auto i = (std::size_t)idx[0];
84 ossia::convert<double>(start[i]), ossia::convert<double>(end[i])};
86 if(
auto node = Device::try_getNodeFromAddress(rootNode, address.address))
90 if(
auto dom = as.domain.get().v.target<ossia::vector_domain>())
92 if(dom->min.size() > i)
93 d.min = std::min(d.min, ossia::convert<double>(dom->min[i]));
94 if(dom->max.size() > i)
95 d.max = std::max(d.max, ossia::convert<double>(dom->max[i]));
103 operator()(
const ossia::value_map_type& start,
const ossia::value_map_type& end)
108 template <
typename T>
113 if(
auto node = Device::try_getNodeFromAddress(rootNode, address.address))
117 d.refine(as.domain.get());
123 Curve::CurveDomain operator()(ossia::impulse start, ossia::impulse end) {
return {}; }
130 template <
typename T,
typename U>
139 const ossia::destination_index& idx;
141 template <std::
size_t N>
142 std::pair<double, double>
143 operator()(
const std::array<float, N>& start,
const std::array<float, N>& end)
145 SCORE_ASSERT(!idx.empty());
146 const auto i = idx[0];
147 return {(double)start[i], (
double)end[i]};
150 std::pair<double, double> operator()(
151 const std::vector<ossia::value>& start,
const std::vector<ossia::value>& end)
153 SCORE_ASSERT(!idx.empty());
154 const auto i = idx[0];
155 return {ossia::convert<double>(start[i]), ossia::convert<double>(end[i])};
158 template <
typename T>
159 std::pair<double, double> operator()(
const T& start,
const T& end)
161 return {(double)start, (
double)end};
164 std::pair<double, double> operator()(ossia::impulse start, ossia::impulse end)
169 std::pair<double, double> operator()(
const std::string& start,
const std::string& end)
174 template <
typename T,
typename U>
175 std::pair<double, double> operator()(
const T& start,
const U& end)
A small abstraction layer over the score::CommandStack.
Definition: CommandStackFacade.hpp:20
Main plug-in of score.
Definition: score-plugin-dataflow/Dataflow/PortItem.hpp:14
Base toolkit upon which the software is built.
Definition: Application.cpp:90
Definition: CurveModel.hpp:104
Definition: AddressSettings.hpp:49
Definition: InterpolateStates.hpp:49
Definition: InterpolateStates.hpp:138
Definition: InterpolateStates.hpp:30
Definition: Address.hpp:108