|
@@ -1541,6 +1541,37 @@ cmXsNote_t* _cmXsReorderFindNote( cmXScore_t* p, unsigned measNumb, const cmXsR
|
1541
|
1541
|
return NULL;
|
1542
|
1542
|
}
|
1543
|
1543
|
|
|
1544
|
+void _cmXScoreInsertPedalEvent( cmXScore_t* p, const cmXsReorder_t* r, unsigned flags )
|
|
1545
|
+{
|
|
1546
|
+ // Create a new score event record
|
|
1547
|
+ cmXsNote_t* nn = cmLhAllocZ(p->lhH,cmXsNote_t,1);
|
|
1548
|
+
|
|
1549
|
+ nn->uid = p->nextUid++;
|
|
1550
|
+ nn->voice = r->note->voice;
|
|
1551
|
+ nn->meas = r->note->meas;
|
|
1552
|
+ nn->flags = flags;
|
|
1553
|
+
|
|
1554
|
+ // Pedal down events occur after the event they are attached to
|
|
1555
|
+ if( cmIsFlag(flags,kSostDnXsFl | kPedalDnXsFl ) )
|
|
1556
|
+ {
|
|
1557
|
+ nn->tick = r->note->tick + 1;
|
|
1558
|
+ _cmXScoreInsertNoteAfter(r->note,nn);
|
|
1559
|
+ }
|
|
1560
|
+ else
|
|
1561
|
+ {
|
|
1562
|
+ // Pedal up events occur before the event they are attached to
|
|
1563
|
+ if( cmIsFlag(flags,kSostUpXsFl | kPedalUpXsFl ) )
|
|
1564
|
+ {
|
|
1565
|
+ nn->tick = r->note->tick==0 ? 0 : r->note->tick - 1;
|
|
1566
|
+ _cmXScoreInsertNoteBefore(r->note,nn);
|
|
1567
|
+ }
|
|
1568
|
+ else
|
|
1569
|
+ { assert(0); }
|
|
1570
|
+ }
|
|
1571
|
+
|
|
1572
|
+
|
|
1573
|
+}
|
|
1574
|
+
|
1544
|
1575
|
cmXsRC_t _cmXScoreReorderMeas( cmXScore_t* p, unsigned measNumb, cmXsReorder_t* rV, unsigned rN )
|
1545
|
1576
|
{
|
1546
|
1577
|
unsigned i;
|
|
@@ -1600,30 +1631,21 @@ cmXsRC_t _cmXScoreReorderMeas( cmXScore_t* p, unsigned measNumb, cmXsReorder_t*
|
1600
|
1631
|
// Insert new note records for pedal up/dn events.
|
1601
|
1632
|
for(i=0; i<rN; ++i)
|
1602
|
1633
|
{
|
1603
|
|
-
|
1604
|
1634
|
if( rV[i].newFlags != 0 )
|
1605
|
1635
|
{
|
1606
|
|
- // Create a new score event record
|
1607
|
|
- cmXsNote_t* nn = cmLhAllocZ(p->lhH,cmXsNote_t,1);
|
1608
|
1636
|
|
1609
|
|
- nn->uid = p->nextUid++;
|
1610
|
|
- nn->voice = rV[i].note->voice;
|
1611
|
|
- nn->meas = rV[i].note->meas;
|
1612
|
|
- nn->flags = rV[i].newFlags;
|
1613
|
|
-
|
1614
|
|
- // Pedal down events occur after the event they are attached to
|
1615
|
|
- if( cmIsFlag(rV[i].newFlags,kSostDnXsFl | kPedalDnXsFl ) )
|
1616
|
|
- {
|
1617
|
|
- nn->tick = rV[i].note->tick + 1;
|
1618
|
|
- _cmXScoreInsertNoteAfter(rV[i].note,nn);
|
1619
|
|
- }
|
|
1637
|
+ if( cmIsFlag(rV[i].newFlags,kPedalDnXsFl ) )
|
|
1638
|
+ _cmXScoreInsertPedalEvent(p,rV + i,kPedalDnXsFl);
|
1620
|
1639
|
|
1621
|
|
- // Pedal up events occur before the event they are attached to
|
1622
|
|
- if( cmIsFlag(rV[i].newFlags,kSostUpXsFl | kPedalUpXsFl ) )
|
1623
|
|
- {
|
1624
|
|
- nn->tick = rV[i].note->tick==0 ? 0 : rV[i].note->tick - 1;
|
1625
|
|
- _cmXScoreInsertNoteBefore(rV[i].note,nn);
|
1626
|
|
- }
|
|
1640
|
+ if( cmIsFlag(rV[i].newFlags,kSostDnXsFl ) )
|
|
1641
|
+ _cmXScoreInsertPedalEvent(p,rV + i,kSostDnXsFl);
|
|
1642
|
+
|
|
1643
|
+ if( cmIsFlag(rV[i].newFlags,kPedalUpXsFl ) )
|
|
1644
|
+ _cmXScoreInsertPedalEvent(p,rV + i,kPedalUpXsFl);
|
|
1645
|
+
|
|
1646
|
+ if( cmIsFlag(rV[i].newFlags,kSostUpXsFl ) )
|
|
1647
|
+ _cmXScoreInsertPedalEvent(p,rV + i,kSostUpXsFl);
|
|
1648
|
+
|
1627
|
1649
|
}
|
1628
|
1650
|
}
|
1629
|
1651
|
|
|
@@ -1726,8 +1748,12 @@ cmXsRC_t _cmXScoreReorderParseFlags(cmXScore_t* p, const cmChar_t* b, unsigned
|
1726
|
1748
|
break;
|
1727
|
1749
|
|
1728
|
1750
|
case 'u':
|
1729
|
|
- *newFlagsRef |= kSostUpXsFl; // sostenuto pedal up
|
|
1751
|
+ *newFlagsRef |= kSostUpXsFl; // sostenuto pedal up just before this event
|
1730
|
1752
|
break;
|
|
1753
|
+
|
|
1754
|
+ case 'x':
|
|
1755
|
+ *newFlagsRef |= (kSostUpXsFl | kSostDnXsFl); // sostenuto pedal up just before this event and sost down just after it.
|
|
1756
|
+ break;
|
1731
|
1757
|
|
1732
|
1758
|
case 'D':
|
1733
|
1759
|
*newFlagsRef |= kPedalDnXsFl; // damper pedal down
|