SpeechEventInfo.Param1 SpeechEventInfo.Param1 SpeechEventInfo.Param1 SpeechEventInfo.Param1 Property

Definição

Obtém e define o valor de integer (param1 no construtor) a ser passado para a plataforma de fala para gerar um evento que a instância de SpeechEventInfo atual é usada para solicitar.Gets and set the integer value (param1 in the constructor) to be passed to the Speech platform to generate an event the current instance of SpeechEventInfo is used to request.

public:
 property int Param1 { int get(); };
public int Param1 { get; }
member this.Param1 : int
Public ReadOnly Property Param1 As Integer

Valor da propriedade

Retorna o integer a ser passado para a plataforma de fala quando o evento especificado pela instância atual SpeechEventInfo do for gerado.Returns the integer to be passed to Speech platform when the event specified by the current instance of SpeechEventInfo is generated.

Exemplos

O exemplo a seguir faz parte de uma implementação de síntese de fala personalizada TtsEngineSsmlque herda de e usando o TextFragmentuso SpeechEventInfode FragmentState,, eTtsEventIdThe example below is part of a custom speech synthesis implementation inheriting from TtsEngineSsml, and using the use of TextFragment, SpeechEventInfo, FragmentState, and TtsEventId

A implementação deSpeakThe implementation of Speak

  1. Recebe uma matriz de TextFragment instâncias e cria uma nova matriz de TextFragment instâncias a ser passada para o Speak método em um mecanismo de síntese subjacente.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. Se o TtsEngineAction valor de enumeração encontrado Action na propriedade State no FragmentState retornado pela propriedade de cada TextFragment instância for Speak, a implementaçãoIf 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

    • Traduz o American Britishisms no texto a ser falado.Translates Americanism to Britishisms in the text to be spoken.

    • Se a EventInterest ITtsEngineSite Propriedade nas interfaces fornecidas para a implementação oferecer suporte ao WordBoundary tipo de evento, SpeechEventInfo uma instância será usada para criar um evento para gerar um medidor de progresso do sintetizador criado.If the EventInterest property on the ITtsEngineSite interfaces provided to the implementation support the WordBoundary event type, a SpeechEventInfo instance is used to create an event to drive a synthesizer progress meter is created.

      Os parâmetros on SpeechEventInfo, incluindo Param1 são usados para registrar o evento gerado por meio LogSpeechEvent do método.The parameters on SpeechEventInfo, including Param1 are used to log the event generated through the LogSpeechEvent method.

  3. Um mecanismo de renderização de fala é chamado com a TextFragment matriz modificada.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));  
         LogSpeechEvent(spEvent.EventId,   
                        spEvent.ParameterType,   
                        spEvent.Param1,  
                        spEvent.Param2);  
        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);  

}  

Comentários

Os requisitos e o significado Param1 da propriedade SpeechEventInfo de são determinados exclusivamente EventId pelos valores SpeechEventInfo das propriedades e ParameterType .The requirements and meaning of Param1 property of SpeechEventInfo are uniquely determined by the values of the EventId and ParameterType properties the SpeechEventInfo instance.

Para obter informações detalhadas sobre como Param1usar o, consulte EventIda documentação do.For detailed information on how use Param1, see documentation for EventId.

Aplica-se a