/// <summary> /// Generate the ScriptUvSeg object from the xml doc indicated by reader. /// </summary> /// <param name="reader">Xml text reader.</param> public void ParseFromXml(XmlTextReader reader) { if (reader == null) { throw new ArgumentNullException("reader"); } string type = reader.GetAttribute("type"); _segType = FromStringToUvSegType(type); if (!reader.IsEmptyElement) { while (reader.Read()) { if (reader.NodeType == XmlNodeType.Element && reader.Name == "interval") { _interval = new ScriptUvSegInterval(); _interval.ParseFromXml(reader); } else if (reader.NodeType == XmlNodeType.Element && reader.Name == "f0") { _f0Contour = new ScriptF0Contour(reader.Name); _f0Contour.ParseFromXml(reader); } else if (reader.NodeType == XmlNodeType.Element && reader.Name == "qf0") { _f0ContourQuantized = new ScriptF0Contour(reader.Name); _f0ContourQuantized.ParseFromXml(reader); } else if (reader.NodeType == XmlNodeType.EndElement && reader.Name == "uvseg") { break; } } } }
/// <summary> /// Initializes a new instance of the <see cref="ScriptUvSeg"/> class. /// </summary> /// <param name="segType">Unvoiced-voiced segment type.</param> public ScriptUvSeg(ScriptUvSegType segType) { if (segType == ScriptUvSegType.Unknown) { throw new ArgumentOutOfRangeException("segType", "can't be ScriptUvSegType.Unknown"); } _segType = segType; }
/// <summary> /// Convert unvoiced-voiced segment type from enum type to string type. /// </summary> /// <param name="segType">Enum type of the unvoiced-voiced segment type.</param> /// <returns>String type of the unvoiced-voiced segment type.</returns> public static string FromUvSegTypeToString(ScriptUvSegType segType) { string type; switch (segType) { case ScriptUvSegType.Unknown: default: type = "unknown"; break; case ScriptUvSegType.Unvoiced: type = "u"; break; case ScriptUvSegType.Voiced: type = "v"; break; case ScriptUvSegType.Silence: type = "sil"; break; case ScriptUvSegType.Mixed: type = "mixed"; break; } return type; }
/// <summary> /// Initializes a new instance of the <see cref="ScriptUvSeg"/> class. /// </summary> public ScriptUvSeg() { _segType = ScriptUvSegType.Unknown; }