コード例 #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);
 }
コード例 #5
0
        public override void DidFinishSpeaking(NSSpeechSynthesizer sender, bool finishedSpeaking)
        {
            EventHandler handler = DidComplete;

            if (null != handler)
            {
                handler(this, EventArgs.Empty);
            }
        }
コード例 #6
0
 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;
 }
コード例 #7
0
 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
ファイル: MacSynth.cs プロジェクト: CasperTech/radegast
            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
ファイル: TextToSpeech.macos.cs プロジェクト: sung-su/maui
 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
ファイル: MacSynth.cs プロジェクト: Booser/radegast
 public void SpeechStart( )
 {
     syn = new NSSpeechSynthesizer();
 }
コード例 #15
0
ファイル: TextToSpeech.macos.cs プロジェクト: sung-su/maui
 public override void DidFinishSpeaking(NSSpeechSynthesizer sender, bool finishedSpeaking) =>
 FinishedSpeaking?.Invoke(finishedSpeaking);
コード例 #16
0
 public void SpeechSynthesizerWillSpeakPhoneme(NSSpeechSynthesizer sender, short phonemeOpcode)
 {
     this._characterView.SetExpressionForPhoneme(NSNumber.NumberWithShort(phonemeOpcode));
 }
コード例 #17
0
ファイル: TextToSpeech.macos.cs プロジェクト: sung-su/maui
 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())));
コード例 #18
0
        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
ファイル: MacSynth.cs プロジェクト: CasperTech/radegast
 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;
 }