static void Main(string[] args) { AudioConverter audioConverter = new AudioConverter(); VideoConverter imageConverter = new VideoConverter(); audioConverter.Convert("file1", "wav", "Mp3"); audioConverter.Convert("file2", "wav", "Ogg"); imageConverter.Convert("file3", "gif", "Jpg"); imageConverter.Convert("file4", "gif", "Png"); }
public override void Write(byte[] buffer, int offset, int count) { float gain = this.InputGain != 0f ? (float)Math.Pow(10, this.InputGain / 20f) : 1f; WavProcess.ApplyGain(gain, buffer, count); if (offset != 0) { throw new ArgumentException("Offsets are not supported."); } count = _encoder.Convert(buffer, count, buffer); base.Write(buffer, offset, count); }
public override int Read(byte[] buffer, int offset, int count) { Array.Clear(buffer, 0, count); var packet = this.Dequeue(); if (packet != null) { count = _decoder.Convert(packet.Data, packet.Data.Length, buffer); packet.Dispose(); float gain = this.Gain != 0f ? (float)Math.Pow(10, this.Gain / 20f) : 1f; WavProcess.ApplyGain(gain, buffer, count); } return(count); }
public override void Write(byte[] buffer, int offset, int count) { float gain = this.Gain != 0f ? (float)Math.Pow(10, this.Gain / 20f) : 1f; this.Level = WavProcess.ApplyGain(gain, buffer, count); if (_client != null) { count = _encoder.Convert(buffer, count, buffer); if (count >= _client.PayloadSize && (_predicate == null || _predicate())) { _client.Send(_timeStamp, buffer); } } _timeStamp += _codec.SamplesPerPacket; }
public void Complete() { Stop(); var converterOutputPath = DownloadPathConfigurator.Configure(OutputDirectory, AudioConverter.TargetFileExtension, Track); if (AudioConverter != null) { AudioConverter.Convert(_DownloadFilePath, converterOutputPath); } if (AudioFileDescriptor != null) { AudioFileDescriptor.Write(Mp3MetaData, (AudioConverter != null) ? converterOutputPath : _DownloadFilePath); } Finish(); }
public static int Main(string[] args) { var rootcmd = new RootCommand("Audiobookbuilder") { new Option <DirectoryInfo>("--d", () => new DirectoryInfo(Directory.GetCurrentDirectory()), "directory"), new Option <bool>("--r", "Create audiobooks recursivly") }; rootcmd.Handler = CommandHandler.Create <DirectoryInfo, bool>((d, r) => { var folders = new List <DirectoryInfo>(); if (r) { folders.AddRange(d.EnumerateDirectories("*", SearchOption.AllDirectories)); } else { folders.Add(d); } Parallel.ForEach(folders, folder => { Console.WriteLine($"Begin Convert {folder.Name}"); var result = AudioConverter.Convert(folder); if (result == null) { Console.WriteLine($"Nothing to do for folder: {folder.Name}"); } else { Console.WriteLine($"Convert Done for: {folder.Name} Created File {result.Name}"); } }); }); return(rootcmd.InvokeAsync(args).Result); }
public AudioBookBuilderViewModel() { OuputFileItem = new OuputFileItem(); _audioConverter = new AudioConverter(); _audioConverter.OnConvert += _audioConverter_OnConvert; FileItems = new ObservableCollection <InputFileItem>(); ConvertCommand = new RelayCommand <ObservableCollection <InputFileItem> >(o => _audioConverter.Convert(o), o => !IsBusy && o?.Any() == true); AbortCommand = new RelayCommand <object>(o => _audioConverter.Abort(), o => IsBusy); }