public bool IsCurrentSelectionGreaterThan(IScriptableApp app, double minimumLengthInSeconds) { ISfDataWnd window = _file.Window; double selectionLengthSeconds = _file.PositionToSeconds(window.Selection.Length); return(selectionLengthSeconds >= minimumLengthInSeconds); }
public void DumpToScriptWindow() { _output.ToScriptWindow("Found {0} tracks:", Count); foreach (SplitTrackDefinition track in this) { _output.ToScriptWindow("{0}:\t{1}\t{2}\t(Start fade @ {3})", track.Number, OutputHelper.FormatToTimeSpan(_file.PositionToSeconds(track.TrackRegion.Start)), OutputHelper.FormatToTimeSpan(_file.PositionToSeconds(track.GetSelectionWithFades().Length)), OutputHelper.FormatToTimeSpan(_file.PositionToSeconds(track.FadeOutStartPosition))); } _output.LineBreakToScriptWindow(); }
private TrackList FindTracks(IScriptableApp app, ISfFileHost file) { _vinylRipOptions.Validate(); ScriptTimer.Reset(); List <ScanResult> results = DoFirstPassStatisticsScan(); TrackList tracks = new TrackList(_vinylRipOptions, file); int trackCount = 1; bool currentResultIsTrack = false; foreach (ScanResult scanResult in results) { if (scanResult.RmsLevelExceeds(_vinylRipOptions.GapNoisefloorThresholdInDecibels)) { //Output.ToScriptWindow("{0} above threshold", scanResult.WindowNumber); if (!currentResultIsTrack && tracks.CanAddNextTrack(scanResult.SelectionStart)) { tracks.AddNew(); tracks.LastAdded.StartPosition = scanResult.SelectionStart; tracks.LastAdded.Number = trackCount++; currentResultIsTrack = true; } tracks.LastAdded.EndPosition = scanResult.SelectionEnd; } else if (tracks.CanSetTrackBreak()) { currentResultIsTrack = false; } Output.ToScriptWindow("{0}\t{1}\t{2}\t{3}", scanResult.WindowNumber, OutputHelper.FormatToTimeSpan(file.PositionToSeconds(scanResult.SelectionStart)), OutputHelper.FormatToTimeSpan(file.PositionToSeconds(scanResult.SelectionEnd)), scanResult.GetMaxRmsLevel()); } Output.ToScriptWindow("FindTracks Finished scanning:\r\n- Scanned: {0} windows\r\n- Window Length: {1}s\r\n- Scan Duration: {2}", results.Count, _vinylRipOptions.ScanWindowLengthInSeconds, ScriptTimer.Time()); Output.LineBreakToScriptWindow(); OutputTrackDetails(tracks); ScriptTimer.Reset(); RefineTrackDefinitionsByScanning(tracks); Output.LineBreakToScriptWindow(); Output.ToScriptWindow("RefineTrackDefinitionsByScanning Finished scanning:\r\n- Scan Duration: {0}", ScriptTimer.Time()); Output.LineBreakToScriptWindow(); OutputTrackDetails(tracks); return(tracks); }
public bool CanSetTrackBreak() { if (LastAdded == null) { return(true); } // would track length be too short ? return(_file.PositionToSeconds(LastAdded.Length) >= _vinylRipOptions.MinimumTrackLengthInSeconds); }
private void OutputTrackDetails(TrackList tracks) { foreach (TrackDefinition track in tracks) { Output.ToScriptWindow("Track {0}\t{1}\t{2}", track.Number, OutputHelper.FormatToTimeSpan(_file.PositionToSeconds(track.StartPosition)), OutputHelper.FormatToTimeSpan(_file.PositionToSeconds(track.EndPosition)) ); } Output.LineBreakToScriptWindow(); }