double CalculateDuration() { var discreteDuration = new DiscreteTime(0); foreach (var track in flattenedTracks) { if (track.muted) { continue; } discreteDuration = DiscreteTime.Max(discreteDuration, (DiscreteTime)track.end); } if (discreteDuration <= 0) { return(0.0); } //avoid having no clip evaluated at the end by removing a tick from the total duration return((double)discreteDuration.OneTickBefore()); }
private double CalculateDuration() { IEnumerable <TrackAsset> flattenedTracks = this.flattenedTracks; DiscreteTime lhs = new DiscreteTime(0); foreach (TrackAsset trackAsset in flattenedTracks) { if (!trackAsset.muted) { lhs = DiscreteTime.Max(lhs, (DiscreteTime)trackAsset.end); } } double result; if (lhs <= 0) { result = 0.0; } else { result = (double)lhs.OneTickBefore(); } return(result); }