diff view/Pane.cpp @ 1497:175770a13495

Show relative pitch if recorded
author Chris Cannam
date Thu, 15 Aug 2019 18:18:22 +0100
parents c83504eb2649
children 1819978526f9
line wrap: on
line diff
--- a/view/Pane.cpp	Wed Aug 14 10:58:24 2019 +0100
+++ b/view/Pane.cpp	Thu Aug 15 18:18:22 2019 +0100
@@ -35,6 +35,7 @@
 
 //!!! ugh
 #include "data/model/WaveFileModel.h"
+#include "data/model/AlignmentModel.h"
 
 #include <QPaintEvent>
 #include <QPainter>
@@ -834,10 +835,19 @@
         text = tr("Unaligned");
     } else {
         completion = model->getAlignmentCompletion();
+        int relativePitch = 0;
+        if (auto alignmentModel =
+            ModelById::getAs<AlignmentModel>(model->getAlignment())) {
+            relativePitch = alignmentModel->getRelativePitch();
+        }
         if (completion == 0) {
             text = tr("Unaligned");
         } else if (completion < 100) {
             text = tr("Aligning: %1%").arg(completion);
+        } else if (relativePitch < 0) {
+            text = tr("Aligned at -%1 cents").arg(-relativePitch);
+        } else if (relativePitch > 0) {
+            text = tr("Aligned at +%1 cents").arg(relativePitch);
         } else {
             text = tr("Aligned");
         }