internal void LoadDeck(int row) { CUEConfig _config = (MdiParent as frmCUEPlayer).Config; DataSet1 dataSet = (MdiParent as frmCUEPlayer).DataSet; Playlist playlist = (MdiParent as frmCUEPlayer).wndPlaylist; string path = dataSet.Playlist[row].path; int track = dataSet.Playlist[row].track; try { playingCue = new CUESheet(_config); playingCue.Open(path); playingSource = new CUESheetAudio(playingCue); playingSource.Position = (long)playingCue.TOC[track].Start * 588; playingSource = new AudioPipe(playingSource, 0x2000); playingStart = playingSource.Position; playingFinish = playingStart + (long)playingCue.TOC[track].Length * 588; playingRow = row; //playlist.List.Items[playingRow].BackColor = Color.AliceBlue; needUpdate = true; UpdateDeck(); } catch (Exception ex) { playingStart = playingFinish = 0; playingCue = null; playingSource = null; return; } }
public frmCUEPlayer() { InitializeComponent(); _icon_mgr = new ShellIconMgr(); _config = new CUEConfig(); _config.separateDecodingThread = false; }
public void Init(frmCUEPlayer parent) { _config = parent.Config; MdiParent = parent; Show(); fileSystemTreeView1.IconManager = parent.IconMgr; fileSystemTreeView1.SelectedFolder = ExtraSpecialFolder.MyMusic; }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); string arch = Marshal.SizeOf(typeof(IntPtr)) == 8 ? "x64" : "win32"; GetSatelliteAssemblies(System.IO.Path.Combine("plugins", arch)); CUEConfig config = new CUEConfig(); config.Load(new SettingsReader("CUERipper", "settings.txt", Application.ExecutablePath)); try { Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo(config.language); } catch { } Application.Run(new frmCUERipper()); }
public void Init(frmCUEPlayer parent) { _config = parent.Config; dataSet = parent.DataSet; MdiParent = parent; Show(); _icon_mgr = parent.IconMgr; listViewTracks.SmallImageList = _icon_mgr.ImageList; foreach (DataSet1.PlaylistRow row in dataSet.Playlist) { try { listViewTracks.Items.Add(ToItem(row)); } catch (Exception ex) { Trace.WriteLine(ex.Message); } } }
static void Main(string[] args) { if (args.Length > 1 && args[0].Length > 1 && args[0][0] == '/') { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); frmBatch batch = new frmBatch(); batch.Profile = args[0].Substring(1); if (args.Length == 2 && args[1][0] != '@') { batch.InputPath = args[1]; } else { for (int i = 1; i < args.Length; i++) { if (args[i][0] == '@') { string lineStr; StreamReader sr; try { sr = new StreamReader(args[i].Substring(1), Encoding.Default); while ((lineStr = sr.ReadLine()) != null) { batch.AddInputPath(lineStr); } } catch { batch.AddInputPath(args[i]); } } else { batch.AddInputPath(args[i]); } } } Application.Run(batch); return; } string myId = "BZ92759C-63Q7-444e-ADA6-E495634A493D"; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); CUEConfig config = new CUEConfig(); config.Load(new SettingsReader("CUE Tools", "settingsTEST.txt", Application.ExecutablePath)); try { Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo(config.language); } catch { } frmCUETools form = new frmCUETools(); if (!config.oneInstance || SingletonController.IamFirst(myId, new SingletonController.ReceiveDelegate(form.OnSecondCall))) { if (args.Length == 1) { form.InputPath = args[0]; } Application.Run(form); } else { List <string> newArgs = new List <string>(); foreach (string arg in args) { newArgs.Add(Path.GetFullPath(arg)); } SingletonController.Send(myId, newArgs.ToArray()); } SingletonController.Cleanup(); }
public CUERipperSettings(CUEConfig config) { this.config = config; }
static int Main(string[] args) { bool ok = true; bool verbose = false; string pathIn = null; for (int arg = 0; arg < args.Length; arg++) { if (args[arg].Length == 0) { ok = false; } else if ((args[arg] == "-v" || args[arg] == "--verbose")) { verbose = true; } else if (args[arg][0] != '-' && pathIn == null) { pathIn = args[arg]; } else { ok = false; } if (!ok) { break; } } if (!ok || pathIn == null) { Console.SetOut(Console.Error); Console.WriteLine("Usage : CUETools.ARCUE.exe [options] <filename>"); Console.WriteLine(); Console.WriteLine("Options:"); Console.WriteLine(); Console.WriteLine(" -v --verbose Verbose mode"); return(1); } if (!File.Exists(pathIn)) { Console.SetOut(Console.Error); Console.WriteLine("Input CUE Sheet not found."); return(2); } CUEConfig config = new CUEConfig(); config.writeArLogOnVerify = false; config.writeArTagsOnVerify = false; config.autoCorrectFilenames = true; config.extractAlbumArt = false; config.embedAlbumArt = false; config.advanced.DetailedCTDBLog = verbose; string accurateRipLog; try { CUESheet cueSheet = new CUESheet(config); cueSheet.Action = CUEAction.Verify; //cueSheet.OutputStyle = CUEStyle.SingleFile; cueSheet.Open(pathIn); cueSheet.UseAccurateRip(); cueSheet.UseCUEToolsDB("ARCUE " + CUESheet.CUEToolsVersion, null, true, CTDBMetadataSearch.None); cueSheet.GenerateFilenames(AudioEncoderType.NoAudio, "dummy", pathIn); cueSheet.Go(); accurateRipLog = CUESheetLogWriter.GetAccurateRipLog(cueSheet); } catch (Exception ex) { Console.WriteLine("Error: " + ex.Message); return(3); } Console.Write(accurateRipLog); return(0); }
static int Main(string[] args) { bool ok = true; string sourceFile = null, destFile = null; int padding = 8192; string encoderMode = null; string decoderName = null; string encoderName = null; string encoderFormat = null; bool ignore_chunk_sizes = false; AudioEncoderType audioEncoderType = AudioEncoderType.NoAudio; for (int arg = 0; arg < args.Length; arg++) { if (args[arg].Length == 0) { ok = false; } else if (args[arg] == "--ignore-chunk-sizes") { ignore_chunk_sizes = true; } else if (args[arg] == "--decoder" && ++arg < args.Length) { decoderName = args[arg]; } else if (args[arg] == "--encoder" && ++arg < args.Length) { encoderName = args[arg]; } else if (args[arg] == "--encoder-format" && ++arg < args.Length) { encoderFormat = args[arg]; } else if ((args[arg] == "-p" || args[arg] == "--padding") && ++arg < args.Length) { ok = int.TryParse(args[arg], out padding); } else if ((args[arg] == "-m" || args[arg] == "--mode") && ++arg < args.Length) { encoderMode = args[arg]; } else if (args[arg] == "--lossy") { audioEncoderType = AudioEncoderType.Lossy; } else if (args[arg] == "--lossless") { audioEncoderType = AudioEncoderType.Lossless; } else if ((args[arg][0] != '-' || args[arg] == "-") && sourceFile == null) { sourceFile = args[arg]; } else if ((args[arg][0] != '-' || args[arg] == "-") && sourceFile != null && destFile == null) { destFile = args[arg]; } else { ok = false; } if (!ok) { break; } } Console.Error.WriteLine("CUETools.Converter, Copyright (C) 2009-2013 Grigory Chudov."); Console.Error.WriteLine("This is free software under the GNU GPLv3+ license; There is NO WARRANTY, to"); Console.Error.WriteLine("the extent permitted by law. <http://www.gnu.org/licenses/> for details."); if (!ok || sourceFile == null || destFile == null) { Usage(); return(22); } if (destFile != "-" && destFile != "nul" && File.Exists(destFile)) { Console.Error.WriteLine("Error: file already exists."); return(17); } DateTime start = DateTime.Now; TimeSpan lastPrint = TimeSpan.FromMilliseconds(0); CUEToolsCodecsConfig config = new CUEConfig(); #if !DEBUG try #endif { IAudioSource audioSource = null; IAudioDest audioDest = null; TagLib.UserDefined.AdditionalFileTypes.Config = config; TagLib.File sourceInfo = sourceFile == "-" ? null : TagLib.File.Create(new TagLib.File.LocalFileAbstraction(sourceFile)); try { audioSource = Program.GetAudioSource(config, sourceFile, decoderName, ignore_chunk_sizes); AudioBuffer buff = new AudioBuffer(audioSource, 0x10000); Console.Error.WriteLine("Filename : {0}", sourceFile); Console.Error.WriteLine("File Info : {0}kHz; {1} channel; {2} bit; {3}", audioSource.PCM.SampleRate, audioSource.PCM.ChannelCount, audioSource.PCM.BitsPerSample, TimeSpan.FromSeconds(audioSource.Length * 1.0 / audioSource.PCM.SampleRate)); CUEToolsFormat fmt; if (encoderFormat == null) { if (destFile == "-" || destFile == "nul") { encoderFormat = "wav"; } else { string extension = Path.GetExtension(destFile).ToLower(); if (!extension.StartsWith(".")) { throw new Exception("Unknown encoder format: " + destFile); } encoderFormat = extension.Substring(1); } } if (!config.formats.TryGetValue(encoderFormat, out fmt)) { throw new Exception("Unsupported encoder format: " + encoderFormat); } CUEToolsUDC encoder = audioEncoderType == AudioEncoderType.Lossless ? Program.GetEncoder(config, fmt, true, encoderName) : audioEncoderType == AudioEncoderType.Lossy ? Program.GetEncoder(config, fmt, false, encoderName) : Program.GetEncoder(config, fmt, true, encoderName) ?? Program.GetEncoder(config, fmt, false, encoderName); if (encoder == null) { var lst = new List <CUEToolsUDC>(config.encoders).FindAll( e => e.extension == fmt.extension && (audioEncoderType == AudioEncoderType.NoAudio || audioEncoderType == (e.Lossless ? AudioEncoderType.Lossless : AudioEncoderType.Lossy))). ConvertAll(e => e.Name + (e.Lossless ? " (lossless)" : " (lossy)")); throw new Exception("Encoders available for format " + fmt.extension + ": " + (lst.Count == 0 ? "none" : string.Join(", ", lst.ToArray()))); } var settings = encoder.settings.Clone(); settings.PCM = audioSource.PCM; settings.Padding = padding; settings.EncoderMode = encoderMode ?? settings.EncoderMode; object o = null; try { o = destFile == "-" ? Activator.CreateInstance(encoder.type, "", Console.OpenStandardOutput(), settings) : destFile == "nul" ? Activator.CreateInstance(encoder.type, "", new NullStream(), settings) : Activator.CreateInstance(encoder.type, destFile, settings); } catch (System.Reflection.TargetInvocationException ex) { throw ex.InnerException; } if (o == null || !(o is IAudioDest)) { throw new Exception("Unsupported audio type: " + destFile + ": " + encoder.type.FullName); } audioDest = o as IAudioDest; audioDest.FinalSampleCount = audioSource.Length; bool keepRunning = true; Console.CancelKeyPress += delegate(object sender, ConsoleCancelEventArgs e) { keepRunning = false; if (e.SpecialKey == ConsoleSpecialKey.ControlC) { e.Cancel = true; } else { audioDest.Delete(); } }; while (audioSource.Read(buff, -1) != 0) { audioDest.Write(buff); TimeSpan elapsed = DateTime.Now - start; if ((elapsed - lastPrint).TotalMilliseconds > 60) { long length = audioSource.Length; if (length < 0 && sourceInfo != null) { length = (long)(sourceInfo.Properties.Duration.TotalMilliseconds * audioSource.PCM.SampleRate / 1000); } if (length < audioSource.Position) { length = audioSource.Position; } if (length < 1) { length = 1; } Console.Error.Write("\rProgress : {0:00}%; {1:0.00}x; {2}/{3}", 100.0 * audioSource.Position / length, audioSource.Position / elapsed.TotalSeconds / audioSource.PCM.SampleRate, elapsed, TimeSpan.FromMilliseconds(elapsed.TotalMilliseconds / audioSource.Position * length) ); lastPrint = elapsed; } if (!keepRunning) { throw new Exception("Aborted"); } } TimeSpan totalElapsed = DateTime.Now - start; Console.Error.Write("\r \r"); Console.Error.WriteLine("Results : {0:0.00}x; {1}", audioSource.Position / totalElapsed.TotalSeconds / audioSource.PCM.SampleRate, totalElapsed ); } catch (Exception ex) { if (audioSource != null) { audioSource.Close(); } if (audioDest != null) { audioDest.Delete(); } throw ex; } audioSource.Close(); audioDest.Close(); if (sourceFile != "-" && destFile != "-" && destFile != "nul") { TagLib.File destInfo = TagLib.File.Create(new TagLib.File.LocalFileAbstraction(destFile)); if (Tagging.UpdateTags(destInfo, Tagging.Analyze(sourceInfo), config, false)) { sourceInfo.Tag.CopyTo(destInfo.Tag, true); destInfo.Tag.Pictures = sourceInfo.Tag.Pictures; destInfo.Save(); } } } #if !DEBUG catch (Exception ex) { Console.Error.Write("\r \r"); Console.Error.WriteLine("Error : {0}", ex.Message); return(1); //Console.WriteLine("{0}", ex.StackTrace); } #endif return(0); }