示例#1
0
 public void DidFinishSpeaking(NSSpeechSynthesizer sender, bool finishedSpeaking)
 {
     btnStop.Enabled         = false;
     btnSpeak.Enabled        = true;
     voicesTableView.Enabled = true;
     textField.Enabled       = true;
 }
示例#2
0
 /// <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);
     }
 }
示例#3
0
        partial void HelloPress(NSObject sender)
        {
            labelInfo.StringValue = "Hello world!";

            NSSpeechSynthesizer synth = new NSSpeechSynthesizer();

            synth.StartSpeakingString("Hello world!");
        }
示例#4
0
 /// <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();
 }
示例#8
0
        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);
        }
示例#9
0
            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;
                }
            }
示例#10
0
 public override void DidEncounterError(NSSpeechSynthesizer sender, nuint characterIndex, string theString, string message) =>
 EncounteredError?.Invoke(message);
示例#11
0
 public override void DidEncounterError(NSSpeechSynthesizer sender, uint characterIndex, string theString, string message)
 {
     logger.Warn(message);
 }
示例#12
0
 // Shared initialization code
 void Initialize()
 {
     mSpeechSynth = new NSSpeechSynthesizer();
     mVoices = NSSpeechSynthesizer.AvailableVoices;
 }
示例#13
0
 // Shared initialization code
 void Initialize()
 {
     mSpeechSynth = new NSSpeechSynthesizer();
     mVoices      = NSSpeechSynthesizer.AvailableVoices;
 }
示例#14
0
 public void SpeechStart( )
 {
     syn = new NSSpeechSynthesizer();
 }
示例#15
0
 public override void DidFinishSpeaking(NSSpeechSynthesizer sender, bool finishedSpeaking) =>
 FinishedSpeaking?.Invoke(finishedSpeaking);
 public void SpeechSynthesizerWillSpeakPhoneme(NSSpeechSynthesizer sender, short phonemeOpcode)
 {
     this._characterView.SetExpressionForPhoneme(NSNumber.NumberWithShort(phonemeOpcode));
 }
示例#17
0
 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();
        }
示例#19
0
 public void SpeechStart( )
 {
     syn = new NSSpeechSynthesizer();
 }
示例#20
0
 public void DidFinishSpeaking(NSSpeechSynthesizer sender, bool finishedSpeaking)
 {
     btnStop.Enabled = false;
     btnSpeak.Enabled = true;
     voicesTableView.Enabled = true;
     textField.Enabled = true;
 }