예제 #1
0
        public Form1()
        {
            InitializeComponent();
            listView1.FullRowSelect = true;
            listView1.Scrollable    = true;
            listView1.MultiSelect   = true;
            #region undo redo setup
            var InitialState = new object();
            StateList.Add(InitialState);
            #endregion

            #region Add button "open OTO"
            openOTO                                   = new NFCButton();
            openOTO.BackColor                         = Color.Transparent;
            openOTO.BackgroundImage                   = oto2dvcfg.Properties.Resources.buttonAddNormal;
            openOTO.Cursor                            = Cursors.Hand;
            openOTO.FlatStyle                         = FlatStyle.Flat;
            openOTO.FlatAppearance.BorderSize         = 0;
            openOTO.FlatAppearance.BorderColor        = Color.FromArgb(0, 255, 255, 255);
            openOTO.FlatAppearance.CheckedBackColor   = Color.Transparent;
            openOTO.FlatAppearance.MouseOverBackColor = Color.Transparent;
            openOTO.FlatAppearance.MouseDownBackColor = Color.Transparent;
            openOTO.ForeColor                         = Color.Transparent;
            openOTO.Location                          = new Point(161, 42);
            openOTO.Size                              = new Size(38, 38);
            openOTO.Click                            += OpenOTO_Click;
            openOTO.MouseDown                        += OpenOTO_MouseDown;
            openOTO.MouseUp                          += OpenOTO_MouseUp;
            this.Controls.Add(this.openOTO);
            #endregion

            #region Close button properties
            buttonClose.FlatAppearance.BorderColor        = Color.FromArgb(0, 255, 255, 255);
            buttonClose.FlatAppearance.CheckedBackColor   = Color.Transparent;
            buttonClose.FlatAppearance.MouseOverBackColor = Color.Transparent;
            buttonClose.FlatAppearance.MouseDownBackColor = Color.Transparent;
            #endregion

            dvcfgCalculator DC = new dvcfgCalculator();
        }
예제 #2
0
        public static string[] dvcfgWriter
        (
            string wavPath,
            string[] srcType,
            string[] wavName,
            string[] symbol,
            string[] offset,
            string[] consonant,
            string[] cutoff,
            string[] Upreutterance,
            string[] Overlap,
            int otoLinesCount,
            string pitch
        )
        {
            List <string> settings = new List <string>();

            for (int i = 0; i < otoLinesCount + 1; i++)
            {
                if (!File.Exists(wavPath + wavName[i]))
                {
                    continue;
                }
                NAudio.Wave.WaveFileReader waveFileReader = new NAudio.Wave.WaveFileReader(wavPath + wavName[i]);
                TimeSpan wavTimeSpan = waveFileReader.TotalTime;

                dvcfgCalculator DC = new dvcfgCalculator
                {
                    SrcType          = srcType[i],
                    Offset           = Convert.ToDouble(offset[i]),
                    Consonant        = Convert.ToDouble(consonant[i]),
                    Cutoff           = Convert.ToDouble(cutoff[i]),
                    UTAUPreutterance = Convert.ToDouble(Upreutterance[i]),
                    Overlap          = Convert.ToDouble(Overlap[i]),
                    WavTime          = Convert.ToDouble(wavTimeSpan.TotalSeconds) * 1000
                };

                switch (srcType[i])
                {
                case "CV":
                    settings.Add(
                        $"   \"{pitch}->{DC.StartNoteDetact(symbol[i])}\" : {{\n" +
                        $"      \"connectPoint\" : {DC.ToString(DC.ConnectPoint)},\n" +
                        $"      \"endTime\" : {DC.ToString(DC.EndTime)},\n" +
                        $"      \"pitch\" : \"{pitch}\",\n" +
                        $"      \"preutterance\" : {DC.ToString(DC.DVPreuttrance)},\n" +
                        $"      \"srcType\" : \"CV\",\n" +
                        $"      \"startTime\" : {DC.ToString(DC.StartTime)},\n" +
                        $"      \"symbol\" : \"{DC.StartNoteDetact(symbol[i])}\",\n" +
                        $"      \"tailPoint\" : {DC.ToString(DC.TailPoint)},\n" +
                        $"      \"updateTime\" : \"{DC.UpdateTime}\",\n" +
                        $"      \"vowelEnd\" : {DC.ToString(DC.VowelEnd)},\n" +
                        $"      \"vowelStart\" : {DC.ToString(DC.VowelStart)},\n" +
                        $"      \"wavName\" : \"{wavName[i]}\"\n" +
                        $"   }},\n"
                        );
                    break;

                case "VX":
                    settings.Add(
                        $"   \"{pitch}->{symbol[i].Replace(" ", "_")}\" : {{\n" +
                        $"      \"connectPoint\" : {DC.ToString(DC.ConnectPoint)},\n" +
                        $"      \"endTime\" : {DC.ToString(DC.EndTime)},\n" +
                        $"      \"pitch\" : \"{pitch}\",\n" +
                        $"      \"srcType\" : \"VX\",\n" +
                        $"      \"startTime\" : {DC.ToString(DC.StartTime)},\n" +
                        $"      \"symbol\" : \"{symbol[i].Replace(" ", "_")}\",\n" +
                        $"      \"tailPoint\" : {DC.ToString(DC.TailPoint)},\n" +
                        $"      \"updateTime\" : \"{DC.UpdateTime}\",\n" +
                        $"      \"wavName\" : \"{wavName[i]}\"\n" +
                        $"   }},\n"
                        );
                    break;

                case "INDIE":
                    settings.Add(
                        $"   \"{pitch}->{symbol[i]}\" : {{\n" +
                        $"      \"endPoint\" : {DC.ToString(DC.VowelEnd + DC.ConnectPoint)},\n" +
                        $"      \"endTime\" : {DC.ToString(DC.EndTime)},\n" +
                        $"      \"pitch\" : \"{pitch}\",\n" +
                        $"      \"srcType\" : \"INDIE\",\n" +
                        $"      \"startPoint\" : {DC.ToString(DC.ConnectPoint)},\n" +
                        $"      \"startTime\" : {DC.ToString(DC.StartTime)},\n" +
                        $"      \"symbol\" : \"{symbol[i]}\",\n" +
                        $"      \"updateTime\" : \"{DC.UpdateTime}\",\n" +
                        $"      \"wavName\" : \"{wavName[i]}\"\n" +
                        $"   }},\n"
                        );
                    break;

                default:
                    throw new Exception("Unable to parse src type");
                }

                DC.Clear();
            }

            return(settings.ToArray());
        }