/// <summary> /// Saves a shortened version the specified sample as a mono wave in the Scratch folder and launches Scratch /// </summary> /// <param name="sample">The sample.</param> public static void LaunchShort(Sample sample) { if (_applicationFolder == "") { return; } SilenceHelper.GenerateSilenceAudioFile(GetSilenceFilename()); SaveSample(sample); var bpm = BpmHelper.GetBpmFromLoopLength(sample.LengthSeconds); var loopLength = BpmHelper.GetDefaultLoopLength(bpm); var shortLength = loopLength / 8; if (shortLength > sample.LengthSeconds) { shortLength = sample.LengthSeconds; } var gain = GetGain(sample.Filename); var scratchFilePath = Path.Combine(_applicationFolder, ScratchFile); AudioExportHelper.SaveAsMonoWave(sample.Filename, scratchFilePath, shortLength, gain); var scratchExePath = Path.Combine(_applicationFolder, ScratchExe); Process.Start(scratchExePath); }
/// <summary> /// Saves the specified sample as a mono wave in the Scratch folder and launches Scratch /// </summary> /// <param name="sample">The sample.</param> public static void Launch(Sample sample) { if (_applicationFolder == "") { return; } if (sample == null) { return; } SilenceHelper.GenerateSilenceAudioFile(GetSilenceFilename()); SaveSample(sample); var gain = GetGain(sample.Filename); var scratchFilePath = Path.Combine(_applicationFolder, ScratchFile); AudioExportHelper.SaveAsMonoWave(sample.Filename, scratchFilePath, gain); var scratchExePath = Path.Combine(_applicationFolder, ScratchExe); Process.Start(scratchExePath); }