BookmarkReachedEventArgs BookmarkReachedEventArgs BookmarkReachedEventArgs BookmarkReachedEventArgs Class

Definición

Devuelve datos del evento BookmarkReached.Returns data from the BookmarkReached event.

public ref class BookmarkReachedEventArgs : System::Speech::Synthesis::PromptEventArgs
public class BookmarkReachedEventArgs : System.Speech.Synthesis.PromptEventArgs
type BookmarkReachedEventArgs = class
    inherit PromptEventArgs
Public Class BookmarkReachedEventArgs
Inherits PromptEventArgs
Herencia

Ejemplos

El ejemplo siguiente crea un símbolo del sistema que incluye dos marcadores y envía el resultado a un archivo WAV para su reproducción.The following example creates a prompt that includes two bookmarks and sends the output to a WAV file for playback. El controlador para el BookmarkReached eventos escribe el nombre del marcador y su posición en la secuencia de audio cuando se generó el evento en la consola.The handler for the BookmarkReached event writes the name of the bookmark and its position in the audio stream when the event was raised to the console.

using System;  
using System.Speech.Synthesis;  

namespace SampleSynthesis  
{  
  class Program  
  {  
    static void Main(string[] args)  
    {  

      // Initialize a new instance of the SpeechSynthesizer.  
      using (SpeechSynthesizer synth = new SpeechSynthesizer())  
      {  

        // Configure the audio output.   
        synth.SetOutputToWaveFile(@"C:\test\weather.wav");  

        // Create a SoundPlayer instance to play the output audio file.  
        System.Media.SoundPlayer m_SoundPlayer =  
          new System.Media.SoundPlayer(@"C:\test\weather.wav");  

        // Build a prompt and append bookmarks.  
        PromptBuilder builder = new PromptBuilder(  
          new System.Globalization.CultureInfo("en-US"));  
        builder.AppendText(  
          "The weather forecast for today is partly cloudy with some sun breaks.");  
        builder.AppendBookmark("Daytime forecast");  
        builder.AppendText(  
          "Tonight's weather will be cloudy with a 30% chance of showers.");  
        builder.AppendBookmark("Nighttime forecast");  

        // Add a handler for the BookmarkReached event.  
        synth.BookmarkReached +=  
          new EventHandler<BookmarkReachedEventArgs>(synth_BookmarkReached);  

        // Speak the prompt and play back the output file.  
        synth.Speak(builder);  
        m_SoundPlayer.Play();  
      }  

      Console.WriteLine();  
      Console.WriteLine("Press any key to exit...");  
      Console.ReadKey();  
    }  

    // Write the name and position of the bookmark to the console.  
    static void synth_BookmarkReached(object sender, BookmarkReachedEventArgs e)  
    {  
      Console.WriteLine("Bookmark ({0}) reached at: {1} ",  
        e.Bookmark, e.AudioPosition);  
    }  
  }  
}  

Comentarios

Una instancia de BookmarkReachedEventArgs se crea cuando el SpeechSynthesizer objeto genera el BookmarkReached eventos.An instance of BookmarkReachedEventArgs is created when the SpeechSynthesizer object raises the BookmarkReached event. El SpeechSynthesizer provoca la BookmarkReached eventos cuando encuentra un marcador al procesar cualquiera de los Speak, SpeakAsync, SpeakSsml, o SpeakSsmlAsync métodos.The SpeechSynthesizer raises the BookmarkReached event when it encounters a bookmark while processing any of the Speak, SpeakAsync, SpeakSsml, or SpeakSsmlAsync methods. Para obtener el nombre y la ubicación del marcador que desencadenó el evento, tener acceso a la Bookmark y AudioPosition propiedades en el controlador para el evento.To obtain the name and location of the bookmark that triggered the event, access the Bookmark and the AudioPosition properties in the handler for the event.

Propiedades

AudioPosition AudioPosition AudioPosition AudioPosition

Obtiene el desplazamiento de tiempo en el que se alcanzó el marcador.Gets the time offset at which the bookmark was reached.

Bookmark Bookmark Bookmark Bookmark

Obtiene el nombre del marcador que se alcanzó.Gets the name of the bookmark that was reached.

Cancelled Cancelled Cancelled Cancelled

Obtiene un valor que indica si se ha cancelado una operación asincrónica.Gets a value indicating whether an asynchronous operation has been canceled.

(Inherited from AsyncCompletedEventArgs)
Error Error Error Error

Obtiene un valor que indica el error que se produjo durante una operación asincrónica.Gets a value indicating which error occurred during an asynchronous operation.

(Inherited from AsyncCompletedEventArgs)
Prompt Prompt Prompt Prompt

Obtiene la petición asociada al evento.Gets the prompt associated with the event.

(Inherited from PromptEventArgs)
UserState UserState UserState UserState

Obtiene el identificador único de la tarea asincrónica.Gets the unique identifier for the asynchronous task.

(Inherited from AsyncCompletedEventArgs)

Métodos

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Determina si el objeto especificado es igual al objeto actual.Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Sirve como la función hash predeterminada.Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

Obtiene el Type de la instancia actual.Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Crea una copia superficial del objeto Object actual.Creates a shallow copy of the current Object.

(Inherited from Object)
RaiseExceptionIfNecessary() RaiseExceptionIfNecessary() RaiseExceptionIfNecessary() RaiseExceptionIfNecessary()

Genera una excepción proporcionada por el usuario si se ha producido un error en una operación asincrónica.Raises a user-supplied exception if an asynchronous operation failed.

(Inherited from AsyncCompletedEventArgs)
ToString() ToString() ToString() ToString()

Devuelve una cadena que representa el objeto actual.Returns a string that represents the current object.

(Inherited from Object)

Se aplica a

Consulte también: