├── README.md ├── VoiceroidTClient ├── App.config ├── Program.cs ├── Properties │ └── AssemblyInfo.cs ├── VoiceroidTClient.csproj └── VoiceroidTClient.v12.suo ├── VoiceroidTServer ├── App.config ├── Program.cs ├── Properties │ └── AssemblyInfo.cs └── VoiceroidTServer.csproj └── VoiceroidTalker.sln /README.md: -------------------------------------------------------------------------------- 1 | # VoiceroidTalker 2 | 3 | ## VoiceroidTalkerについて 4 | 5 | VoiceroidTalkerはコマンドプロンプトの実行形式ファイルを介して、VOICEROIDへメッセージを送信し、音声再生を操作することができます。 6 | 同時に、VOICEROID+ EXシリーズ以降の音量、速度、高さ、抑揚のパラメータ調節を行うことができます。 7 | 8 | ##動作環境・必要なパッケージ等 9 | 10 | * Windows 7 11 | ※Windows8以降はUIコントロールの仕組みが変わっているので、まず動かないと思ってください。もしwindows8や10で動きましたら、動作報告をいただけると助かります。 12 | 13 | * .NET Framework 4.5 14 | ※ない場合は http://www.microsoft.com/ja-jp/download/details.aspx?id=30653 からダウンロードしてください。 15 | 16 | * 以下のいずれかのVOICEROIDのインストールが必要です。 17 | 18 | * VOICEROID+ 結月ゆかり EX 19 | * VOICEROID+ 民安ともえ EX 20 | * VOICEROID+ 東北ずん子 EX (テスト報告待ち) 21 | * VOICEROID+ 琴葉茜 (テスト報告待ち) 22 | * VOICEROID+ 琴葉葵 (テスト報告待ち) 23 | * VOICEROID+ 水奈瀬コウ EX (テスト報告待ち) 24 | 25 | また、VisualStudio 2013のプロジェクトを使用しているため、VisualStudio 2010などだと動作しない可能性があります。 26 | もしVisualStudio 2010でのプロジェクトがほしい方がおられましたら下記の連絡まで、お願いします。 27 | 28 | 29 | ##おことわり 30 | 31 | このアプリケーション、バッチなどを使用してPCに発生した不具合、故障などは一切保障しません。自己責任での実行をお願いします。 32 | 33 | また、GitHubではソースコードのアップロードのみになります。コンパイルしてお使いください。 34 | 35 | 36 | ##実行ファイルの使い方 37 | 1. コマンドプロンプトからbinフォルダに移動し、 38 | \>VoiceroidTServer.exe \[ボイスロイド名:Yukari, Maki, Zunko, Akane, Aoi, Koh\] 39 | (例: >VoiceroidTServer.exe Yukari) 40 | と実行します。 41 | 42 | 2. コマンドプロンプトからbinフォルダに移動し、 43 | \>VoiceroidTClient.exe \[ボイスロイド名:Yukari, Maki, Zunko, Akane, Aoi, Koh\] \[メッセージ部分\] 44 | (例:> VoiceroidTClient.exe Yukari こんにちは;1.0;1.2;1.0;2.0) 45 | と実行します。 46 | 47 | メッセージ部分は、 48 | \[メッセージ\];\[音量(0.0-2.0)\];\[話速(0.5-4.0)\];\[高さ(0.5-2.0)\];\[抑揚(0.0-2.0)\] 49 | という風に、セミコロンで分けます。メッセージ以降は省略可能です。 50 | 51 | 52 | ##ライセンスについて 53 | 54 | copyright (c) 2015 Tatsuro Matsubara 55 | Released under the MIT license 56 | http://opensource.org/licenses/mit-license.php 57 | 58 | ##その他、仕組みなど 59 | 60 | VoiceroidTServer.exeが実質的にVOICEROID.exeのGUIをコントロールしています。 61 | 62 | VoiceroidTServer.exeはそれぞれ別の名前のプロセス通信名を持たせられるので、他のVOICEROIDがあっても使用できます。ただ、同じVOICEROIDを同時起動させるのは無理です。 63 | 64 | VoiceroidTClient.exeは引数をつかって、VoiceroidTServer.exeにコントロールメッセージを送ってます。直接的に呼び出しているのではなく、プロセス間通信をクッションに使ってます。 65 | Unityでは.NETが2.0までしか対応していないため、プロセス間通信がかなり怪しく、こうせざるを得ませんでした。 66 | 67 | ずん子と琴葉姉妹はEXと同じ構造なのですが、自分が持っていないため、テストができておりません。動作報告をいただけると助かります。 68 | 69 | 他、質問などがありましたら、Twitterの @blkcatman までお願いします。 70 | 71 | -------------------------------------------------------------------------------- /VoiceroidTClient/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /VoiceroidTClient/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text; 3 | using System.IO; 4 | using System.IO.Pipes; 5 | 6 | namespace VoiceroidTClient 7 | { 8 | class Program 9 | { 10 | static void Main(string[] args) 11 | { 12 | string[] simpleNames = { "Yukari", "Maki", "Zunko", "Akane", "Aoi", "Koh" }; 13 | string[] simpleNamesA = { "yukari", "maki", "zunko", "akane", "aoi", "koh" }; 14 | 15 | //引数のチェック 16 | if (args.Length < 2) { 17 | string mergeName = ""; 18 | for (int i = 0; i < simpleNames.Length; i++) 19 | { 20 | mergeName = mergeName + simpleNames[i]; 21 | //ワード間に", "をつける 22 | if (i < simpleNames.Length - 1) 23 | mergeName = mergeName + ", "; 24 | } 25 | Console.WriteLine("引数を指定してください: VoiceroidTClient"+ mergeName +" [会話内容];[音量0.0-2.0];[話速0.5-4.0];[高さ0.5-2.0];[抑揚0.0-2.0]"); 26 | return; 27 | } 28 | //引数に設定されたボイスロイドの名前をチェック 29 | string selectedSimple = null; 30 | for (int i = 0; i < simpleNames.Length; i++) { 31 | if (args[0].CompareTo(simpleNames[i]) == 0 || args[0].CompareTo(simpleNamesA[i]) == 0) { 32 | selectedSimple = simpleNames[i]; 33 | } 34 | } 35 | if (selectedSimple == null) { 36 | string mergeName = ""; 37 | for (int i = 0; i < simpleNames.Length; i++) 38 | { 39 | mergeName = mergeName + simpleNames[i]; 40 | //ワード間に", "をつける 41 | if (i < simpleNames.Length - 1) 42 | mergeName = mergeName + ", "; 43 | } 44 | Console.WriteLine("第一引数に指定されたVOICEROIDの名前が正しくありません. 使用できる名前は次のとおりです: "+ mergeName); 45 | return; 46 | } 47 | //サーバーとの通信処理を開始 48 | string message = args[1]; 49 | try { 50 | //サーバーのセッションを取得する 51 | using (NamedPipeClientStream client = new NamedPipeClientStream("voiceroid_talker" + selectedSimple)) { 52 | client.Connect(1000); 53 | //サーバにーメッセージを送信する 54 | byte[] buffer = UnicodeEncoding.Unicode.GetBytes(message); 55 | client.Write(buffer, 0, buffer.Length); 56 | byte[] response = new byte[4]; 57 | client.Read(response, 0, response.Length); 58 | client.Close(); 59 | } 60 | } catch (Exception e) { 61 | //サーバーに接続できない時、通信エラーが発生した場合 62 | Console.WriteLine("VoiceroidTServerによるサーバー, [voiceroid_talker" + selectedSimple + "]が見つかりません."); 63 | } 64 | 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /VoiceroidTClient/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("VoiceroidTClient")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("VoiceroidTClient")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("d6cff63f-e7d2-4818-a1e5-7cfd7fab2824")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /VoiceroidTClient/VoiceroidTClient.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {BF944CFB-ACE3-4D6A-B397-EBECBEE7CBCA} 8 | Exe 9 | Properties 10 | VoiceroidTClient 11 | VoiceroidTClient 12 | v4.5 13 | 512 14 | 15 | 16 | AnyCPU 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | false 25 | 26 | 27 | AnyCPU 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | false 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 56 | -------------------------------------------------------------------------------- /VoiceroidTClient/VoiceroidTClient.v12.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blkcatman/VoiceroidTalker/8a0a98d29468aadab30882ebcfcaf23c85844614/VoiceroidTClient/VoiceroidTClient.v12.suo -------------------------------------------------------------------------------- /VoiceroidTServer/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /VoiceroidTServer/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Windows.Automation; 4 | using System.Threading; 5 | using System.Diagnostics; 6 | using System.Text; 7 | using System.Windows.Interop; 8 | 9 | using System.IO; 10 | using System.IO.Pipes; 11 | using System.Runtime.InteropServices; 12 | 13 | namespace VoiceroidTServer 14 | { 15 | class Program 16 | { 17 | //ハンドル操作用の関数 18 | [DllImport("user32.dll", SetLastError = true)] 19 | private static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string className, string lpszWindow); 20 | 21 | [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = false)] 22 | private static extern int SendMessage(IntPtr hWnd, uint msg, IntPtr wParam, string lParam); 23 | /* 24 | [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = false)] 25 | protected static extern int SendMessageStr(IntPtr hWnd, uint msg, IntPtr wParam, string lParam); 26 | */ 27 | [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = false)] 28 | protected static extern IntPtr PostMessage(IntPtr hWnd, uint Msg, IntPtr wParam, string lParam); 29 | 30 | [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = false)] 31 | protected static extern bool GetMessage(out MSG lpMsg, IntPtr hWnd, uint wMsgFilterMin, uint wMsgFilterMax); 32 | /* 33 | [DllImport("user32.dll")] 34 | static extern bool TranslateMessage([In] ref MSG lpMsg); 35 | [DllImport("user32.dll")] 36 | static extern IntPtr DispatchMessage([In] ref MSG lpmsg); 37 | */ 38 | //ハンドル操作用定数 39 | private const int WM_SETTEXT = 0x0c; 40 | private const int WM_KEYDOWN = 0x0100; 41 | //private const int WM_GETTEXTLENGTH = 0x0e; 42 | 43 | private const int WM_CLICK = 0xf5; 44 | private const int WM_NULL = 0x00; 45 | 46 | private const int VK_RETURN = 0x0D; 47 | 48 | //private const int ALLSELECT = 60; 49 | //private const int CUT = 52; 50 | 51 | static void Main(string[] args) 52 | { 53 | string[] simpleNames = { "Yukari", "Maki", "Zunko", "Akane", "Aoi", "Koh" }; 54 | string[] voiceroidNames = { 55 | "VOICEROID+ 結月ゆかり EX", 56 | "VOICEROID+ 民安ともえ EX", 57 | "VOICEROID+ 東北ずん子 EX", 58 | "VOICEROID+ 琴葉茜", 59 | "VOICEROID+ 琴葉葵", 60 | "VOICEROID+ 水奈瀬コウ EX" 61 | }; 62 | Console.WriteLine(""); 63 | 64 | //引数のチェック 65 | if (args.Length < 1) { 66 | string mergeName = ""; 67 | for (int i = 0; i < simpleNames.Length; i++) { 68 | mergeName = mergeName + simpleNames[i]; 69 | if (i < simpleNames.Length - 1) 70 | mergeName = mergeName + ", "; 71 | } 72 | Console.WriteLine("使用するVOICEROIDを引数に追加してください: " + mergeName); 73 | return; 74 | } 75 | //引数に設定されたボイスロイドの名前をチェック 76 | string selectedSimple = null; 77 | int selectedIndex = 0; 78 | for (int i = 0; i < simpleNames.Length; i++) { 79 | if (args[0].CompareTo(simpleNames[i]) == 0) { 80 | selectedSimple = simpleNames[i]; 81 | selectedIndex = i; 82 | break; 83 | } 84 | } 85 | if (selectedSimple == null) { 86 | string mergeName = ""; 87 | for (int i = 0; i < simpleNames.Length; i++) { 88 | mergeName = mergeName + simpleNames[i]; 89 | if (i < simpleNames.Length - 1) 90 | mergeName = mergeName + ", "; 91 | } 92 | Console.WriteLine("引数に指定されたVOICEROIDの名前が正しくありません. 使用できる名前は次のとおりです: " + mergeName); 93 | return; 94 | } 95 | //VOICEROID.exeの起動チェック 96 | Process[] apps = Process.GetProcessesByName("VOICEROID"); 97 | if (apps.Length < 1) 98 | { 99 | Console.WriteLine("プロセスに" + voiceroidNames[selectedIndex] + "のVOICEROID.exeがありません. " + voiceroidNames[selectedIndex] + "を起動してください."); 100 | return; 101 | } 102 | //VOICEROID.exeのプロセス取得 103 | AutomationElement ae = null; 104 | foreach (Process app in apps) 105 | { 106 | AutomationElement rootHandle = AutomationElement.FromHandle(app.MainWindowHandle); 107 | foreach(string voiceroidName in voiceroidNames) { 108 | string name = rootHandle.Current.Name; 109 | if (name.CompareTo(voiceroidNames[selectedIndex]) == 0 || name.CompareTo(voiceroidNames[selectedIndex]+"*") == 0) ae = rootHandle; 110 | } 111 | } 112 | //起動しているVOICEROID.exeと指定されたキャラクターのVOICEROID.exeが一致しなかった時 113 | if(ae == null) { 114 | string mergeName = ""; 115 | for (int i = 0; i < simpleNames.Length; i++) { 116 | mergeName = mergeName + simpleNames[i]; 117 | if (i < simpleNames.Length - 1) 118 | mergeName = mergeName + ", "; 119 | } 120 | Console.WriteLine("引数に指定された名前のVOICEROIDが起動していません. 他の名前を指定するか, 指定した名前のVOICEROID.exeを起動してください: " + mergeName); 121 | return; 122 | } 123 | Console.Clear(); 124 | //ウィンドウにフォーカスをあわせる 125 | ae.SetFocus(); 126 | 127 | //テキストボックス、再生ボタン、停止ボタンのGUIコントロール取得 128 | AutomationElement txtForm = ae.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.AutomationIdProperty, "txtMain", PropertyConditionFlags.IgnoreCase)); 129 | IntPtr txtFormHandle = IntPtr.Zero; 130 | try { 131 | txtFormHandle = (IntPtr)txtForm.Current.NativeWindowHandle; 132 | } 133 | catch (NullReferenceException e) { 134 | //ハンドルが取得できなかった場合、ウィンドウが見つかっていない 135 | Console.WriteLine(voiceroidNames[selectedIndex] + "のウィンドウが取得できませんでした. 最小化されているか, ほかのプロセスによってブロックされています."); 136 | return; 137 | } 138 | //テキストボックスのハンドルを取得 139 | IntPtr txtControl = FindWindowEx(txtFormHandle, IntPtr.Zero, null, null); 140 | //再生ボタンのハンドルを取得 141 | AutomationElement btnPlay = ae.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.AutomationIdProperty, "btnPlay", PropertyConditionFlags.IgnoreCase)); 142 | IntPtr btnControl = (IntPtr)btnPlay.Current.NativeWindowHandle; 143 | //停止ボタンのハンドルを取得 144 | AutomationElement btnStop = ae.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.AutomationIdProperty, "btnStop", PropertyConditionFlags.IgnoreCase)); 145 | IntPtr stpControl = (IntPtr)btnStop.Current.NativeWindowHandle; 146 | 147 | //音量、速度、高さ、抑揚のテキストボックスのコントロールを取得 148 | AutomationElement txtVol = ae.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.AutomationIdProperty, "txtVolume", PropertyConditionFlags.IgnoreCase)); 149 | AutomationElement txtSpd = ae.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.AutomationIdProperty, "txtSpeed", PropertyConditionFlags.IgnoreCase)); 150 | AutomationElement txtPit = ae.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.AutomationIdProperty, "txtPitch", PropertyConditionFlags.IgnoreCase)); 151 | AutomationElement txtEmp = ae.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.AutomationIdProperty, "txtEmphasis", PropertyConditionFlags.IgnoreCase)); 152 | 153 | //音声効果の画面が表示されていない時の処理 154 | if (txtVol == null || txtSpd == null || txtPit == null || txtEmp == null) { 155 | Console.WriteLine("音声効果の画面を展開しています..."); 156 | Thread.Sleep(100); 157 | 158 | //音声チューニングのタブを取得 159 | AutomationElementCollection tabs = ae.FindAll(TreeScope.Descendants, 160 | new PropertyCondition(AutomationElement.LocalizedControlTypeProperty, "タブ項目", PropertyConditionFlags.IgnoreCase)); 161 | 162 | //音声チューニングのタブが取得できない時の処理 163 | if (tabs.Count < 1) { 164 | AutomationElementCollection menues = ae.FindAll(TreeScope.Descendants, 165 | new PropertyCondition(AutomationElement.LocalizedControlTypeProperty, "メニュー項目", PropertyConditionFlags.IgnoreCase)); 166 | 167 | //音声チューニングのウィンドウを表示する 168 | foreach (AutomationElement menu in menues) { 169 | if (menu.Current.Name.CompareTo("音声チューニング(T)") == 0) { 170 | object ipShowTuning; 171 | if (menu.TryGetCurrentPattern(InvokePattern.Pattern, out ipShowTuning)) { 172 | ((InvokePattern)ipShowTuning).Invoke(); 173 | Thread.Sleep(1000); 174 | } 175 | } 176 | } 177 | 178 | //再度音声チューニング 179 | tabs = ae.FindAll(TreeScope.Descendants, 180 | new PropertyCondition(AutomationElement.LocalizedControlTypeProperty, "タブ項目", PropertyConditionFlags.IgnoreCase)); 181 | } 182 | 183 | //音声効果のタブを探す 184 | foreach (AutomationElement tab in tabs) { 185 | if (tab.Current.Name.CompareTo("音声効果") == 0) { 186 | object ipShowSoundEffect; 187 | if (tab.TryGetCurrentPattern(SelectionItemPattern.Pattern, out ipShowSoundEffect)) { 188 | ((SelectionItemPattern)ipShowSoundEffect).Select(); 189 | Thread.Sleep(1000); 190 | } 191 | } 192 | } 193 | 194 | //再度、音量、速度、高さ、抑揚のテキストボックスのコントロールを取得 195 | txtVol = ae.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.AutomationIdProperty, "txtVolume", PropertyConditionFlags.IgnoreCase)); 196 | txtSpd = ae.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.AutomationIdProperty, "txtSpeed", PropertyConditionFlags.IgnoreCase)); 197 | txtPit = ae.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.AutomationIdProperty, "txtPitch", PropertyConditionFlags.IgnoreCase)); 198 | txtEmp = ae.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.AutomationIdProperty, "txtEmphasis", PropertyConditionFlags.IgnoreCase)); 199 | } 200 | 201 | //再度、音量、速度、高さ、抑揚のハンドルを取得 202 | IntPtr txtVolControl = (IntPtr)txtVol.Current.NativeWindowHandle; 203 | IntPtr txtSpdControl = (IntPtr)txtSpd.Current.NativeWindowHandle; 204 | IntPtr txtPitControl = (IntPtr)txtPit.Current.NativeWindowHandle; 205 | IntPtr txtEmpControl = (IntPtr)txtEmp.Current.NativeWindowHandle; 206 | 207 | //InvokePattern ipBtnPlay = (InvokePattern)btnPlay.GetCurrentPattern(InvokePattern.Pattern); 208 | //ValuePattern vpTxtVol = (ValuePattern)txtVol.GetCurrentPattern(ValuePattern.Pattern); 209 | //ValuePattern vpTxtSpd = (ValuePattern)txtSpd.GetCurrentPattern(ValuePattern.Pattern); 210 | //ValuePattern vpTxtPit = (ValuePattern)txtPit.GetCurrentPattern(ValuePattern.Pattern); 211 | //ValuePattern vpTxtEmp = (ValuePattern)txtEmp.GetCurrentPattern(ValuePattern.Pattern); 212 | 213 | string btnName = btnPlay.Current.Name; 214 | string message = ""; 215 | Console.WriteLine("[voiceroid_talker" +selectedSimple + "]のサーバーを開始しています..."); 216 | 217 | //メインループ 218 | while (true) { 219 | string clientMessage; 220 | string[] messages; 221 | string messageVol = "1.0"; 222 | string messageSpd = "1.0"; 223 | string messagePit = "1.0"; 224 | string messageEmp = "1.0"; 225 | //通信セッションの開始 226 | try 227 | { 228 | using (NamedPipeServerStream server = new NamedPipeServerStream("voiceroid_talker" + selectedSimple)) 229 | { 230 | Console.WriteLine("クライアントからのメッセージを待っています..."); 231 | server.WaitForConnection(); 232 | 233 | byte[] buffer = new byte[1024]; 234 | server.Read(buffer, 0, buffer.Length); 235 | string messageRaw = UnicodeEncoding.Unicode.GetString(buffer); 236 | clientMessage = messageRaw.Trim('\0'); 237 | //通信メッセージの内容をパースする 238 | messages = clientMessage.Split(';'); 239 | if (messages.Length == 1) 240 | { 241 | message = clientMessage; 242 | if (message.CompareTo("exit") == 0) break; 243 | } 244 | else 245 | { 246 | message = messages[0]; 247 | } 248 | //音量のパラメータを取得する 249 | if (messages.Length >= 2) 250 | { 251 | float val = 0.0f; 252 | if (float.TryParse(messages[1], out val)) messageVol = val.ToString(); 253 | } 254 | //速度のパラメータを取得する 255 | if (messages.Length >= 3) 256 | { 257 | float val = 0.0f; 258 | if (float.TryParse(messages[2], out val)) messageSpd = val.ToString(); 259 | } 260 | //高さのパラメータを取得する 261 | if (messages.Length >= 4) 262 | { 263 | float val = 0.0f; 264 | if (float.TryParse(messages[3], out val)) messagePit = val.ToString(); 265 | } 266 | //抑揚のパラメータを取得する 267 | if (messages.Length >= 5) 268 | { 269 | float val = 0.0f; 270 | if (float.TryParse(messages[4], out val)) messageEmp = val.ToString(); 271 | } 272 | 273 | //音量、速度、高さ、抑揚のテキストボックスに値を入力 274 | SendMessage(txtVolControl, WM_SETTEXT, IntPtr.Zero, messageVol); 275 | PostMessage(txtVolControl, WM_KEYDOWN, (IntPtr)VK_RETURN, null); 276 | 277 | SendMessage(txtSpdControl, WM_SETTEXT, IntPtr.Zero, messageSpd); 278 | PostMessage(txtSpdControl, WM_KEYDOWN, (IntPtr)VK_RETURN, null); 279 | 280 | SendMessage(txtPitControl, WM_SETTEXT, IntPtr.Zero, messagePit); 281 | PostMessage(txtPitControl, WM_KEYDOWN, (IntPtr)VK_RETURN, null); 282 | 283 | SendMessage(txtEmpControl, WM_SETTEXT, IntPtr.Zero, messageEmp); 284 | PostMessage(txtEmpControl, WM_KEYDOWN, (IntPtr)VK_RETURN, null); 285 | 286 | Thread.Sleep(10); 287 | 288 | //テキストボックスにメッセージを入れ、再生する 289 | SendMessage(txtControl, WM_SETTEXT, IntPtr.Zero, message); 290 | PostMessage(stpControl, WM_CLICK, IntPtr.Zero, null); 291 | PostMessage(btnControl, WM_CLICK, IntPtr.Zero, null); 292 | 293 | //ipBtnPlay.Invoke(); 294 | Thread.Sleep(100); 295 | 296 | //レスポンス用メッセージをクライアントに送信 297 | byte[] response = UnicodeEncoding.Unicode.GetBytes("OK"); 298 | server.Write(response, 0, 2); 299 | 300 | //セッションを終了する 301 | server.Close(); 302 | } 303 | } catch(IOException e) { 304 | //セッション作成時にエラーが発生した場合 305 | Console.WriteLine("通信セッションの作成に失敗しました. 他のサーバーによって, 同名のセッションが開始されている可能性があります."); 306 | break; 307 | } 308 | } 309 | 310 | } //メインループ終了 311 | 312 | 313 | } 314 | } 315 | -------------------------------------------------------------------------------- /VoiceroidTServer/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("VoiceroidTServer")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("VoiceroidTServer")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("d5bb4fde-efc4-4f4c-a01b-7bcd77d6fa3a")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /VoiceroidTServer/VoiceroidTServer.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {B4198DE2-7458-401D-B847-2CDC48109C71} 8 | Exe 9 | Properties 10 | VoiceroidTServer 11 | VoiceroidTServer 12 | v4.5 13 | 512 14 | 15 | 16 | AnyCPU 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | false 25 | 26 | 27 | AnyCPU 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | false 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 60 | -------------------------------------------------------------------------------- /VoiceroidTalker.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.31101.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VoiceroidTClient", "VoiceroidTClient\VoiceroidTClient.csproj", "{BF944CFB-ACE3-4D6A-B397-EBECBEE7CBCA}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VoiceroidTServer", "VoiceroidTServer\VoiceroidTServer.csproj", "{B4198DE2-7458-401D-B847-2CDC48109C71}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Any CPU = Debug|Any CPU 13 | Release|Any CPU = Release|Any CPU 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {BF944CFB-ACE3-4D6A-B397-EBECBEE7CBCA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 17 | {BF944CFB-ACE3-4D6A-B397-EBECBEE7CBCA}.Debug|Any CPU.Build.0 = Debug|Any CPU 18 | {BF944CFB-ACE3-4D6A-B397-EBECBEE7CBCA}.Release|Any CPU.ActiveCfg = Release|Any CPU 19 | {BF944CFB-ACE3-4D6A-B397-EBECBEE7CBCA}.Release|Any CPU.Build.0 = Release|Any CPU 20 | {B4198DE2-7458-401D-B847-2CDC48109C71}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {B4198DE2-7458-401D-B847-2CDC48109C71}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {B4198DE2-7458-401D-B847-2CDC48109C71}.Release|Any CPU.ActiveCfg = Release|Any CPU 23 | {B4198DE2-7458-401D-B847-2CDC48109C71}.Release|Any CPU.Build.0 = Release|Any CPU 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | EndGlobal 29 | --------------------------------------------------------------------------------