public void btnExecute_Click(Object sender, EventArgs e)
        {
            PrepareStartArgument arg = new PrepareStartArgument();

            arg.singer    = (string)comboSinger.SelectedItem;
            arg.amplitude = 1.0;
            arg.directory = txtDir.Text;
            arg.replace   = chkIgnoreExistingWavs.Checked;
            updateEnabled(false);
            bgWork.RunWorkerAsync(arg);
        }
        public void bgWork_DoWork(Object sender, DoWorkEventArgs e)
        {
#if DEBUG
            sout.println("FormGenerateKeySound#bgWork_DoWork");
#endif
            PrepareStartArgument arg = (PrepareStartArgument)e.Argument;
            string singer            = arg.singer;
            double amp     = arg.amplitude;
            string dir     = arg.directory;
            bool   replace = arg.replace;
            // 音源を準備
            if (!Directory.Exists(dir))
            {
                PortUtil.createDirectory(dir);
            }

            for (int i = 0; i < 127; i++)
            {
                string path = Path.Combine(dir, i + ".wav");
                sout.println("writing \"" + path + "\" ...");
                if (replace || (!replace && !File.Exists(path)))
                {
                    try {
                        GenerateSinglePhone(i, singer, path, amp);
                        if (File.Exists(path))
                        {
                            try {
                                Wave wv = new Wave(path);
                                wv.trimSilence();
                                wv.monoralize();
                                wv.write(path);
                            } catch (Exception ex0) {
                                serr.println("FormGenerateKeySound#bgWork_DoWork; ex0=" + ex0);
                                Logger.write(typeof(FormGenerateKeySound) + ".bgWork_DoWork; ex=" + ex0 + "\n");
                            }
                        }
                    } catch (Exception ex) {
                        Logger.write(typeof(FormGenerateKeySound) + ".bgWork_DoWork; ex=" + ex + "\n");
                        serr.println("FormGenerateKeySound#bgWork_DoWork; ex=" + ex);
                    }
                }
                sout.println(" done");
                if (m_cancel_required)
                {
                    m_cancel_required = false;
                    break;
                }
                bgWork.ReportProgress((int)(i / 127.0 * 100.0), null);
            }
            m_cancel_required = false;
        }