public void TestTabSelect() { FormsTabControl tabControl = new FormsTabControl(testDlg["tabControl"]()); tabControl.EmulateTabSelect(1); Assert.AreEqual(1, tabControl.SelectedIndex); //非同期 app[GetType(), "TabSelectEvent"](tabControl.AppVar); tabControl.EmulateTabSelect(2, new Async()); new NativeMessageBox(testDlg.WaitForNextModal()).EmulateButtonClick("OK"); Assert.AreEqual(2, tabControl.SelectedIndex); }
public void TestSelectedIndex() { FormsTabControl tabControl = new FormsTabControl(testDlg["tabControl"]()); tabControl.EmulateTabSelect(2); Assert.AreEqual(2, tabControl.SelectedIndex); }
/// <summary> /// 指定話者で指定テキストで発声 /// </summary> /// <param name="cid">話者CID</param> /// <param name="talkText">発声させるテキスト</param> /// <returns>発声にかかった時間(ミリ秒)</returns> public double Play(Val_Talker talker, string talkText) { Stopwatch stopWatch = new Stopwatch(); int avatorIdx = ConvertNametoIndex(talker); AvatorParam_VREX avator = AvatorParams[avatorIdx] as AvatorParam_VREX; // avator.Semaphore.Wait(); if (avator.AvatorUI.PlayButton == null) { return(0.0); } if (avator.AvatorUI.SaveButton == null) { return(0.0); } if (avator.AvatorUI.TalkTextBox == null) { return(0.0); } dynamic VoiceroidExUiTab = new FormsTabControl(avator.AvatorUI.uiTreeTop.IdentifyFromZIndex(2, 0, 0, 0, 0)); VoiceroidExUiTab.EmulateTabSelect(2); // ApplyEffectParameters(avatorIdx); // ApplyEmotionParameters(avatorIdx); ApplyEffectParameters(talker, apply_interface[talker.talkerRealName]); // 再生中なので再生終了を待つ(音声保存ボタンがEnableになるのを待つ) if (!avator.AvatorUI.SaveButton.Enabled) { while (!avator.AvatorUI.SaveButton.Enabled) { Thread.Sleep(10); } } avator.AvatorUI.TalkTextBox["Text"](talkText); Thread.Sleep(10); stopWatch.Start(); avator.AvatorUI.PlayButton.EmulateClick(); // 再生開始を待つ(音声保存ボタンがDisableになるのを待つ) if (avator.AvatorUI.SaveButton.Enabled) { while (avator.AvatorUI.SaveButton.Enabled) { Thread.Sleep(10); } } // ResetParameters(talker, apply_interface[talker.talkerRealName], apply_interface_emotion[talker.talkerRealName]); // 再生終了を待つ(音声保存ボタンがEnableになるのを待つ) if (!avator.AvatorUI.SaveButton.Enabled) { while (!avator.AvatorUI.SaveButton.Enabled) { Thread.Sleep(10); } } ResetParameters(talker, apply_interface[talker.talkerRealName]); stopWatch.Stop(); // avator.Semaphore.Release(); return(stopWatch.ElapsedMilliseconds); }
public int ScanTalker(ArrayList talkerlist, System.Windows.Forms.TextBox log) { IsAlive = false; foreach (AvatorParam_VREX avator in GetVoiceroidProcess()) { AvatorParams.Add(avator.AvatorIndex, avator); gyakubiki.Add(avator.AvatorName, avator.AvatorIndex); avator.AvatorUI = new AvatorUIParam_VREX(); var talker = new TalkerPrimitive(); try { avator.AvatorUI._app = avator.AvatorProcess; avator.AvatorUI.uiTreeTop = WindowControl.FromZTop(avator.AvatorUI._app); // Zインデクスはコーディア様の TestAssistantで確認可能。音声効果タブへ切り替えてUI要素を取得する。 dynamic VoiceroidExUiTab = new FormsTabControl(avator.AvatorUI.uiTreeTop.IdentifyFromZIndex(2, 0, 0, 0, 0)); VoiceroidExUiTab.EmulateTabSelect(2); avator.AvatorUI.TalkTextBox = avator.AvatorUI.uiTreeTop.IdentifyFromZIndex(2, 0, 0, 1, 0, 1, 1); avator.AvatorUI.PlayButton = new FormsButton(avator.AvatorUI.uiTreeTop.IdentifyFromZIndex(2, 0, 0, 1, 0, 1, 0, 3)); avator.AvatorUI.SaveButton = new FormsButton(avator.AvatorUI.uiTreeTop.IdentifyFromZIndex(2, 0, 0, 1, 0, 1, 0, 1)); avator.AvatorUI.VolumeText = new FormsTextBox(avator.AvatorUI.uiTreeTop.IdentifyFromZIndex(2, 0, 0, 0, 0, 0, 0, 8)); avator.AvatorUI.SpeedText = new FormsTextBox(avator.AvatorUI.uiTreeTop.IdentifyFromZIndex(2, 0, 0, 0, 0, 0, 0, 9)); avator.AvatorUI.PitchText = new FormsTextBox(avator.AvatorUI.uiTreeTop.IdentifyFromZIndex(2, 0, 0, 0, 0, 0, 0, 10)); avator.AvatorUI.IntonationText = new FormsTextBox(avator.AvatorUI.uiTreeTop.IdentifyFromZIndex(2, 0, 0, 0, 0, 0, 0, 11)); } catch (Exception e) { // ThrowException(string.Format(@"{0} {1}", e.Message, e.StackTrace)); MessageBox.Show(string.Format(@"{0} {1}", e.Message, e.StackTrace)); } avator.VoiceEffects_default = new Dictionary <EnumVoiceEffect, EffectValueInfo> { { EnumVoiceEffect.volume, new EffectValueInfo(GetSliderValue(avator.AvatorIndex, EnumVoiceEffect.volume), 0.0m, 2.0m, 0.01m) }, { EnumVoiceEffect.speed, new EffectValueInfo(GetSliderValue(avator.AvatorIndex, EnumVoiceEffect.speed), 0.5m, 4.0m, 0.01m) }, { EnumVoiceEffect.pitch, new EffectValueInfo(GetSliderValue(avator.AvatorIndex, EnumVoiceEffect.pitch), 0.5m, 2.0m, 0.01m) }, { EnumVoiceEffect.intonation, new EffectValueInfo(GetSliderValue(avator.AvatorIndex, EnumVoiceEffect.intonation), 0.0m, 2.0m, 0.01m) } }; avator.VoiceEffects = new Dictionary <EnumVoiceEffect, EffectValueInfo> { { EnumVoiceEffect.volume, new EffectValueInfo(GetSliderValue(avator.AvatorIndex, EnumVoiceEffect.volume), 0.0m, 2.0m, 0.01m) }, { EnumVoiceEffect.speed, new EffectValueInfo(GetSliderValue(avator.AvatorIndex, EnumVoiceEffect.speed), 0.5m, 4.0m, 0.01m) }, { EnumVoiceEffect.pitch, new EffectValueInfo(GetSliderValue(avator.AvatorIndex, EnumVoiceEffect.pitch), 0.5m, 2.0m, 0.01m) }, { EnumVoiceEffect.intonation, new EffectValueInfo(GetSliderValue(avator.AvatorIndex, EnumVoiceEffect.intonation), 0.0m, 2.0m, 0.01m) } }; avator.VoiceEmotions_default = new Dictionary <string, EffectValueInfo>(); avator.VoiceEmotions = new Dictionary <string, EffectValueInfo>(); apply_interface.Add(avator.AvatorName, new Dictionary <string, WPFSlider>()); talker.effectList.Add("音量"); talker.VoiceEffects.Add("音量", new EffectValueInfo(GetSliderValue(avator.AvatorIndex, EnumVoiceEffect.volume), 0.0m, 2.0m, 0.01m)); apply_interface[avator.AvatorName].Add("音量", avator.AvatorUI.VolumeSlider); talker.effectList.Add("話速"); talker.VoiceEffects.Add("話速", new EffectValueInfo(GetSliderValue(avator.AvatorIndex, EnumVoiceEffect.speed), 0.5m, 4.0m, 0.01m)); apply_interface[avator.AvatorName].Add("話速", avator.AvatorUI.VolumeSlider); talker.effectList.Add("高さ"); talker.VoiceEffects.Add("高さ", new EffectValueInfo(GetSliderValue(avator.AvatorIndex, EnumVoiceEffect.pitch), 0.5m, 2.0m, 0.01m)); apply_interface[avator.AvatorName].Add("高さ", avator.AvatorUI.VolumeSlider); talker.effectList.Add("抑揚"); talker.VoiceEffects.Add("抑揚", new EffectValueInfo(GetSliderValue(avator.AvatorIndex, EnumVoiceEffect.intonation), 0.0m, 2.0m, 0.01m)); apply_interface[avator.AvatorName].Add("抑揚", avator.AvatorUI.VolumeSlider); // 話者一覧に追加 // var talker = new TalkerPrimitive(); var prefix_str = "VOICEROID+EX "; talker.talkerName = prefix_str + avator.AvatorName; talker.originalName = avator.AvatorName; talker.typeTalker = 5; log.Text += talker.talkerName; log.Text += " "; talkerDefaultParamList.Add(talker.originalName, talker); talkerlist.Add(talker); } IsAlive = AvatorParams.Count != 0; return(0); }