static void Main(string[] args) { if (args.Length < 1) { return; } if (!args[0].Equals("connect")) { return; } //クライアントサイドのチャンネルを生成. IpcClientChannel channel = new IpcClientChannel(); //チャンネルを登録 ChannelServices.RegisterChannel(channel, true); wrapper_connect rc = Activator.GetObject(typeof(wrapper_connect), "ipc://neutrino_utau_plugin/proj_s_data") as wrapper_connect; wrapper_connect wrc = rc; string bindir_name = wrc.neutrino_dirname + "\\bin\\"; Console.WriteLine(DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss.ff") + " : start MusicXMLtoLabel"); System.IO.Directory.SetCurrentDirectory(wrc.neutrino_dirname); run_process(bindir_name + "musicXMLtoLabel.exe", "\"" + wrc.xml_path + "\"" + " " + "\"" + wrc.neutrino_dirname + "\\score\\label\\full\\" + wrc.proj_name + ".lab\" " + "\"" + wrc.neutrino_dirname + "\\score\\label\\mono\\" + wrc.proj_name + ".lab\""); string neutrino_args = "score\\label\\full\\" + wrc.proj_name + ".lab " + "score\\label\\timing\\" + wrc.proj_name + ".lab " + "output\\" + wrc.proj_name + ".f0 " + "output\\" + wrc.proj_name + ".mgc" + " " + "output\\" + wrc.proj_name + ".bap" + " " + "model\\" + wrc.voice + "\\" + " -n " + wrc.threads.ToString() + " -t"; Console.WriteLine(DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss.ff") + " : start NEUTRINO"); run_process(bindir_name + "NEUTRINO.exe", neutrino_args); string WORLD_args = "output\\" + wrc.proj_name + ".f0 output\\" + wrc.proj_name + ".mgc output\\" + wrc.proj_name + ".bap -f " + wrc.PitchShift.ToString() + " -m " + wrc.FormantShift.ToString() + " -o output\\" + wrc.proj_name + "_syn.wav -n " + wrc.threads.ToString() + " -t "; Console.WriteLine(DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss.ff") + " : start WORLD"); run_process(bindir_name + "WORLD.exe", WORLD_args); string NSF_IO_args = "score\\label\\full\\" + wrc.proj_name + ".lab " + "score\\label\\timing\\" + wrc.proj_name + ".lab " + "output\\" + wrc.proj_name + ".f0 " + "output\\" + wrc.proj_name + ".mgc" + " " + "output\\" + wrc.proj_name + ".bap" + " " + wrc.voice + " output\\" + wrc.proj_name + "_nsf.wav" + " -t"; Console.WriteLine(DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss.ff") + " : start NSF"); run_process(bindir_name + "NSF_IO.exe", NSF_IO_args); }
static void Main(string[] args) { string appdatapath = System.Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\neutrino_utau_plugin"; if (args.Length < 1) { System.Console.WriteLine("ERROR ! You must set filename."); return; } if (!Directory.Exists(appdatapath)) { Directory.CreateDirectory(appdatapath); } wrapper_connect settingkun = new wrapper_connect(); if (File.Exists(appdatapath + "\\settings.json")) { JsonSerializer jser = new JsonSerializer(); using (FileStream fs = new FileStream(appdatapath + "\\settings.json", FileMode.Open)) { using (StreamReader sr = new StreamReader(fs, Encoding.UTF8)) { using (JsonTextReader jr = new JsonTextReader(sr)) { settingkun = jser.Deserialize <wrapper_connect>(jr); settingkun.no_data = false; } } } } if (settingkun.no_data) { SettingsDialog settingsDialog = new SettingsDialog(settingkun); settingsDialog.cancel_enable = false; settingsDialog.ShowDialog(); settingkun = settingsDialog.wrcon; JsonSerializer jser = new JsonSerializer(); using (FileStream fskun = new FileStream(appdatapath + "\\settings.json", FileMode.OpenOrCreate)){ using (StreamWriter sw = new StreamWriter(fskun, Encoding.UTF8)) { using (JsonTextWriter jsw = new JsonTextWriter(sw)) { jser.Serialize(jsw, settingkun); jsw.Flush(); } } } } if (args[0].Equals("--setting")) { SettingsDialog settingsDialog = new SettingsDialog(settingkun); settingsDialog.ShowDialog(); settingkun = settingsDialog.wrcon; JsonSerializer jser = new JsonSerializer(); using (FileStream fskun = new FileStream(appdatapath + "\\settings.json", FileMode.OpenOrCreate)) { using (StreamWriter sw = new StreamWriter(fskun, Encoding.UTF8)) { using (JsonTextWriter jsw = new JsonTextWriter(sw)) { jser.Serialize(jsw, settingkun); jsw.Flush(); } } } } /* * SaveFileDialog saveFileDialog = new SaveFileDialog(); * saveFileDialog.Filter = "MusicXML (*.musicxml)|*.musicxml|XML (*.xml)|*.xml|すべてのファイル (*.*)|*.*"; * * if (saveFileDialog.ShowDialog()==true) * { * using(FileStream fskun=new FileStream(saveFileDialog.FileName, FileMode.Create)) * { * ustkun.Write_XML(fskun); * } * } */ ProjectNameInput pri = new ProjectNameInput(); pri.ShowDialog(); string xml_fname = settingkun.neutrino_dirname; xml_fname = xml_fname.TrimEnd('\\'); xml_fname = xml_fname + "\\score\\musicxml\\" + pri.nameD + ".musicxml"; string xml_fname_t = xml_fname + "_tmp"; run_process(System.AppDomain.CurrentDomain.BaseDirectory.TrimEnd('\\') + "\\perl\\bin\\perl.exe", "\"" + System.AppDomain.CurrentDomain.BaseDirectory.TrimEnd('\\') + "\\perl\\utau2sinsy.pl\" " + "\"" + args[0].Replace("\"", "") + "\" " + "\"" + xml_fname_t + "\""); using (StreamReader sr = new StreamReader(xml_fname_t)) { using (FileStream fskun = new FileStream(xml_fname, FileMode.Create)) { using (StreamWriter sw = new StreamWriter(fskun)) { string line; bool isFirstLine = true; while (sr.Peek() > -1) { line = sr.ReadLine(); if (isFirstLine) { isFirstLine = false; sw.WriteLine("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>"); continue; } sw.WriteLine(line); } } } } System.IO.File.Delete(xml_fname_t); IpcServerChannel channel = new IpcServerChannel("neutrino_utau_plugin"); ChannelServices.RegisterChannel(channel, true); settingkun.xml_path = xml_fname; settingkun.proj_name = pri.nameD; RemotingServices.Marshal(settingkun, "proj_s_data"); string wrapper_exe = System.AppDomain.CurrentDomain.BaseDirectory.TrimEnd('\\') + "\\neutrino_wrapper.exe"; Process p = new Process(); p.StartInfo.FileName = wrapper_exe; p.StartInfo.Arguments = "connect"; p.StartInfo.CreateNoWindow = true; p.StartInfo.UseShellExecute = false; p.StartInfo.RedirectStandardOutput = true; p.StartInfo.RedirectStandardError = true; p.OutputDataReceived += p_OutputDataReceived; p.ErrorDataReceived += p_ErrorDataReceived; p.Start(); p.BeginOutputReadLine(); p.BeginErrorReadLine(); p.WaitForExit(); p.Close(); //デバッグ用 /* * using(MemoryStream memstr=new MemoryStream()) * { * ustkun.Write_XML(memstr); * StreamReader sr = new StreamReader(memstr,Encoding.UTF8); * sr.BaseStream.Seek(0, SeekOrigin.Begin); * Console.WriteLine(sr.ReadToEnd()); * }*/ }
public SettingsDialog(wrappe_connect.wrapper_connect wrapper_Connect) { wrcon = wrapper_Connect; cancel_enable = true; InitializeComponent(); }