-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Don't remove outgoing ties when incrasing chord duration #32982
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1066,15 +1066,7 @@ void Score::createCRSequence(const Fraction& f, ChordRest* cr, const Fraction& t | |
| for (unsigned int i = 0; i < oc->notes().size(); ++i) { | ||
| Note* on = oc->notes()[i]; | ||
| Note* nn = nc->notes()[i]; | ||
| Tie* tie = Factory::createTie(this->dummy()); | ||
| tie->setStartNote(on); | ||
| tie->setEndNote(nn); | ||
| tie->setTick(tie->startNote()->tick()); | ||
| tie->setTick2(tie->endNote()->tick()); | ||
| tie->setTrack(cr->track()); | ||
| on->setTieFor(tie); | ||
| nn->setTieBack(tie); | ||
| undoAddElement(tie); | ||
| tieNotesTogether(on, nn); | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -1777,6 +1769,7 @@ void Score::changeCRlen(ChordRest* cr, const Fraction& dstF, bool fillWithRest) | |
| ChordRest* cr1 = cr; | ||
| Chord* oc = 0; | ||
| Segment* s = cr->segment(); | ||
| Fraction endTickBefore = cr->isChord() ? toChord(cr)->endTickIncludingTied() : cr->endTick(); | ||
|
|
||
| bool first = true; | ||
| for (const Fraction& f2 : flist) { | ||
|
|
@@ -1864,6 +1857,22 @@ void Score::changeCRlen(ChordRest* cr, const Fraction& dstF, bool fillWithRest) | |
| s = m1->first(SegmentType::ChordRest); | ||
| cr1 = toChordRest(s->element(track)); | ||
| } | ||
|
|
||
| Fraction endTickAfter = cr->isChord() ? toChord(cr)->endTickIncludingTied() : cr->endTick(); | ||
| while (endTickAfter < endTickBefore) { // making a chord *longer* shouldn't _shorten_ its total duration | ||
| if (!oc){ // everything up to oc should already be tied together | ||
| oc = toChord(cr1); | ||
| } | ||
|
|
||
| for (Note* n: oc->notes()){ | ||
| if (Note* nn = searchTieNote(n)){ | ||
| tieNotesTogether(n, nn); | ||
| } | ||
| } | ||
| oc = oc->next(); | ||
| endTickAfter = cr->isChord() ? toChord(cr)->endTickIncludingTied() : cr->endTick(); | ||
|
Comment on lines
+1861
to
+1873
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Only recreate ties for notes that were originally tied forward. Line 1867 currently retries every note in |
||
| } | ||
|
|
||
| connectTies(); | ||
|
|
||
| if (elementToSelect) { | ||
|
|
@@ -4214,13 +4223,7 @@ bool Score::cmdImplode() | |
| for (Note* tn : tied->notes()) { | ||
| if (nn->pitch() == tn->pitch() && nn->tpc() == tn->tpc() && !tn->tieFor()) { | ||
| // found note to tie | ||
| Tie* tie = Factory::createTie(this->dummy()); | ||
| tie->setStartNote(tn); | ||
| tie->setEndNote(nn); | ||
| tie->setTick(tie->startNote()->tick()); | ||
| tie->setTick2(tie->endNote()->tick()); | ||
| tie->setTrack(tn->track()); | ||
| undoAddElement(tie); | ||
| tieNotesTogether(tn, nn); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -422,13 +422,7 @@ Chord* Score::addChord(const Fraction& tick, TDuration d, Chord* oc, bool genTie | |
| for (size_t i = 0; i < n; ++i) { | ||
| Note* n1 = oc->notes()[i]; | ||
| Note* n2 = chord->notes()[i]; | ||
| Tie* tie = Factory::createTie(this->dummy()); | ||
| tie->setStartNote(n1); | ||
| tie->setEndNote(n2); | ||
| tie->setTick(tie->startNote()->tick()); | ||
| tie->setTick2(tie->endNote()->tick()); | ||
| tie->setTrack(n1->track()); | ||
| undoAddElement(tie); | ||
| tieNotesTogether(n1, n2); | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -1700,15 +1694,7 @@ Note* Score::addTiedMidiPitch(int pitch, bool addFlag, Chord* prevChord, bool al | |
| if (prevChord) { | ||
| Note* nn = prevChord->findNote(n->pitch()); | ||
| if (nn) { | ||
| Tie* tie = Factory::createTie(this->dummy()); | ||
| tie->setStartNote(nn); | ||
| tie->setEndNote(n); | ||
| tie->setTick(tie->startNote()->tick()); | ||
| tie->setTick2(tie->endNote()->tick()); | ||
| tie->setTrack(n->track()); | ||
| n->setTieBack(tie); | ||
| nn->setTieFor(tie); | ||
| undoAddElement(tie); | ||
| tieNotesTogether(nn, n); | ||
| } | ||
| } | ||
| return n; | ||
|
|
@@ -1908,14 +1894,7 @@ void Score::regroupNotesAndRests(const Fraction& startTick, const Fraction& endT | |
| std::vector<Note*> nl2 = nchord2->notes(); | ||
| if (!firstpart) { | ||
| for (size_t j = 0; j < nl1.size(); ++j) { | ||
| Tie* tie = Factory::createTie(this->dummy()); | ||
| tie->setStartNote(nl1[j]); | ||
| tie->setEndNote(nl2[j]); | ||
| tie->setTick(tie->startNote()->tick()); | ||
| tie->setTick2(tie->endNote()->tick()); | ||
| tie->setTrack(tr); | ||
| nl1[j]->setTieFor(tie); | ||
| nl2[j]->setTieBack(tie); | ||
| Tie* tie = tieNotesTogether(nl1[j], nl2[j]); | ||
| ties.push_back(tie); | ||
|
Comment on lines
+1897
to
1898
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Avoid double-registering ties in undo stack.
🔧 Proposed fix@@
- Tie* tie = tieNotesTogether(nl1[j], nl2[j]);
- ties.push_back(tie);
+ ties.push_back(tieNotesTogether(nl1[j], nl2[j]));
@@
- if (tieBack[i]) {
- Tie* tie = Factory::createTie(this->dummy());
- tie->setStartNote(tieBack[i]);
- tie->setEndNote(n);
- tie->setTick(tie->startNote()->tick());
- tie->setTick2(tie->endNote()->tick());
- tie->setTrack(track);
- n->setTieBack(tie);
- tieBack[i]->setTieFor(tie);
- ties.push_back(tie);
- }
- if (tieFor[i]) {
- Tie* tie = Factory::createTie(this->dummy());
- tie->setStartNote(nn);
- tie->setEndNote(tieFor[i]);
- tie->setTick(tie->startNote()->tick());
- tie->setTick2(tie->endNote()->tick());
- tie->setTrack(track);
- nn->setTieFor(tie);
- tieFor[i]->setTieBack(tie);
- ties.push_back(tie);
- }
+ if (tieBack[i]) {
+ ties.push_back(tieNotesTogether(tieBack[i], n));
+ }
+ if (tieFor[i]) {
+ ties.push_back(tieNotesTogether(nn, tieFor[i]));
+ }
@@
- if (!ties.empty()) { // at least one tie was created
- for (Tie* tie : ties) {
- undoAddElement(tie);
- }
- connectTies();
- }
+ if (!ties.empty()) { // at least one tie was created
+ connectTies();
+ } |
||
| } | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.