diff --git a/src/AudioAnalysisTools/Events/Drawing/EventDrawer.cs b/src/AudioAnalysisTools/Events/Drawing/EventDrawer.cs
index fc8481447..6162f709a 100644
--- a/src/AudioAnalysisTools/Events/Drawing/EventDrawer.cs
+++ b/src/AudioAnalysisTools/Events/Drawing/EventDrawer.cs
@@ -19,7 +19,7 @@ public static class EventDrawer
///
/// The event for which to draw the score indicator.
/// The image context to draw to.
- /// The event rendering optons to use.
+ /// The event rendering options to use.
public static void DrawScoreIndicator(this SpectralEvent @event, IImageProcessingContext graphics, EventRenderingOptions options)
{
if (!options.DrawScore)
@@ -27,21 +27,24 @@ public static void DrawScoreIndicator(this SpectralEvent @event, IImageProcessin
return;
}
- var normalisedScore = @event.ScoreNormalized.Clamp(0, 1);
+ var normalizedScore = @event.ScoreNormalized.Clamp(0, 1);
- if (normalisedScore == 0)
+ if (normalizedScore == 0 || double.IsNaN(normalizedScore))
{
return;
}
var rect = options.Converters.GetPixelRectangle(@event);
- var scaledHeight = (float)normalisedScore * rect.Height;
+ // truncate score bar to neatest whole pixel after scaling by height
+ var scaledHeight = (int)((float)normalizedScore * rect.Height);
- graphics.NoAA().DrawLines(
- options.Score,
- new PointF(rect.Left, rect.Bottom - 1), // minus one is to bring bottom of score line within event frame.
- new PointF(rect.Left, rect.Bottom - scaledHeight));
+ var top = new PointF(rect.Left, rect.Bottom - scaledHeight);
+ var bottom = new PointF(rect.Left, rect.Bottom);
+
+ // the order of the supplied points is important!
+ // DO NOT CHANGE
+ graphics.NoAA().DrawLines(options.Score, top, bottom);
}
public static void DrawEventLabel(this SpectralEvent @event, IImageProcessingContext graphics, EventRenderingOptions options)
diff --git a/src/AudioAnalysisTools/Events/Drawing/EventRenderingOptions.cs b/src/AudioAnalysisTools/Events/Drawing/EventRenderingOptions.cs
index 53e40801d..cc4b5cda1 100644
--- a/src/AudioAnalysisTools/Events/Drawing/EventRenderingOptions.cs
+++ b/src/AudioAnalysisTools/Events/Drawing/EventRenderingOptions.cs
@@ -73,9 +73,7 @@ public EventRenderingOptions(UnitConverters converters)
public bool DrawScore { get; set; } = true;
- ///
- /// TODO Set this false for present time because text not drawing well.
- ///
+ // TODO: Renable. Currently set to false because text not drawing well.
public bool DrawLabel { get; set; } = false;
}
}
\ No newline at end of file
diff --git a/src/AudioAnalysisTools/Events/Interfaces/IPointData.cs b/src/AudioAnalysisTools/Events/Interfaces/IPointData.cs
index 82d4b6d9b..ef2e22b71 100644
--- a/src/AudioAnalysisTools/Events/Interfaces/IPointData.cs
+++ b/src/AudioAnalysisTools/Events/Interfaces/IPointData.cs
@@ -80,13 +80,6 @@ public void DrawPointsAsFillExperiment(IImageProcessingContext graphics, EventRe
foreach (var rect in rects)
{
graphics.Fill(
- //new GraphicsOptions()
- //{
- // BlendPercentage = 0.8f,
-
- // //ColorBlendingMode = PixelColorBlendingMode.Multiply,
- // ColorBlendingMode = PixelColorBlendingMode.Overlay,
- //},
options.FillOptions,
options.Fill,
rect);
@@ -99,9 +92,11 @@ public void DrawPointsAsPath(IImageProcessingContext graphics, EventRenderingOpt
{
return;
}
+
// visits each point once
// assumes each point pair describes a line
- // assumes a SortedSet is used (and that iteration order is signficant, unlike with HashSet)
+ // assumes a SortedSet is used (and that iteration order is significant,
+ // unlike with HashSet)
// TODO: maybe add an orderby?
var path = this
.Points
diff --git a/src/AudioAnalysisTools/Scales/LinearScale.cs b/src/AudioAnalysisTools/Scales/LinearScale.cs
index d5d4263e8..7f06cb1a2 100644
--- a/src/AudioAnalysisTools/Scales/LinearScale.cs
+++ b/src/AudioAnalysisTools/Scales/LinearScale.cs
@@ -22,10 +22,10 @@ public class LinearScale
///
/// Initializes a new instance of the class.
///
- ///
+ ///
/// Should be able to handle mapping a domain where x1 ≤ x < x2
/// to a range where y1 > y ≥ y2 (an inverted mapping).
- ///
+ ///
/// The range to consider the domain (the input).
/// The range to consider the range (the output).
public LinearScale((double Low, double High) domain, (double Low, double High) range)
@@ -82,7 +82,7 @@ public double ToMagnitude(double xMagnitude)
/// The equivalent domain value.
public double From(double y)
{
- // TODO: optimised implementation is possible
+ // TODO: optimized implementation is possible
var normal = (y - this.r1) / this.rd;
var d = (normal * this.dd) + this.d1;
return this.clamp ? d.Clamp(this.d1, this.d2) : d;
diff --git a/src/AudioAnalysisTools/Tracks/ForwardTrackAlgorithm.cs b/src/AudioAnalysisTools/Tracks/ForwardTrackAlgorithm.cs
index 2456e35c7..fc7002a1e 100644
--- a/src/AudioAnalysisTools/Tracks/ForwardTrackAlgorithm.cs
+++ b/src/AudioAnalysisTools/Tracks/ForwardTrackAlgorithm.cs
@@ -160,7 +160,7 @@ public static List