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

◆ get_float()

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

Extract a float argument by index.

int32_t arguments are widened to float.

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

Definition at line 120 of file InputBinding.cpp.

121{
122 if (index >= arguments.size())
123 return std::nullopt;
124 return std::visit([](const auto& v) -> std::optional<float> {
125 using T = std::decay_t<decltype(v)>;
126 if constexpr (std::is_same_v<T, float>)
127 return v;
128 if constexpr (std::is_same_v<T, int32_t>)
129 return static_cast<float>(v);
130 return std::nullopt;
131 },
133}
uint32_t index
Definition VKDevice.cpp:142
std::vector< OSCArg > arguments
Typed arguments.

References index.