Пример #1
0
        public void SingleFileConversion(string directoryPath = @".\temp\test", string destinationPath = @".\temp\conv")
        {
            FileInfo file     = new FileInfo(directoryPath);
            Form_GCC form_GCC = Application.OpenForms["Form_GCC"] as Form_GCC;

            form_GCC.toolStrip_status3.Text = $"{file.Name} Converting OGG to WAV...";
            try
            {
                using (Process myProcess = new Process())
                {
                    Console.WriteLine($"{file.Name} Converting to WAV ...");
                    myProcess.StartInfo.UseShellExecute = false;

                    Program.songFile                   = Path.GetFileNameWithoutExtension(file.Name);
                    myProcess.StartInfo.FileName       = @"tools\ffmpeg.exe";
                    myProcess.StartInfo.Arguments      = $"-i \"{file.FullName}\" \"{destinationPath}\\{Program.songFile}.wav\"";
                    myProcess.StartInfo.CreateNoWindow = false;
                    myProcess.Start();
                    myProcess.WaitForExit();


                    Console.WriteLine("conversion done.");
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
Пример #2
0
        public String SingleFileConversion(string directoryPath = @".\temp\test", string directoryPath2 = @".\temp\test", int mode = 0)
        {
            FileInfo file     = new FileInfo(directoryPath);
            FileInfo file2    = new FileInfo(directoryPath2);
            String   file_out = file.DirectoryName + "\\m_" + file.Name;
            Form_GCC form_GCC = Application.OpenForms["Form_GCC"] as Form_GCC;

            form_GCC.toolStrip_status3.Text = $"{file.Name} and {file2.Name} Merging...";

            try
            {
                if (File.Exists(file_out))
                {
                    File.Delete(file_out);
                }
                using (Process myProcess = new Process())
                {
                    myProcess.StartInfo.UseShellExecute = false;

                    Program.songFile                   = Path.GetFileNameWithoutExtension(file.Name);
                    myProcess.StartInfo.FileName       = @"tools\ffmpeg.exe";
                    myProcess.StartInfo.Arguments      = $"-i \"{file.FullName}\" -i \"{file2.FullName}\" -filter_complex \"[0:a][1:a]amerge=inputs=2,pan=stereo|c0=c0+c2|c1=c1+c3[a]\" -map \"[a]\" \"{file_out}\"";
                    myProcess.StartInfo.CreateNoWindow = true;
                    myProcess.Start();
                    myProcess.WaitForExit();

                    Program.songFile = Path.GetFileNameWithoutExtension(file.Name);
                    if (mode == 1)
                    {
                        File.Delete(file.FullName);
                    }
                    Console.WriteLine("conversion done.");
                }
            }
            catch (Exception e)
            {
                MessageHandler.ShowError(4);
                Console.WriteLine(e.Message);
            }

            return(file_out);
        }
Пример #3
0
        public void Main(string directoryPath = @".\temp\test", string destinationPath = @".\temp\conv")
        {
            DirectoryInfo directorySelected = new DirectoryInfo(directoryPath);
            Form_GCC      form_GCC          = Application.OpenForms["Form_GCC"] as Form_GCC;

            foreach (FileInfo file in directorySelected.GetFiles("*.wav"))
            {
                form_GCC.toolStrip_status3.Text = $"{file.Name} Converting to OPUS SWITCH...";
                try
                {
                    using (Process myProcess = new Process())
                    {
                        Console.WriteLine($"{file.Name} Converting to OPUS SWITCH ...");
                        myProcess.StartInfo.UseShellExecute = false;

                        myProcess.StartInfo.FileName  = @"tools\VGAudioCli.exe";
                        myProcess.StartInfo.Arguments = $"--bitrate 128000 --cbr \"{file.FullName}\" \"{destinationPath}\\{Path.GetFileNameWithoutExtension(file.Name)}.lopus\"";
                        //myProcess.StartInfo.Arguments = $"\"{file.FullName}\" - \"{destinationPath}\\{file.Name}\" 48000";
                        myProcess.StartInfo.CreateNoWindow = true;
                        myProcess.Start();
                        myProcess.WaitForExit();
                        string fileOut = destinationPath + "\\" + Path.GetFileNameWithoutExtension(file.Name).ToLower() + ".wav.opus";
                        if (File.Exists(fileOut))
                        {
                            File.Delete(fileOut);
                        }
                        File.Move(destinationPath + "\\" + Path.GetFileNameWithoutExtension(file.Name) + ".lopus", fileOut);
                        File.Delete(file.FullName);

                        Console.WriteLine("conversion done.");
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }
            }
        }
Пример #4
0
        /*
         *  -h:         Hide software window
         *  -s "":      String StageParam File to edit
         *  -sp_fr x:   Stage_param From...
         *              (0: Arcade; 1: Mobile)
         *  -sp_to x:   Stage_param To...
         *              (0: GC4EX; 1: GC2; 2: Switch)
         *  -i_bgm "":  BGM audio file
         *  -i_shot "": SHOT audio file to merge or not
         *  -i_data "": Folder that contain data files
         *  -n_data "": Name to gameplay data (ex: XXXX is the name in ac_XXXX_easy_ext.dat)
         *  -g x:       Genre of the song
         *              (1: Anime/pop; 2: VOCALOID; 3: MusicGames;
         *              4: Game Music; 5: Misc; 6: Original; 7: Touhou)
         *  -o "":      Output folder
         *  -nac:       No Audio Converter
         *  -ndc:       No Data Converter
         *  -convert x: Convert mode
         *  -all:       Enable All converter mode (NOT STABLE!)
         *              (0: files only; 1: Convert & Update stage_param)
         */

        public static void args(Form_GCC form)
        {
            if ([email protected] > 0)
            {
                coms = Program.@params;
                foreach (var com in coms)
                {
                    if (command.Length == 0)
                    {
                        command = com;
                    }
                    else
                    {
                        param = com;
                    }


                    if (command.Equals("-h"))
                    {
                        form.Visible = false;
                        ClearCommands();
                    }
                    else if (command.Equals("-s") && param.Length > 0)
                    {
                        form.textBox_StageParamInput.Text = param;
                    }
                    else if (command.Equals("-sp_fr") && param.Length > 0)
                    {
                        form.comboBox_Mode.SelectedIndex = int.Parse(param);
                    }
                    else if (command.Equals("-sp_to") && param.Length > 0)
                    {
                        form.comboBox_SystemStageParam.SelectedIndex = int.Parse(param);
                    }
                    else if (command.Equals("-i_bgm") && param.Length > 0)
                    {
                        form.textBox_FileBGM.Text = param;
                    }
                    else if (command.Equals("-i_shot") && param.Length > 0)
                    {
                        form.checkBox_SHOT.Checked = true;
                        form.textBox_FileSHOT.Text = param;
                    }
                    else if (command.Equals("-i_data") && param.Length > 0)
                    {
                        form.textBox_Data.Text = param;
                    }
                    else if (command.Equals("-n_data") && param.Length > 0)
                    {
                        songNameData = param;
                    }
                    else if (command.Equals("-g") && param.Length > 0)
                    {
                        form.comboBox_Genres.SelectedIndex = int.Parse(param);
                    }
                    else if (command.Equals("-o") && param.Length > 0)
                    {
                        form.textBox_output.Text = param;
                    }
                    else if (command.Equals("-nac"))
                    {
                        noAudioConverter = true;
                        ClearCommands();
                    }
                    else if (command.Equals("-ndc"))
                    {
                        noDataConverter = true;
                        ClearCommands();
                    }
                    else if (command.Equals("-convert") && param.Length > 0)
                    {
                        int_convert = int.Parse(param);
                        convert     = true;
                    }
                    else if (command.Equals("-all"))
                    {
                        //form.tabControl_Main.TabPages.Add(form.tab_StageParamConverter);
                        ClearCommands();
                    }
                    else if (command.Equals("-swigs"))
                    {
                        swigs = true;
                        ClearCommands();
                    }

                    if (command.Length > 0 && param.Length > 0)
                    {
                        ClearCommands();
                    }
                }

                if (convert)
                {
                    form.button_LoadStageParam_Click(form.button_LoadStageParam, EventArgs.Empty);

                    while (!form.tabControl_Main.Enabled)
                    {
                    }

                    if (int_convert == 1)
                    {
                        form.button_ConvertUpdate_Click(form.button_ConvertUpdate, EventArgs.Empty);
                    }
                    else
                    {
                        form.button_ConvertUpdate_Click(form.button_Convert, EventArgs.Empty);
                    }
                }
            }
        }