@@ -138,10 +138,10 @@ static void collectNote(EventMap* events, int channel, const Note* note, int vel
138
138
if (chord->isGrace ()) {
139
139
chord = static_cast <Chord*>(chord->parent ());
140
140
tieLen = 0 ;
141
- ticks = chord->duration (). ticks ();
141
+ ticks = chord->actualTicks ();
142
142
}
143
143
else {
144
- ticks = chord->duration (). ticks ();
144
+ ticks = chord->actualTicks ();
145
145
tieLen = note->playTicks () - ticks;
146
146
}
147
147
int tick1 = chord->tick () + tickOffset;
@@ -541,9 +541,10 @@ static QList<NoteEventList> renderChord(Chord* chord, int gateTime, int ontime)
541
541
//
542
542
Tremolo* tremolo = chord->tremolo ();
543
543
if (tremolo) {
544
- int n = 1 << tremolo->lines ();
545
- int l = 1000 / n;
544
+ // int n = 1 << tremolo->lines();
545
+ // int l = 1000 / n;
546
546
if (chord->tremoloChordType () == TremoloFirstNote) {
547
+ int t = MScore::division / (1 << tremolo->lines ());
547
548
Segment::SegmentTypes st = Segment::SegChordRest;
548
549
Segment* seg2 = seg->next (st);
549
550
int track = chord->track ();
@@ -552,24 +553,35 @@ static QList<NoteEventList> renderChord(Chord* chord, int gateTime, int ontime)
552
553
Chord* c2 = seg2 ? static_cast <Chord*>(seg2->element (track)) : 0 ;
553
554
if (c2 && c2->type () == Element::CHORD) {
554
555
int tnotes = qMin (notes, c2->notes ().size ());
556
+ int tticks = chord->actualTicks () * 2 ; // use twice the size
557
+ int n = tticks / t;
555
558
n /= 2 ;
559
+ int l = 2000 * t / tticks;
556
560
for (int k = 0 ; k < tnotes; ++k) {
557
561
NoteEventList* events = &ell[k];
558
562
events->clear ();
559
563
int p1 = chord->notes ()[k]->pitch ();
560
564
int p2 = c2->notes ()[k]->pitch ();
565
+ int dpitch = p2 - p1;
561
566
for (int i = 0 ; i < n; ++i) {
562
- events->append (NoteEvent (p1 , l * i * 2 , l));
563
- events->append (NoteEvent (p2 , l * i * 2 + l, l));
567
+ events->append (NoteEvent (0 , l * i * 2 , l));
568
+ events->append (NoteEvent (dpitch , l * i * 2 + l, l));
564
569
}
565
570
}
566
571
}
567
572
else
568
573
qDebug (" Chord::renderTremolo: cannot find 2. chord\n " );
569
574
}
570
575
else if (chord->tremoloChordType () == TremoloSecondNote) {
576
+ for (int k = 0 ; k < notes; ++k) {
577
+ NoteEventList* events = &(ell)[k];
578
+ events->clear ();
579
+ }
571
580
}
572
581
else if (chord->tremoloChordType () == TremoloSingle) {
582
+ int t = MScore::division / (1 << (tremolo->lines () + chord->durationType ().hooks ()));
583
+ int n = chord->durationTicks () / t;
584
+ int l = 1000 / n;
573
585
for (int k = 0 ; k < notes; ++k) {
574
586
NoteEventList* events = &(ell)[k];
575
587
events->clear ();
@@ -595,11 +607,13 @@ static QList<NoteEventList> renderChord(Chord* chord, int gateTime, int ontime)
595
607
end = -1 ;
596
608
step = -1 ;
597
609
}
610
+ int j = 0 ;
598
611
for (int i = start; i != end; i += step) {
599
612
NoteEventList* events = &(ell)[i];
600
613
events->clear ();
601
- int ot = (l * i * 1000 ) / chord->upNote ()->playTicks ();
614
+ int ot = (l * j * 1000 ) / chord->upNote ()->playTicks ();
602
615
events->append (NoteEvent (0 , ot, 1000 - ot));
616
+ j++;
603
617
}
604
618
}
605
619
@@ -658,7 +672,7 @@ static QList<NoteEventList> renderChord(Chord* chord, int gateTime, int ontime)
658
672
for (int i = 0 ; i < notes; ++i) {
659
673
NoteEventList* el = &ell[i];
660
674
int nn = el->size ();
661
- if (nn == 0 ) {
675
+ if (nn == 0 && chord-> tremoloChordType () != TremoloSecondNote ) {
662
676
el->append (NoteEvent (0 , ontime, 1000 -ontime));
663
677
++nn;
664
678
}
0 commit comments