Beispiel #1
0
 public void Write(XmlWriter writer)
 {
     writer.WriteStartElement("sub");
     writer.WriteAttributeString("alias", _alias);
     _writer.Write(writer);
     writer.WriteEndElement();
 }
Beispiel #2
0
        public void Write(XmlWriter writer)
        {
            writer.WriteStartElement("w");
            string attributeValue = PronounceRoleAttributeValueMap[_role];

            writer.WriteAttributeString("role", attributeValue);
            _writer.Write(writer);
            writer.WriteEndElement();
        }
        public void Write(XmlWriter writer)
        {
            writer.WriteStartElement("amazon", "effect", "amazon");
            string attributeValue = AmazonEffectAttributeValueMap[_effect];

            writer.WriteAttributeString("name", attributeValue);
            _writer.Write(writer);
            writer.WriteEndElement();
        }
        public void Write(XmlWriter writer)
        {
            writer.WriteStartElement("phoneme");
            string attributeValue = PhoneticAlphabetAttributeValueMap[_alphabet];

            writer.WriteAttributeString("alphabet", attributeValue);
            writer.WriteAttributeString("ph", _phoneticPronunciation);
            _writer.Write(writer);
            writer.WriteEndElement();
        }
        public void Write(XmlWriter writer)
        {
            writer.WriteStartElement("emphasis");

            if (_level != EmphasiseLevel.NotSet)
            {
                string attributeValue = EmphasiseAttributeValueMap[_level];
                writer.WriteAttributeString("level", attributeValue);
            }

            _writer.Write(writer);
            writer.WriteEndElement();
        }
        public void Write(XmlWriter writer)
        {
            writer.WriteStartElement("prosody");

            if (_rate != SpeechRate.NotSet)
            {
                string value = SpeechRateAttributeValueMap[_rate];
                writer.WriteAttributeString("rate", value);
            }
            else if (_rateInPercentage.HasValue)
            {
                if (_rateInPercentage.Value < 20)
                {
                    throw new SpeechException("The minimum value you can provide for speech rate is 20%.");
                }
                string percentage = _rateInPercentage.Value.ToString("0.##", CultureInfo.InvariantCulture);
                writer.WriteAttributeString("rate", $"{percentage}%");
            }
            if (_pitch != SpeechPitch.NotSet)
            {
                string value = SpeechPitchAttributeValueMap[_pitch];
                writer.WriteAttributeString("pitch", value);
            }
            else if (_pitchInPercentage.HasValue)
            {
                string percentage = _pitchInPercentage.Value.ToString("0.##", CultureInfo.InvariantCulture);
                writer.WriteAttributeString("pitch", $"{(_pitchInPercentage.Value > 0 ? "+" : string.Empty)}{percentage}%");
            }
            if (_volume != SpeechVolume.NotSet)
            {
                string value = SpeechVolumeAttributeValueMap[_volume];
                writer.WriteAttributeString("volume", value);
            }
            else if (_volumeInDecibels.HasValue)
            {
                if (_volumeInDecibels.Value > 4.08)
                {
                    throw new SpeechException("The maximum positive value for volume is +4.08dB.");
                }
                string decibels = _volumeInDecibels.Value.ToString("0.##", CultureInfo.InvariantCulture);
                writer.WriteAttributeString("volume", $"{(_volumeInDecibels.Value >= 0 ? "+" : string.Empty)}{decibels}dB");
            }
            _writer.Write(writer);
            writer.WriteEndElement();
        }
Beispiel #7
0
        public void Write(XmlWriter writer)
        {
            writer.WriteStartDocument();
            writer.WriteStartElement("speak");

            for (var index = 0; index < _says.Count; index++)
            {
                ISpeechWriter say = _says[index];
                say.Write(writer);
                if (index != _says.Count - 1)
                {
                    writer.WriteString(" ");
                }
            }

            writer.WriteEndElement();
            writer.WriteEndDocument();
        }
Beispiel #8
0
 public void Write(XmlWriter writer)
 {
     writer.WriteStartElement(_tag);
     _writer.Write(writer);
     writer.WriteEndElement();
 }
Beispiel #9
0
 public void Write(XmlWriter writer)
 {
     _writer.Write(writer);
 }