private void GenerateWorkFlow(string sourceFileName) { tempFiles = new List <string>(); var sourceType = sourceFileName.RetrieveExtension(); string tmp = sourceFileName; Actions = new List <MusicService>(); string mixWavInFile = string.Empty; string mixWavOutFile = string.Empty; if (sourceType == XFileType.Wma) { var wmaToMp3File = tmp.GenerateGuidPath(XFileType.Mp3, ConvertionKey); Actions.Add(new MusicService(tmp, wmaToMp3File, XActionType.Convertion)); sourceType = XFileType.Mp3; tmp = wmaToMp3File; tempFiles.Add(wmaToMp3File); } if (sourceType == XFileType.Mp3) { var mp3ToWaveFile = tmp.GenerateGuidPath(XFileType.Wav, ConvertionKey); Actions.Add(new MusicService(tmp, mp3ToWaveFile, XActionType.Convertion)); mixWavInFile = mp3ToWaveFile; tempFiles.Add(mp3ToWaveFile); } if (sourceType == XFileType.Wav) { mixWavInFile = sourceFileName; } mixWavOutFile = mixWavInFile.GenerateOutPutPath(TempoKey); var mixJob = new MusicService(mixWavInFile, mixWavOutFile, XActionType.TempoAdjustment); if (this.TempoDelta.HasValue) { mixJob.TempoDelta = TempoDelta.Value; mixJob.PitchDelta = this.PitchDelta ?? TempoDelta.Value / 10; } Actions.Add(mixJob); if (sourceType != XFileType.Wav) { tempFiles.Add(mixWavInFile); } tempFiles.Add(mixWavOutFile); var finalFile = sourceFileName.GenerateOutPutPath(XFileType.Mp3, ConvertionKey); Actions.Add(new MusicService(mixWavOutFile, finalFile, XActionType.Convertion)); }
private void Log(MusicService job) { string msg = string.Empty; if (job.Action == XActionType.Convertion) { msg = $"Converting { job.SourceFileType.ToString()} To { job.DestinationFileType.ToString() }"; } if (job.Action == XActionType.TempoAdjustment) { msg = $"Processing Tempo Adjustment ...."; } if (totalFiles > 1) { msg = $"Processing ({currentFileIndex}) Out Of ({totalFiles}) : {msg}"; } XMusicLogger.AddLog(msg); }