3#include <ossia/dataflow/exec_state_facade.hpp>
4#include <ossia/dataflow/token_request.hpp>
5#include <ossia/editor/scenario/time_value.hpp>
6#include <ossia/math/math_expression.hpp>
8#include <halp/audio.hpp>
9#include <halp/controls.hpp>
10#include <halp/meta.hpp>
11#include <halp/midi.hpp>
23inline bool uses_identifier(std::string_view expr, std::string_view
id)
noexcept
25 static constexpr auto is_ident_char = [](
char c)
noexcept {
26 return (c >=
'a' && c <=
'z') || (c >=
'A' && c <=
'Z') || (c >=
'0' && c <=
'9')
30 for(
auto pos = expr.find(
id); pos != std::string_view::npos;
31 pos = expr.find(
id, pos + 1))
33 const auto end = pos +
id.size();
34 const bool left_ok = (pos == 0) || !is_ident_char(expr[pos - 1]);
35 const bool right_ok = (end >= expr.size()) || !is_ident_char(expr[end]);
36 if(left_ok && right_ok)
42template <
typename State>
43static void setMathExpressionTiming(
44 State& self, int64_t input_time, int64_t prev_time, std::integral
auto parent_dur)
47template <
typename State>
48static void setMathExpressionTiming(
49 State& self, int64_t input_time, int64_t prev_time,
50 std::floating_point
auto parent_pos)
52 self.cur_time = input_time;
53 self.cur_deltatime = (input_time - prev_time);
54 self.cur_pos = parent_pos;
57template <
typename State>
58static void setMathExpressionTiming(
State& self,
const halp::tick_flicks& tk)
60 self.cur_time = tk.end_in_flicks;
61 self.cur_deltatime = tk.end_in_flicks - tk.start_in_flicks;
62 self.cur_pos = tk.parent_duration > 0 ? tk.relative_position : 0.;
Utilities for OSSIA data structures.
Definition DeviceInterface.hpp:35