fix the barbeat counting issue
authormirabilos <tg@debian.org>
Mon, 3 Jun 2019 15:50:47 +0000 (17:50 +0200)
committermirabilos <mirabilos@evolvis.org>
Mon, 3 Jun 2019 15:50:47 +0000 (17:50 +0200)
debian/changelog
debian/patches/experiments/element-barbeat.diff

index 75277db..18cb957 100644 (file)
@@ -5,8 +5,9 @@ musescore2 (2.3.2+dfsg3-2) wtf; urgency=medium
   * Streamline and (slightly) optimise debian/rules
   * Build under the C.UTF-8 locale
   * Add patch to show two pitches (in transposing mode) in status line
+  * Pull upstream commit to fix barbeat counting from 3.1
 
- -- Thorsten Glaser <tg@mirbsd.de>  Mon, 03 Jun 2019 00:57:49 +0200
+ -- Thorsten Glaser <tg@mirbsd.de>  Mon, 03 Jun 2019 17:49:49 +0200
 
 musescore2 (2.3.2+dfsg3-1) wtf; urgency=low
 
index 25c708e..6c81840 100644 (file)
@@ -3,12 +3,23 @@ Description: Add Element::barbeat() and Element::accessibleBarbeat()
  within the score, generally; used by experiments/log-collisions.diff
  .
  Also fix some screenreader label mistakes.
+ .
+ For pre-3.1, backports commit 29cd62df329525da59d01a54796171076acc9eb1
+ from upstream, to fix bad barbeat counting in cut time.
 Author: mirabilos <m@mirbsd.org>
 Forwarded: https://github.com/musescore/MuseScore/pull/5096
 
 --- a/libmscore/element.cpp
 +++ b/libmscore/element.cpp
-@@ -1998,4 +1998,51 @@ bool Element::isUserModified() const
+@@ -60,6 +60,7 @@
+ #include "rest.h"
+ #include "score.h"
+ #include "segment.h"
++#include "sig.h"
+ #include "slur.h"
+ #include "spacer.h"
+ #include "staff.h"
+@@ -1998,4 +1999,53 @@ bool Element::isUserModified() const
        return !visible() || !userOff().isNull() || (color() != MScore::defaultColor);
        }
  
@@ -23,6 +34,7 @@ Forwarded: https://github.com/musescore/MuseScore/pull/5096
 +      int ticks = 0;
 +      TimeSigMap* tsm = this->score()->sigmap();
 +      const Element* p = this;
++      int ticksB = ticks_beat(tsm->timesig(0).timesig().denominator());
 +      while(p && p->type() != Element::Type::SEGMENT && p->type() != Element::Type::MEASURE)
 +            p = p->parent();
 +
@@ -32,6 +44,7 @@ Forwarded: https://github.com/musescore/MuseScore/pull/5096
 +      else if (p->type() == Element::Type::SEGMENT) {
 +            const Segment* seg = static_cast<const Segment*>(p);
 +            tsm->tickValues(seg->tick(), &bar, &beat, &ticks);
++            ticksB = ticks_beat(tsm->timesig(seg->tick().ticks()).timesig().denominator());
 +            }
 +      else if (p->type() == Element::Type::MEASURE) {
 +            const Measure* m = static_cast<const Measure*>(p);
@@ -39,7 +52,7 @@ Forwarded: https://github.com/musescore/MuseScore/pull/5096
 +            beat = -1;
 +            ticks = 0;
 +            }
-+      return std::pair<int,float>(bar + 1, beat + 1 + ticks / static_cast<float>(MScore::division));
++      return std::pair<int,float>(bar + 1, beat + 1 + ticks / static_cast<float>(ticksB));
 +      }
 +
 +//---------------------------------------------------------
@@ -71,6 +84,28 @@ Forwarded: https://github.com/musescore/MuseScore/pull/5096
  
        bool selected() const                   { return _selected;   }
        virtual void setSelected(bool f)        { _selected = f;      }
+--- a/libmscore/sig.cpp
++++ b/libmscore/sig.cpp
+@@ -19,7 +19,7 @@ namespace Ms {
+ //   ticks_beat
+ //---------------------------------------------------------
+-static int ticks_beat(int n)
++int ticks_beat(int n)
+       {
+       int m = (MScore::division * 4) / n;
+       if ((MScore::division * 4) % n) {
+--- a/libmscore/sig.h
++++ b/libmscore/sig.h
+@@ -21,6 +21,8 @@ namespace Ms {
+ class Xml;
+ class XmlReader;
++int ticks_beat(int n);
++
+ //-------------------------------------------------------------------
+ //   BeatType
+ //-------------------------------------------------------------------
 --- a/mscore/scoreaccessibility.cpp
 +++ b/mscore/scoreaccessibility.cpp
 @@ -110,8 +110,8 @@ void ScoreAccessibility::currentInfoChan