public WaveformSection(TuneDuration tuneDuration, ITimedPlayback tune, int resolution) { this.Start = new Even((int)(new FiniteDouble( // gotta be even, baby tuneDuration.StartingPoint() // this is number of seconds at which the area start / tune.TotalTime().TotalSeconds) // this is the total number of seconds - so the ratio is correct .Value() * resolution)); this.End = this.Start + (int)Math.Min(resolution, // how much are we going to cover? max is the number of points available <=> resolution resolution / tuneDuration.Zoom); // what is this if resolution == 8000 and zoom == 2, then we cover r/2 == 4000? seems like! }
/// <summary> /// Initialize with an instance of ITimedPlayback and an explicit zoom level /// </summary> public TuneDuration(ITimedPlayback tune, double zoom) : this(tune.CurrentTime().TotalSeconds, tune.TotalTime().TotalSeconds, zoom) { }