Package: musescore2 / 2.3.2+dfsg4-16

upstream/statusline-pitch-onofftime.diff Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
Description: indicate pitch and on/off time in the status line
 - indicate sounding pitch if the global concert pitch toggle
   is off and the current instrument has an actual pitch,
   i.e. not beat/rhythm slashes or drums; this will show the
   identical pitch for nōn-transposing instruments by design
   (to show we’re currently in transposing pitch mode, but the
   current instrument is not transposing) which helps debugging
 - indicate tuning (if any) after the sounding pitch (either mode)
 - show on/off times if at least one of them is nōn-standard
 .
 The first change partially addresses node #283120.
 The on/off time was requested in node #290900#comment-927933
 (velocity is too hard, sorry about that).
Author: mirabilos <m@mirbsd.org>
Forwarded: https://github.com/musescore/MuseScore/pull/6750
Applied-Upstream: v3.6, commit:d2de6bf4f409f552f4af4b856a545ff9811c398a

--- a/libmscore/note.cpp
+++ b/libmscore/note.cpp
@@ -2660,14 +2660,33 @@ QString Note::accessibleInfoConst() cons
       QString duration = chord()->durationUserName();
       QString voice = tr("Voice: %1").arg(QString::number(track() % VOICES + 1));
       QString pitchName;
+      QString pitchOffset;
+      QString onofftime;
+      if (!_playEvents.empty()) {
+            int on = _playEvents[0].ontime();
+            int off = _playEvents[0].offtime();
+            if (on != 0 || off != 1000)
+                  onofftime = tr(" (on %1‰ off %2‰)").arg(on).arg(off);
+            }
       const Drumset* drumset = part()->instrument()->drumset();
       if (fixed() && headGroup() == NoteHead::Group::HEAD_SLASH)
             pitchName = chord()->noStem() ? tr("Beat Slash") : tr("Rhythm Slash");
       else if (staff()->isDrumStaff() && drumset)
             pitchName = qApp->translate("drumset", drumset->name(pitch()).toUtf8().constData());
-      else
+      else {
             pitchName = tpcUserName(false);
-      return tr("%1; Pitch: %2; Duration: %3%4").arg(noteTypeUserName()).arg(pitchName).arg(duration).arg((chord()->isGrace() ? "" : QString("; %1").arg(voice)));
+            if (tuning() != 0)
+                  pitchOffset.sprintf("%+.3f", tuning());
+            if (tuning() != 0)
+                  pitchOffset.sprintf("%+.3f", tuning());
+            if (!concertPitch()) {
+                  // tpcUserName equivalent for getting the sounding pitch
+                  QString soundingPitch = tpc2name(_tpc[0], NoteSpellingType::STANDARD, NoteCaseType::AUTO, false) + QString::number(((_pitch + ottaveCapoFret() - int(tpc2alter(tpc()))) / 12) - 1);
+                  // almost the same string as below
+                  return tr("%1; Pitch: %2 (sounding as %3%4); Duration: %5%6%7").arg(noteTypeUserName()).arg(pitchName).arg(soundingPitch).arg(pitchOffset).arg(duration).arg(onofftime).arg((chord()->isGrace() ? "" : QString("; %1").arg(voice)));
+                  }
+            }
+      return tr("%1; Pitch: %2%3; Duration: %4%5%6").arg(noteTypeUserName()).arg(pitchName).arg(pitchOffset).arg(duration).arg(onofftime).arg((chord()->isGrace() ? "" : QString("; %1").arg(voice)));
       }
 
 QString Note::accessibleInfo()