SpeechEventInfo Estrutura
Definição
Usado para especificar o tipo de evento e seus argumentos (se houver) a serem gerados como parte da renderização de texto em fala por um mecanismo de conversão de texto em fala sintética personalizado.Used to specify the type of event, and its arguments (if any) to be generated as part of the rendering of text to speech by a custom synthetic speech engine.
public value class SpeechEventInfo : IEquatable<System::Speech::Synthesis::TtsEngine::SpeechEventInfo>
public struct SpeechEventInfo : IEquatable<System.Speech.Synthesis.TtsEngine.SpeechEventInfo>
type SpeechEventInfo = struct
Public Structure SpeechEventInfo
Implements IEquatable(Of SpeechEventInfo)
- Herança
- Implementações
Exemplos
O exemplo a seguir faz parte de uma implementação de síntese de fala personalizada que herda de TtsEngineSsml e usando o uso de TextFragment , SpeechEventInfo , FragmentState e TtsEventIdThe 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 de SpeakThe implementation of Speak
Recebe uma matriz de TextFragment instâncias e cria uma nova matriz de TextFragment instâncias a ser passada para o
Speakmé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 theSpeakmethod on an underlying synthesis engine.Se o TtsEngineAction valor de enumeração encontrado na Action propriedade no FragmentState retornado pela State 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 Propriedade nas ITtsEngineSite interfaces fornecidas para a implementação oferecer suporte ao WordBoundary tipo de evento, uma SpeechEventInfo 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.
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));
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
Um mecanismo de síntese de fala personalizado solicita a geração de eventos na plataforma de fala fornecendo uma SpeechEventInfo instância apropriada para AddEvents membro do ITtsEngineSite objeto de site do mecanismo passado para implementações do Speak , AddLexicon e RemoveLexicon .A custom speech synthesis engine requests the generation of events under the Speech Platform by providing an appropriate SpeechEventInfo instance to AddEvents member of the ITtsEngineSite engine site object passed to implementations of Speak, AddLexicon, and RemoveLexicon.
Construtores
| SpeechEventInfo(Int16, Int16, Int32, IntPtr) |
Constrói um SpeechEventInfo apropriado.Constructs an appropriate SpeechEventInfo. |
Propriedades
| EventId |
Obtém e define o evento da plataforma de fala que uma instância de SpeechEventInfo é usada para solicitar.Gets and set the Speech platform event which an instance of SpeechEventInfo is used to request. |
| Param1 |
Obtém e define o valor de |
| Param2 |
Obtém e define a instância de |
| ParameterType |
Retorna o tipo de dados do objeto apontado pelo IntPtr retornado pelo parâmetro Param2 no objeto SpeechEventInfo atual.Returns the data type of the object pointed to by the IntPtr returned by the Param2 parameter on the current SpeechEventInfo object. |
Métodos
| Equals(Object) |
Determina se um objeto especificado é uma instância de |
| Equals(SpeechEventInfo) |
Determina se um objeto |
| GetHashCode() |
Fornece um código hash para um objeto |
Operadores
| Equality(SpeechEventInfo, SpeechEventInfo) |
Determina se duas instâncias de |
| Inequality(SpeechEventInfo, SpeechEventInfo) |
Determina se duas instâncias de |