TtsEngineAction TtsEngineAction TtsEngineAction TtsEngineAction Enum

Definición

Especifica la acción de lenguaje de marcado de síntesis de voz (SSML) que se va a tomar para presentar un TextFragment dado.Specifies the Speech Synthesis Markup Language (SSML) action to be taken in rendering a given TextFragment.

public enum class TtsEngineAction
public enum TtsEngineAction
type TtsEngineAction = 
Public Enum TtsEngineAction
Herencia
TtsEngineActionTtsEngineActionTtsEngineActionTtsEngineAction

Campos

Bookmark Bookmark Bookmark Bookmark 3

Indica que TextFragment se va a utilizar como contenido de un marcador.Indicates that TextFragment is to be used as the contents of a bookmark.

ParseUnknownTag ParseUnknownTag ParseUnknownTag ParseUnknownTag 7

Indica que no se ha determinado ninguna acción de entrada de SSML.Indicates that no action has been determined from SSML input.

Pronounce Pronounce Pronounce Pronounce 2

Solicita que el texto TextFragment de entrada se interprete como fonemas.Requests that input TextFragment text be interpreted as phonemes.

Silence Silence Silence Silence 1

Indica que un TextFragment no contiene texto para presentarse como voz.Indicates that a TextFragment contains no text to be rendered as speech.

Speak Speak Speak Speak 0

Solicita que el objeto TextFragment asociado se procese y se hable.Requests that the associated TextFragment should be processed and spoken.

SpellOut SpellOut SpellOut SpellOut 4

Indica que los valores de texto proporcionados por TextFragment a través de su propiedad TextToSpeak se van a sintetizar como caracteres individuales.Indicates that text values provided by a TextFragment through its TextToSpeak property are to be synthesize as individual characters.

StartParagraph StartParagraph StartParagraph StartParagraph 6

Indica el estado del párrafo.Indicates state of paragraph.

StartSentence StartSentence StartSentence StartSentence 5

Indica el inicio de la frase.Indicates start of sentence.

Ejemplos

El ejemplo siguiente es parte de una implementación de síntesis de voz personalizado hereda de TtsEngineSsmly el uso de la utilización de TextFragment, FragmentState, y TtsEventIdThe example below is part of a custom speech synthesis implementation inheriting from TtsEngineSsml, and using the use of TextFragment, FragmentState, and TtsEventId

La implementación de SpeakThe implementation of Speak

  1. Recibe una matriz de TextFragment instancias y crea una nueva matriz de TextFragment instancias que se pasarán a la Speak método en un motor de síntesis subyacente.Receives an array of TextFragment instances and creates a new array of TextFragment instances to be passed to the Speak method on an underlying synthesis engine.

  2. Si el TtsEngineAction por se encuentra el valor de enumeración de la Action propiedad en el FragmentState devuelto por la State propiedad de cada uno TextFragment instancia es Speak, la implementaciónIf the TtsEngineAction enumeration value by found from the Action property on the FragmentState returned by the State property of each TextFragment instance is Speak, the implementation

    • Americanism a Britishisms se traduce en el texto que se hablará.Translates Americanism to Britishisms in the text to be spoken.

    • Si el EventInterest propiedad en el EventInterest interfaces proporcionadas con el soporte técnico de implementación el TtsEventId tipo de evento, se crea un evento para controlar un indicador de progreso de sintetizador.If the EventInterest property on the EventInterest interfaces provided to the implementation support the TtsEventId event type, an event to drive a synthesizer progress meter is created.

  3. A continuación, se llama a un motor de representación de voz con modificado TextFragment matriz.A speech rendering engine is then called with the modified TextFragment array.

private const int WordBoundaryFlag = 1 << (int)TtsEventId.WordBoundary;  
private readonly char[] spaces = new char[] { ' ', '\t', '\r', '\n' };  
internal struct UsVsUk  
{  
  internal string UK;  
  internal string US;  
}  

override public void Speak (TextFragment [] frags, IntPtr wfx, ITtsEngineSite site)  
{  
  TextFragment [] newFrags=new TextFragment[frags.Length];  

  for (int i=0;i<frags.Length;i++){  
    newFrags[i].State=frags[i].State;  
    //truncate  
    newFrags[i].TextToSpeak = frags[i].TextToSpeak.Substring(frags[i].TextOffset,  
                               frags[i].TextLength);  
    newFrags[i].TextLength = newFrags[i].TextToSpeak.Length;  
    newFrags[i].TextOffset = 0;  
    if (newFrags[i].State.Action == TtsEngineAction.Speak) {  
      //Us to UK conversion  
      foreach (UsVsUk term in TransList) {  
      newFrags[i].TextToSpeak.Replace(term.US, term.UK);  
      }  
      //Generate progress meter events if supported  
      if ((site.EventInterest & WordBoundaryFlag) != 0) {  
      string[] subs = newFrags[i].TextToSpeak.Split(spaces);  

      foreach (string s in subs) {  
        int offset = newFrags[i].TextOffset;  
        SpeechEventInfo spEvent = new SpeechEventInfo((Int16)TtsEventId.WordBoundary,   
                (Int16)EventParameterType.Undefined,   
                 s.Length, new IntPtr(offset));  
        offset += s.Length;  
        if (s.Trim().Length > 0) {  
          SpeechEventInfo[] events = new SpeechEventInfo[1];  
          events[0] = spEvent;  
          site.AddEvents(events, 1);  
        }  
      }  
      }  
    }  
  }  

  _baseSynthesize.Speak(newFrags, wfx, site);  

}  

Comentarios

TtsEngineAction representa las solicitudes para el mantenimiento de un TextFragment.TtsEngineAction represents requests for servicing a TextFragment. Las acciones estrechamente corresponden a los elementos de la especificación de SSML y se implementan en el texto devuelto por la TextToSpeak propiedad en un TextFragment.The actions correspond closely to elements in the SSML specification and are implemented on the text returned by the TextToSpeak property on a TextFragment.

El TtsEngineAction valor asociado con un TextFragment devuelto por la State propiedad.The TtsEngineAction value associated with a TextFragment is returned by the State property.

Procesamiento de la TtsEngineAction valor devuelto por la State propiedad se controla mediante una voz sintetiza la implementación de la Speak método en una clase derivada de TtsEngineSsml.Processing of the TtsEngineAction value returned by the State property is handled by a speech synthesizes implementation of the Speak method on a class derived from TtsEngineSsml.

Se aplica a