/// <summary> /// 处理伴奏 /// </summary> /// <param name="Path">文件列表</param> private void CodingStartMusic(object Path) { invalid = false; max_volume = null; string CMD; string Folder = Path.ToString().Substring(0, Path.ToString().LastIndexOf("\\") + 1); string FileName = Path.ToString().Substring(Path.ToString().LastIndexOf("\\") + 1); if (FileName.LastIndexOf(".") != -1) { FileName = FileName.Substring(0, FileName.LastIndexOf(".")); } CMD = "cd \"" + Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\AFPT\" && .\\Bin\\ffmpeg -i \"" + Path + "\" -vn -sn -af \"volumedetect\" -f null null"; OutputReceived("Command - " + CMD); CreateProcess("cmd.exe", "/c " + CMD); //info double?volume = 0 - max_volume - 6; CMD = "cd \"" + Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\AFPT\" && .\\Bin\\ffmpeg -y -i \"" + Path + "\" -vn -sn -ar " + SR + " -af \"volume=" + volume + "dB\" -c:a pcm_s16le -f wav \"" + Folder + "AFPT_" + FileName + "_S.wav\""; OutputReceived("Command - " + CMD); CreateProcess("cmd.exe", "/c " + CMD); //coding FileFinished?.Invoke(Folder + "AFPT_" + FileName + "_S.wav"); }
/// <summary> /// 处理成品 /// </summary> /// <param name="Path">文件路径列表</param> private void CodingStartMixed(object Path) { invalid = false; max_volume = null; string CMD; string Folder = Path.ToString().Substring(0, Path.ToString().LastIndexOf("\\") + 1); string FileName = Path.ToString().Substring(Path.ToString().LastIndexOf("\\") + 1); string Extension = string.Empty; if (FileName.LastIndexOf(".") != -1) { Extension = FileName.Substring(FileName.LastIndexOf(".") + 1); FileName = FileName.Substring(0, FileName.LastIndexOf(".")); } string OutFilePath = Folder + FileName + "." + FM; int i = 1; while (File.Exists(OutFilePath)) { OutFilePath = Folder + FileName + " (" + i + ")." + FM; i++; } if (FM.ToUpper() == "MP3") { CMD = "cd \"" + Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\AFPT\" && .\\Bin\\ffmpeg -y -i \"" + Path + "\" -vn -sn -ar " + SR + " -c:a pcm_s16le -f wav pipe: | .\\bin\\lame -b " + CR + " -p - \"" + OutFilePath + "\""; } else { CMD = "cd \"" + Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\AFPT\" && .\\Bin\\ffmpeg -y -i \"" + Path + "\" -vn -sn -ar " + SR + " -c:a pcm_s16le -f wav pipe: | .\\bin\\neroAacEnc -ignorelength -cbr " + CR * 1000 + " -if - -of \"" + OutFilePath + "\""; } OutputReceived("Command - " + CMD); CreateProcess("cmd.exe", "/c " + CMD); //coding FileFinished?.Invoke(Folder + FileName + "." + FM); }
protected virtual void OnFileFinished() { FileFinished?.Invoke(this); }