a910cb080bf6f528172bad951613473bdca05f70
[alioth/musescore.git] / debian / patches / experiments / statusline-velocity-onoff.diff
1 # DP: https://musescore.org/en/node/290900#comment-927933
2 # DP: requested velocity, on time, off time
3 # DP: but velocity is hard (needs full rendermidi)
4 # DP: this does tuning, on/off time
5
6 --- a/libmscore/note.cpp
7 +++ b/libmscore/note.cpp
8 @@ -2766,21 +2766,31 @@ QString Note::accessibleInfo() const
9        QString duration = chord()->durationUserName();
10        QString voice = QObject::tr("Voice: %1").arg(QString::number(track() % VOICES + 1));
11        QString pitchName;
12 +      QString pitchOffset;
13 +      QString onofftime;
14 +      if (!_playEvents.empty()) {
15 +            int on = _playEvents[0].ontime();
16 +            int off = _playEvents[0].offtime();
17 +            if (on != 0 || off != NoteEvent::NOTE_LENGTH)
18 +                  onofftime = QObject::tr(" (on %1‰ off %2‰)").arg(on).arg(off);
19 +            }
20        const Drumset* drumset = part()->instrument()->drumset();
21        if (fixed() && headGroup() == NoteHead::Group::HEAD_SLASH)
22              pitchName = chord()->noStem() ? QObject::tr("Beat slash") : QObject::tr("Rhythm slash");
23        else if (staff()->isDrumStaff(tick()) && drumset)
24              pitchName = qApp->translate("drumset", drumset->name(pitch()).toUtf8().constData());
25 -      else if (!concertPitch()) {
26 +      else {
27              pitchName = tpcUserName(false);
28 -            // tpcUserName equivalent for getting the sounding pitch
29 -            QString soundingPitch = propertyUserValue(Pid::TPC1) + QString::number(((_pitch + ottaveCapoFret() - int(tpc2alter(tpc()))) / 12) - 1);
30 -            // almost the same string as below
31 -            return QObject::tr("%1; Pitch: %2 (sounding as %3); Duration: %4%5").arg(noteTypeUserName()).arg(pitchName).arg(soundingPitch).arg(duration).arg((chord()->isGrace() ? "" : QString("; %1").arg(voice)));
32 +            if (tuning() != 0)
33 +                  pitchOffset = QString::asprintf("%+.3f", tuning());
34 +            if (!concertPitch()) {
35 +                  // tpcUserName equivalent for getting the sounding pitch
36 +                  QString soundingPitch = propertyUserValue(Pid::TPC1) + QString::number(((_pitch + ottaveCapoFret() - int(tpc2alter(tpc()))) / 12) - 1);
37 +                  // almost the same string as below
38 +                  return QObject::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)));
39 +                  }
40              }
41 -      else
42 -            pitchName = tpcUserName(false);
43 -      return QObject::tr("%1; Pitch: %2; Duration: %3%4").arg(noteTypeUserName()).arg(pitchName).arg(duration).arg((chord()->isGrace() ? "" : QString("; %1").arg(voice)));
44 +      return QObject::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)));
45        }
46  
47  //---------------------------------------------------------