public void DidFinishSpeaking(NSSpeechSynthesizer sender, bool finishedSpeaking) { btnStop.Enabled = false; btnSpeak.Enabled = true; voicesTableView.Enabled = true; textField.Enabled = true; }
/// <summary> /// Invoke method when finished speaking. /// </summary> /// <param name="sender"></param> /// <param name="finishedSpeaking"></param> public override void DidFinishSpeaking(NSSpeechSynthesizer sender, bool finishedSpeaking) { if (finishedSpeaking) { FinishedSpeaking?.Invoke(this, EventArgs.Empty); } }
partial void HelloPress(NSObject sender) { labelInfo.StringValue = "Hello world!"; NSSpeechSynthesizer synth = new NSSpeechSynthesizer(); synth.StartSpeakingString("Hello world!"); }
/// <summary> /// Constructor for text to speech /// </summary> public TextToSpeech() { sdelegate = new TtsSpeechSynthesizerDelegate(); speechSynthesizer = new NSSpeechSynthesizer { Delegate = sdelegate }; semaphore = new SemaphoreSlim(1, 1); }
public override void DidFinishSpeaking(NSSpeechSynthesizer sender, bool finishedSpeaking) { EventHandler handler = DidComplete; if (null != handler) { handler(this, EventArgs.Empty); } }
public void SpeechSynthesizerDidFinishSpeaking(NSSpeechSynthesizer sender, bool finishedSpeaking) { this._textToSpeechExampleTextView.SelectedRange = this._orgSelectionRange; // Set selection length to zero. this._textToSpeechExampleSpeakButton.Title = FoundationFramework.NSLocalizedString("Start Speaking", "Speaking button name (start)"); this._saveButton.Title = FoundationFramework.NSLocalizedString("Save As File...", "Save button title"); this._textToSpeechExampleSpeakButton.IsEnabled = true; this._saveButton.IsEnabled = true; this._voicePop.IsEnabled = true; }
public void AwakeFromNib() { this._speechSynthesizer = new NSSpeechSynthesizer(); this._speechSynthesizer.SetDelegate(d => { d.SpeechSynthesizerWillSpeakPhoneme += this.SpeechSynthesizerWillSpeakPhoneme; d.SpeechSynthesizerDidFinishSpeaking += this.SpeechSynthesizerDidFinishSpeaking; d.SpeechSynthesizerWillSpeakWordOfString += this.SpeechSynthesizerWillSpeakWordOfString; }); this._characterView.SetExpression(SpeakingCharacterView.kCharacterExpressionIdentifierIdle); this.GetSpeechVoices(); }
public NSObject GetObjectValue(NSTableView tableView, NSTableColumn tableColumn, int row) { NSDictionary dict = NSSpeechSynthesizer.AttributesForVoice(mVoices[row]); // See all of the keys and Value types // var keys = dict.Keys; // var values = dict.Values; // for (int i = 0; i < dict.Count; i++) { // if (keys[i].ToString() != "VoiceIndividuallySpokenCharacters" && keys[i].ToString() != "VoiceSupportedCharacters") // Console.WriteLine("Key {0} = {1}, Value = {2}", i, keys[i], values[i].GetType()); // } var name = dict.ObjectForKey(new NSString("VoiceName")); var age = dict.ObjectForKey(new NSString("VoiceAge")); var lang = dict.ObjectForKey(new NSString("VoiceLanguage")); NSString full = new NSString(String.Format("{0}, Age {1}, Language {2}", name, age, lang)); return(full); }
internal MacAvailableVoice(string name) { Name = name; // Ask OSX for properties of this voice NSDictionary props = NSSpeechSynthesizer.AttributesForVoice(name); NSString gender = (NSString)props.ValueForKey(NSSpeechSynthesizer.NSVoiceGender); // TODO Deal with neuter voices // TODO Deal with multiple languages. if (gender == NSSpeechSynthesizer.NSVoiceGenderMale) { Male = true; } else { Male = false; } }
public override void DidEncounterError(NSSpeechSynthesizer sender, nuint characterIndex, string theString, string message) => EncounteredError?.Invoke(message);
public override void DidEncounterError(NSSpeechSynthesizer sender, uint characterIndex, string theString, string message) { logger.Warn(message); }
// Shared initialization code void Initialize() { mSpeechSynth = new NSSpeechSynthesizer(); mVoices = NSSpeechSynthesizer.AvailableVoices; }
public void SpeechStart( ) { syn = new NSSpeechSynthesizer(); }
public override void DidFinishSpeaking(NSSpeechSynthesizer sender, bool finishedSpeaking) => FinishedSpeaking?.Invoke(finishedSpeaking);
public void SpeechSynthesizerWillSpeakPhoneme(NSSpeechSynthesizer sender, short phonemeOpcode) { this._characterView.SetExpressionForPhoneme(NSNumber.NumberWithShort(phonemeOpcode)); }
Task <IEnumerable <Locale> > PlatformGetLocalesAsync() => Task.FromResult(NSSpeechSynthesizer.AvailableVoices .Select(voice => NSSpeechSynthesizer.AttributesForVoice(voice)) .Select(attribute => new Locale(attribute["VoiceLanguage"]?.ToString(), null, attribute["VoiceName"]?.ToString(), attribute["VoiceIdentifier"]?.ToString())));
public void SpeechSynthesizerWillSpeakWordOfString(NSSpeechSynthesizer sender, NSRange characterRange, NSString str) { UInt32 selectionPosition = characterRange.location + this._offsetToSpokenText; UInt32 wordLength = characterRange.length; this._textToSpeechExampleTextView.ScrollRangeToVisible(NSRange.NSMakeRange(selectionPosition, wordLength)); this._textToSpeechExampleTextView.SelectedRange = NSRange.NSMakeRange(selectionPosition, wordLength); this._textToSpeechExampleTextView.Display(); }