comparison 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
comparison
equal deleted inserted replaced
1496:d09345e578a7 1497:175770a13495
33 #include "layer/FlexiNoteLayer.h" 33 #include "layer/FlexiNoteLayer.h"
34 34
35 35
36 //!!! ugh 36 //!!! ugh
37 #include "data/model/WaveFileModel.h" 37 #include "data/model/WaveFileModel.h"
38 #include "data/model/AlignmentModel.h"
38 39
39 #include <QPaintEvent> 40 #include <QPaintEvent>
40 #include <QPainter> 41 #include <QPainter>
41 #include <QBitmap> 42 #include <QBitmap>
42 #include <QDragEnterEvent> 43 #include <QDragEnterEvent>
832 text = tr("Reference"); 833 text = tr("Reference");
833 } else if (reference.isNone()) { 834 } else if (reference.isNone()) {
834 text = tr("Unaligned"); 835 text = tr("Unaligned");
835 } else { 836 } else {
836 completion = model->getAlignmentCompletion(); 837 completion = model->getAlignmentCompletion();
838 int relativePitch = 0;
839 if (auto alignmentModel =
840 ModelById::getAs<AlignmentModel>(model->getAlignment())) {
841 relativePitch = alignmentModel->getRelativePitch();
842 }
837 if (completion == 0) { 843 if (completion == 0) {
838 text = tr("Unaligned"); 844 text = tr("Unaligned");
839 } else if (completion < 100) { 845 } else if (completion < 100) {
840 text = tr("Aligning: %1%").arg(completion); 846 text = tr("Aligning: %1%").arg(completion);
847 } else if (relativePitch < 0) {
848 text = tr("Aligned at -%1 cents").arg(-relativePitch);
849 } else if (relativePitch > 0) {
850 text = tr("Aligned at +%1 cents").arg(relativePitch);
841 } else { 851 } else {
842 text = tr("Aligned"); 852 text = tr("Aligned");
843 } 853 }
844 } 854 }
845 855