/// <summary> /// Initializes a new instance of the <see cref="SystemSpeechSynthesizer"/> class. /// </summary> /// <param name="pipeline">The pipeline to add the component to.</param> /// <param name="configuration">The component configuration.</param> public SystemSpeechSynthesizer(Pipeline pipeline, SystemSpeechSynthesizerConfiguration configuration) : base(pipeline) { this.pipeline = pipeline; // Create the emitters for the various events this.BookmarkReached = pipeline.CreateEmitter <BookmarkReachedEventData>(this, nameof(this.BookmarkReached)); this.PhonemeReached = pipeline.CreateEmitter <PhonemeReachedEventData>(this, nameof(this.PhonemeReached)); this.SpeakCompleted = pipeline.CreateEmitter <SpeakCompletedEventData>(this, nameof(this.SpeakCompleted)); this.SpeakProgress = pipeline.CreateEmitter <SpeakProgressEventData>(this, nameof(this.SpeakProgress)); this.SpeakStarted = pipeline.CreateEmitter <SpeakStartedEventData>(this, nameof(this.SpeakStarted)); this.StateChanged = pipeline.CreateEmitter <StateChangedEventData>(this, nameof(this.StateChanged)); this.VisemeReached = pipeline.CreateEmitter <VisemeReachedEventData>(this, nameof(this.VisemeReached)); // save the configuration this.configuration = configuration; // create the speech synthesizer this.speechSynthesizer = this.CreateSpeechSynthesizer(); }
/// <summary> /// Initializes a new instance of the <see cref="SystemSpeechSynthesizer"/> class. /// </summary> /// <param name="pipeline">The pipeline to add the component to.</param> /// <param name="configuration">The component configuration.</param> /// <param name="name">An optional name for the component.</param> public SystemSpeechSynthesizer(Pipeline pipeline, SystemSpeechSynthesizerConfiguration configuration, string name = nameof(SystemSpeechSynthesizer)) : base(pipeline, name) { this.pipeline = pipeline; // Create additional receivers this.SpeakSsml = pipeline.CreateReceiver <string>(this, this.ReceiveSpeakSsml, nameof(this.SpeakSsml)); this.CancelAll = pipeline.CreateReceiver <bool>(this, this.ReceiveCancelAll, nameof(this.CancelAll)); // Create the emitters for the various events this.BookmarkReached = pipeline.CreateEmitter <BookmarkReachedEventData>(this, nameof(this.BookmarkReached)); this.PhonemeReached = pipeline.CreateEmitter <PhonemeReachedEventData>(this, nameof(this.PhonemeReached)); this.SpeakCompleted = pipeline.CreateEmitter <SpeakCompletedEventData>(this, nameof(this.SpeakCompleted)); this.SpeakProgress = pipeline.CreateEmitter <SpeakProgressEventData>(this, nameof(this.SpeakProgress)); this.SpeakStarted = pipeline.CreateEmitter <SpeakStartedEventData>(this, nameof(this.SpeakStarted)); this.StateChanged = pipeline.CreateEmitter <StateChangedEventData>(this, nameof(this.StateChanged)); this.VisemeReached = pipeline.CreateEmitter <VisemeReachedEventData>(this, nameof(this.VisemeReached)); // save the configuration this.configuration = configuration; // create the speech synthesizer this.speechSynthesizer = this.CreateSpeechSynthesizer(); }