public static bool ToColor(this OSCMessage message, out Color value, bool force = false) { var values = message.GetValues(OSCValueType.Color); if (values.Length > 0) { var firstValue = values[0]; value = firstValue.ColorValue; return(true); } if (force) { Vector3 vector3; if (message.ToVector3(out vector3)) { value = new Color(vector3.x, vector3.y, vector3.z); return(true); } Vector4 vector4; if (message.ToVector4(out vector4)) { value = new Color(vector4.x, vector4.y, vector4.z, vector4.w); return(true); } } value = Color.white; return(false); }
public static bool ToVector3(this OSCMessage message, out Vector3 value, bool force = false) { var values = message.GetValues(OSCValueType.Float); if (values.Length >= 3) { var firstValue = values[0]; var secondValue = values[1]; var thirdValue = values[2]; value = new Vector3(firstValue.FloatValue, secondValue.FloatValue, thirdValue.FloatValue); return(true); } if (force) { Vector2 vector2; if (message.ToVector2(out vector2)) { value = vector2; return(true); } Vector4 vector4; if (message.ToVector4(out vector4)) { value = vector4; return(true); } } value = Vector3.zero; return(false); }
public static bool ToArray(this OSCMessage message, out List <OSCValue> value) { var values = message.GetValues(OSCValueType.Array); if (values.Length > 0) { var firstValue = values[0]; value = firstValue.ArrayValue; return(true); } value = new List <OSCValue>(); return(false); }
public static bool ToMidi(this OSCMessage message, out OSCMidi value) { var values = message.GetValues(OSCValueType.Midi); if (values.Length > 0) { var firstValue = values[0]; value = firstValue.MidiValue; return(true); } value = default(OSCMidi); return(false); }
public static bool ToTimeTag(this OSCMessage message, out DateTime value) { var values = message.GetValues(OSCValueType.TimeTag); if (values.Length > 0) { var firstValue = values[0]; value = firstValue.TimeTagValue; return(true); } value = default(DateTime); return(false); }
public static bool ToBlob(this OSCMessage message, out byte[] value) { var values = message.GetValues(OSCValueType.Blob); if (values.Length > 0) { var firstValue = values[0]; value = firstValue.BlobValue; return(true); } value = default(byte[]); return(false); }
public static bool ToString(this OSCMessage message, out string value) { var values = message.GetValues(OSCValueType.String); if (values.Length > 0) { var firstValue = values[0]; value = firstValue.StringValue; return(true); } value = default(string); return(false); }
public static bool ToChar(this OSCMessage message, out char value) { var values = message.GetValues(OSCValueType.Char); if (values.Length > 0) { var firstValue = values[0]; value = firstValue.CharValue; return(true); } value = default(char); return(false); }
public static bool ToBool(this OSCMessage message, out bool value) { var values = message.GetValues(OSCValueType.True, OSCValueType.False); if (values.Length > 0) { var firstValue = values[0]; value = firstValue.BoolValue; return(true); } value = default(bool); return(false); }
public static bool ToLong(this OSCMessage message, out long value) { var values = message.GetValues(OSCValueType.Long); if (values.Length > 0) { var firstValue = values[0]; value = firstValue.LongValue; return(true); } value = 0; return(false); }
public static bool ToDoubleTwo(this OSCMessage message, out double value) { var values = message.GetValues(OSCValueType.Double); if (values.Length > 0) { var firstValue = values[1]; value = firstValue.DoubleValue; return(true); } value = 0; return(false); }
public static bool ToInt(this OSCMessage message, out int value) { var values = message.GetValues(OSCValueType.Int); if (values.Length > 0) { var firstValue = values[0]; value = firstValue.IntValue; return(true); } value = 0; return(false); }
public static bool HasNull(this OSCMessage message) { var values = message.GetValues(OSCValueType.Null); return(values.Length > 0); }
public static bool HasImpulse(this OSCMessage message) { var values = message.GetValues(OSCValueType.Impulse); return(values.Length > 0); }