MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ get_int()

std::optional< int32_t > MayaFlux::Core::InputValue::OSCMessage::get_int ( size_t  index = 0) const
noexcept

Extract an int32 argument by index.

float arguments are truncated to int32_t.

Parameters
indexArgument index (0-based).
Returns
Int value, or std::nullopt if out of range or wrong type.

Definition at line 130 of file InputBinding.cpp.

131{
132 if (index >= arguments.size())
133 return std::nullopt;
134 return std::visit([](const auto& v) -> std::optional<int32_t> {
135 using T = std::decay_t<decltype(v)>;
136 if constexpr (std::is_same_v<T, int32_t>)
137 return v;
138 if constexpr (std::is_same_v<T, float>)
139 return static_cast<int32_t>(v);
140 return std::nullopt;
141 },
142 arguments[index]);
143}
std::vector< OSCArg > arguments
Typed arguments.