|
@@ -60,6 +60,7 @@ typedef struct cmXsNote_str
|
60
|
60
|
unsigned flags; // See k???XsFl
|
61
|
61
|
unsigned pitch; // midi pitch
|
62
|
62
|
unsigned velocity; // midi velocity
|
|
63
|
+ unsigned dynamics; // dynamic level 1=pppp 9=fff
|
63
|
64
|
cmChar_t step; // A-G
|
64
|
65
|
unsigned octave; // sci pitch octave
|
65
|
66
|
int alter; // +n=sharps,-n=flats
|
|
@@ -1097,8 +1098,6 @@ cmXsRC_t _cmXScoreProcessMidi(cmXScore_t* p, cmCtx_t* ctx, const cmChar_t* mi
|
1097
|
1098
|
if( cmMidiFileOpen(ctx, &mfH, midiFn ) != kOkMfRC )
|
1098
|
1099
|
return cmErrMsg(&p->err,kMidiFailXsRC,"The MIDI file object could not be opened from '%s'.",cmStringNullGuard(midiFn));
|
1099
|
1100
|
|
1100
|
|
- //cmMidiFilePrintMsgs(mfH, p->err.rpt );
|
1101
|
|
-
|
1102
|
1101
|
if( (m = cmMidiFileMsgArray(mfH)) == NULL || (mN = cmMidiFileMsgCount(mfH)) == 0 )
|
1103
|
1102
|
{
|
1104
|
1103
|
rc = cmErrMsg(&p->err,kMidiFailXsRC,"The MIDI file object appears to be empty.");
|
|
@@ -1256,49 +1255,153 @@ cmXsRC_t cmXScoreFinalize( cmXsH_t* hp )
|
1256
|
1255
|
bool cmXScoreIsValid( cmXsH_t h )
|
1257
|
1256
|
{ return h.h != NULL; }
|
1258
|
1257
|
|
1259
|
|
-void _cmXScoreReportTitle( cmRpt_t* rpt )
|
|
1258
|
+/*
|
|
1259
|
+Dynamics File Format:
|
|
1260
|
+<blk>*
|
|
1261
|
+<blk> -> <hdr-line> <note-line> <blank-line>
|
|
1262
|
+<hdr-line> -> <int> "|"
|
|
1263
|
+<note-line> -> <float> <sci-pitch> ":" <int>
|
|
1264
|
+<sci-pitch> -> <A-G><#|b|<space>
|
|
1265
|
+ */
|
|
1266
|
+
|
|
1267
|
+typedef struct cmXsDyn_str
|
1260
|
1268
|
{
|
1261
|
|
- cmRptPrintf(rpt," voc loc tick durtn rval flags\n");
|
1262
|
|
- cmRptPrintf(rpt," --- ----- ------- ----- ---- --- -------------\n");
|
1263
|
|
-}
|
1264
|
|
-
|
1265
|
|
-void _cmXScoreReportNote( cmRpt_t* rpt, const cmXsNote_t* note )
|
|
1269
|
+ unsigned bar;
|
|
1270
|
+ float rval;
|
|
1271
|
+ unsigned pitch;
|
|
1272
|
+ char dyn;
|
|
1273
|
+ unsigned line;
|
|
1274
|
+} cmXsDyn_t;
|
|
1275
|
+
|
|
1276
|
+cmXsRC_t _cmXScoreParseDynamicsFile( cmXScore_t* p, const cmChar_t* fn, cmXsDyn_t** aVRef, unsigned* aNRef )
|
1266
|
1277
|
{
|
1267
|
|
- const cmChar_t* B = cmIsFlag(note->flags,kBarXsFl) ? "|" : "-";
|
1268
|
|
- const cmChar_t* R = cmIsFlag(note->flags,kRestXsFl) ? "R" : "-";
|
1269
|
|
- const cmChar_t* G = cmIsFlag(note->flags,kGraceXsFl) ? "G" : "-";
|
1270
|
|
- const cmChar_t* D = cmIsFlag(note->flags,kDotXsFl) ? "D" : "-";
|
1271
|
|
- const cmChar_t* C = cmIsFlag(note->flags,kChordXsFl) ? "C" : "-";
|
1272
|
|
- const cmChar_t* e = cmIsFlag(note->flags,kEvenXsFl) ? "e" : "-";
|
1273
|
|
- const cmChar_t* d = cmIsFlag(note->flags,kDynXsFl) ? "d" : "-";
|
1274
|
|
- const cmChar_t* t = cmIsFlag(note->flags,kTempoXsFl) ? "t" : "-";
|
1275
|
|
- const cmChar_t* P = cmIsFlag(note->flags,kPedalDnXsFl) ? "V" : "-";
|
1276
|
|
- const cmChar_t* S = cmIsFlag(note->flags,kSectionXsFl) ? "S" : "-";
|
1277
|
|
- const cmChar_t* H = cmIsFlag(note->flags,kHeelXsFl) ? "H" : "-";
|
1278
|
|
- const cmChar_t* T0 = cmIsFlag(note->flags,kTieBegXsFl) ? "T" : "-";
|
1279
|
|
- const cmChar_t* T1 = cmIsFlag(note->flags,kTieEndXsFl) ? "_" : "-";
|
1280
|
|
- P = cmIsFlag(note->flags,kPedalUpXsFl) ? "^" : P;
|
1281
|
|
- P = cmIsFlag(note->flags,kPedalUpDnXsFl) ? "X" : P;
|
1282
|
|
- //const cmChar_t* N = note->pitch==0 ? " " : cmMidiToSciPitch( note->pitch, NULL, 0 );
|
|
1278
|
+ typedef enum { hdrStateId,noteStateId } state_t;
|
|
1279
|
+ cmXsRC_t rc = kOkXsRC;
|
|
1280
|
+ cmFileH_t fH = cmFileNullHandle;
|
|
1281
|
+ cmChar_t* b = NULL;
|
|
1282
|
+ unsigned bN = 0;
|
|
1283
|
+ unsigned ln = 1;
|
|
1284
|
+ state_t stateId = hdrStateId;
|
|
1285
|
+ unsigned bar = 0;
|
|
1286
|
+
|
|
1287
|
+ if( cmFileOpen(&fH,fn,kReadFileFl,p->err.rpt) != kOkFileRC )
|
|
1288
|
+ return cmErrMsg(&p->err,kFileFailXsRC,"File open failed on '%s'.",cmStringNullGuard(fn));
|
|
1289
|
+
|
|
1290
|
+ unsigned aN = 0;
|
|
1291
|
+ unsigned ai = 0;
|
|
1292
|
+
|
|
1293
|
+ if( cmFileLineCount(fH,&aN) != kOkFileRC )
|
|
1294
|
+ {
|
|
1295
|
+ rc = cmErrMsg(&p->err,kFileFailXsRC,"File line count acces failed on '%s'.",cmStringNullGuard(fn));
|
|
1296
|
+ goto errLabel;
|
|
1297
|
+ }
|
|
1298
|
+
|
|
1299
|
+ cmXsDyn_t* aV = cmMemAllocZ(cmXsDyn_t,aN);
|
1283
|
1300
|
|
1284
|
|
- cmChar_t N[] = {'\0','\0','\0','\0'};
|
1285
|
|
- cmChar_t acc = note->alter==-1?'b':(note->alter==1?'#':' ');
|
1286
|
|
- snprintf(N,4,"%c%c%1i",note->step,acc,note->octave);
|
|
1301
|
+ for(; cmFileGetLineAuto(fH,&b,&bN)==kOkFileRC; ++ln)
|
|
1302
|
+ {
|
|
1303
|
+ char ch;
|
|
1304
|
+
|
|
1305
|
+ if( cmTextIsEmpty(b) )
|
|
1306
|
+ {
|
|
1307
|
+ stateId = hdrStateId;
|
|
1308
|
+ continue;
|
|
1309
|
+ }
|
1287
|
1310
|
|
1288
|
|
- cmRptPrintf(rpt," %3i %5i %7i %5i %4.1f %3s %s%s%s%s%s%s%s%s%s%s%s%s%s",
|
1289
|
|
- note->voice->id,
|
1290
|
|
- note->locIdx,
|
1291
|
|
- note->tick,
|
1292
|
|
- note->duration,
|
1293
|
|
- note->rvalue,
|
1294
|
|
- N,B,R,G,D,C,e,d,t,P,S,H,T0,T1);
|
|
1311
|
+ switch( stateId )
|
|
1312
|
+ {
|
|
1313
|
+ case hdrStateId:
|
|
1314
|
+ if( sscanf(b,"%i %c",&bar,&ch) != 2 || ch != '|' )
|
|
1315
|
+ {
|
|
1316
|
+ rc = cmErrMsg(&p->err,kSyntaxErrorXsRC,"Expected header string read failed on line %i in '%s'.",ln,cmStringNullGuard(fn));
|
|
1317
|
+ goto errLabel;
|
|
1318
|
+ }
|
|
1319
|
+
|
|
1320
|
+ stateId = noteStateId;
|
|
1321
|
+ break;
|
1295
|
1322
|
|
1296
|
|
- if( cmIsFlag(note->flags,kSectionXsFl) )
|
1297
|
|
- cmRptPrintf(rpt," %s",cmStringNullGuard(note->tvalue));
|
|
1323
|
+ case noteStateId:
|
|
1324
|
+ {
|
|
1325
|
+ float rv;
|
|
1326
|
+ char colon;
|
|
1327
|
+ char dyn;
|
|
1328
|
+ char sps[4];
|
|
1329
|
+ sps[3] = 0;
|
|
1330
|
+
|
|
1331
|
+ if(sscanf(b,"%f %c%c%c %c %c", &rv, sps, sps+1, sps+2, &colon, &dyn ) != 6 || colon != ':' )
|
|
1332
|
+ {
|
|
1333
|
+ rc = cmErrMsg(&p->err,kSyntaxErrorXsRC,"Expected note string read failed on line %i in '%s'.",ln,cmStringNullGuard(fn));
|
|
1334
|
+ goto errLabel;
|
|
1335
|
+ }
|
1298
|
1336
|
|
1299
|
|
- if( cmIsFlag(note->flags,kMetronomeXsFl) )
|
1300
|
|
- cmRptPrintf(rpt," %i bpm",note->duration);
|
|
1337
|
+ //printf("%3i %3.1f %3s %c\n",bar,rv,sps,dyn);
|
|
1338
|
+
|
|
1339
|
+ if( sps[1] == ' ')
|
|
1340
|
+ cmTextShrinkS(sps, sps+1, 1 );
|
|
1341
|
+
|
|
1342
|
+
|
|
1343
|
+ assert(ai<aN);
|
|
1344
|
+ aV[ai].bar = bar;
|
|
1345
|
+ aV[ai].rval = rv;
|
|
1346
|
+ aV[ai].pitch = cmSciPitchToMidi(sps);
|
|
1347
|
+ aV[ai].dyn = dyn;
|
|
1348
|
+ aV[ai].line = ln;
|
|
1349
|
+ ++ai;
|
|
1350
|
+
|
|
1351
|
+ }
|
|
1352
|
+ break;
|
|
1353
|
+ }
|
|
1354
|
+ }
|
|
1355
|
+
|
|
1356
|
+ *aVRef = aV;
|
|
1357
|
+ *aNRef = ai;
|
|
1358
|
+
|
|
1359
|
+ errLabel:
|
|
1360
|
+ cmMemFree(b);
|
|
1361
|
+ cmFileClose(&fH);
|
|
1362
|
+ return rc;
|
|
1363
|
+}
|
|
1364
|
+
|
|
1365
|
+cmXsRC_t cmXScoreInsertDynamics( cmXsH_t h, const cmChar_t* dynFn )
|
|
1366
|
+{
|
|
1367
|
+ cmXsRC_t rc = kOkXsRC;
|
|
1368
|
+ cmXScore_t* p = _cmXScoreHandleToPtr(h);
|
|
1369
|
+ cmXsDyn_t* aV = NULL;
|
|
1370
|
+ unsigned aN = 0;
|
|
1371
|
+ unsigned ai = 0;
|
|
1372
|
+
|
|
1373
|
+ if((rc = _cmXScoreParseDynamicsFile(p, dynFn, &aV, &aN)) != kOkXsRC )
|
|
1374
|
+ return rc;
|
|
1375
|
+
|
|
1376
|
+
|
|
1377
|
+ cmXsPart_t* pp = p->partL;
|
|
1378
|
+ for(; pp!=NULL; pp=pp->link)
|
|
1379
|
+ {
|
|
1380
|
+ cmXsMeas_t* mp = pp->measL;
|
|
1381
|
+ for(; mp!=NULL; mp=mp->link)
|
|
1382
|
+ {
|
|
1383
|
+ cmXsNote_t* np = mp->noteL;
|
|
1384
|
+ for(; np!=NULL; np=np->slink)
|
|
1385
|
+ if( cmIsFlag(np->flags,kDynXsFl) )
|
|
1386
|
+ {
|
|
1387
|
+ if( ai >= aN || aV[ai].bar != mp->number || aV[ai].pitch != np->pitch || aV[ai].rval != np->rvalue )
|
|
1388
|
+ {
|
|
1389
|
+ rc = cmErrMsg(&p->err,kSyntaxErrorXsRC,"Dynamics file mismatch error on dynamics line:%i.\n",aV[ai].line);
|
|
1390
|
+ goto errLabel;
|
|
1391
|
+ }
|
|
1392
|
+
|
|
1393
|
+ if( '1' <= aV[ai].dyn && aV[ai].dyn <= '9' )
|
|
1394
|
+ np->dynamics = strtol(&aV[ai].dyn,NULL,10);
|
|
1395
|
+
|
|
1396
|
+ ++ai;
|
|
1397
|
+ }
|
|
1398
|
+ }
|
|
1399
|
+ }
|
1301
|
1400
|
|
|
1401
|
+
|
|
1402
|
+ errLabel:
|
|
1403
|
+ cmMemFree(aV);
|
|
1404
|
+ return rc;
|
1302
|
1405
|
}
|
1303
|
1406
|
|
1304
|
1407
|
/*
|
|
@@ -1357,6 +1460,27 @@ cmXsRC_t _cmXScoreWriteCsvBlankCols( cmXScore_t* p, unsigned cnt, cmCsvCell_t**
|
1357
|
1460
|
return kOkCsvRC;
|
1358
|
1461
|
}
|
1359
|
1462
|
|
|
1463
|
+const cmChar_t* _cmXScoreTranslateDynamics( cmXScore_t* p, const cmXsNote_t* np )
|
|
1464
|
+{
|
|
1465
|
+ if( cmIsFlag(np->flags,kDynXsFl) && np->dynamics != 0 )
|
|
1466
|
+ {
|
|
1467
|
+ switch(np->dynamics)
|
|
1468
|
+ {
|
|
1469
|
+ case 1: return "pppp";
|
|
1470
|
+ case 2: return "ppp";
|
|
1471
|
+ case 3: return "pp";
|
|
1472
|
+ case 4: return "p";
|
|
1473
|
+ case 5: return "mp";
|
|
1474
|
+ case 6: return "mf";
|
|
1475
|
+ case 7: return "f";
|
|
1476
|
+ case 8: return "ff";
|
|
1477
|
+ case 9: return "fff";
|
|
1478
|
+ }
|
|
1479
|
+ cmErrMsg(&p->err,kSyntaxErrorXsRC,"An invalid dynamic value (%i) was encountered.",np->dynamics);
|
|
1480
|
+ }
|
|
1481
|
+ return "";
|
|
1482
|
+}
|
|
1483
|
+
|
1360
|
1484
|
cmXsRC_t _cmXScoreWriteCsvRow(
|
1361
|
1485
|
cmXScore_t* p,
|
1362
|
1486
|
unsigned rowIdx,
|
|
@@ -1370,6 +1494,7 @@ cmXsRC_t _cmXScoreWriteCsvRow(
|
1370
|
1494
|
unsigned d1,
|
1371
|
1495
|
unsigned pitch, // set to -1 if the pitch is not valid
|
1372
|
1496
|
double frac,
|
|
1497
|
+ const cmChar_t* dynStr,
|
1373
|
1498
|
unsigned flags )
|
1374
|
1499
|
{
|
1375
|
1500
|
cmXsRC_t rc = kOkXsRC;
|
|
@@ -1519,9 +1644,15 @@ cmXsRC_t _cmXScoreWriteCsvRow(
|
1519
|
1644
|
}
|
1520
|
1645
|
}
|
1521
|
1646
|
|
1522
|
|
- // col 19: dynamic marking (blank for now)
|
1523
|
|
- if((rc = _cmXScoreWriteCsvBlankCols(p,1,&lcp)) != kOkXsRC )
|
1524
|
|
- goto errLabel;
|
|
1647
|
+ // col 19: dynamic marking
|
|
1648
|
+ if( cmCsvInsertIdentColAfter(p->csvH, lcp, &lcp, dynStr, 0 ) != kOkCsvRC )
|
|
1649
|
+ {
|
|
1650
|
+ rc = cmErrMsg(&p->err,kCsvFailXsRC,"CSV insert failed on 'dynamics'.");
|
|
1651
|
+ goto errLabel;
|
|
1652
|
+ }
|
|
1653
|
+
|
|
1654
|
+ //if((rc = _cmXScoreWriteCsvBlankCols(p,1,&lcp)) != kOkXsRC )
|
|
1655
|
+ // goto errLabel;
|
1525
|
1656
|
|
1526
|
1657
|
// col 20: section
|
1527
|
1658
|
if( cmCsvInsertIdentColAfter(p->csvH,lcp,&lcp,cmIsFlag(flags,kSectionXsFl) ? sectionStr : "",0) != kOkCsvRC )
|
|
@@ -1539,6 +1670,7 @@ cmXsRC_t _cmXScoreWriteCsvRow(
|
1539
|
1670
|
|
1540
|
1671
|
}
|
1541
|
1672
|
|
|
1673
|
+
|
1542
|
1674
|
cmXsRC_t cmXScoreWriteCsv( cmXsH_t h, const cmChar_t* csvFn )
|
1543
|
1675
|
{
|
1544
|
1676
|
cmXsRC_t rc = kOkXsRC;
|
|
@@ -1588,8 +1720,7 @@ cmXsRC_t cmXScoreWriteCsv( cmXsH_t h, const cmChar_t* csvFn )
|
1588
|
1720
|
metro_tick = np->tick;
|
1589
|
1721
|
metro_sec = secs;
|
1590
|
1722
|
}
|
1591
|
|
-
|
1592
|
|
-
|
|
1723
|
+
|
1593
|
1724
|
// if this is a section event
|
1594
|
1725
|
if( cmIsFlag(np->flags,kSectionXsFl) )
|
1595
|
1726
|
sectionIdStr = np->tvalue;
|
|
@@ -1597,7 +1728,7 @@ cmXsRC_t cmXScoreWriteCsv( cmXsH_t h, const cmChar_t* csvFn )
|
1597
|
1728
|
// if this is a bar event
|
1598
|
1729
|
if( cmIsFlag(np->flags,kBarXsFl) )
|
1599
|
1730
|
{
|
1600
|
|
- _cmXScoreWriteCsvRow(p,rowIdx,-1,mp->number,NULL,"bar",dsecs,secs,0,0,-1,0,np->flags);
|
|
1731
|
+ _cmXScoreWriteCsvRow(p,rowIdx,-1,mp->number,NULL,"bar",dsecs,secs,0,0,-1,0,"",np->flags);
|
1601
|
1732
|
sec0 = secs;
|
1602
|
1733
|
}
|
1603
|
1734
|
else
|
|
@@ -1607,7 +1738,7 @@ cmXsRC_t cmXScoreWriteCsv( cmXsH_t h, const cmChar_t* csvFn )
|
1607
|
1738
|
{
|
1608
|
1739
|
unsigned d0 = 64; // pedal MIDI ctl id
|
1609
|
1740
|
unsigned d1 = cmIsFlag(np->flags,kPedalDnXsFl) ? 64 : 0; // pedal-dn: d1>=64 pedal-up:<64
|
1610
|
|
- _cmXScoreWriteCsvRow(p,rowIdx,-1,mp->number,NULL,"ctl",dsecs,secs,d0,d1,-1,0,np->flags);
|
|
1741
|
+ _cmXScoreWriteCsvRow(p,rowIdx,-1,mp->number,NULL,"ctl",dsecs,secs,d0,d1,-1,0,"",np->flags);
|
1611
|
1742
|
sec0 = secs;
|
1612
|
1743
|
}
|
1613
|
1744
|
else
|
|
@@ -1616,10 +1747,11 @@ cmXsRC_t cmXScoreWriteCsv( cmXsH_t h, const cmChar_t* csvFn )
|
1616
|
1747
|
// if this is a sounding note event
|
1617
|
1748
|
if( cmIsFlag(np->flags,kOnsetXsFl) )
|
1618
|
1749
|
{
|
1619
|
|
- double frac = np->rvalue + (cmIsFlag(np->flags,kDotXsFl) ? (np->rvalue/2) : 0);
|
1620
|
|
-
|
|
1750
|
+ double frac = np->rvalue + (cmIsFlag(np->flags,kDotXsFl) ? (np->rvalue/2) : 0);
|
|
1751
|
+ const cmChar_t* dyn = _cmXScoreTranslateDynamics( p, np );
|
|
1752
|
+
|
1621
|
1753
|
//
|
1622
|
|
- _cmXScoreWriteCsvRow(p,rowIdx,np->uid,mp->number,sectionIdStr,"non",dsecs,secs,np->pitch,60,np->pitch,frac,np->flags);
|
|
1754
|
+ _cmXScoreWriteCsvRow(p,rowIdx,np->uid,mp->number,sectionIdStr,"non",dsecs,secs,np->pitch,60,np->pitch,frac,dyn,np->flags);
|
1623
|
1755
|
sec0 = secs;
|
1624
|
1756
|
sectionIdStr = NULL;
|
1625
|
1757
|
}
|
|
@@ -1638,6 +1770,52 @@ cmXsRC_t cmXScoreWriteCsv( cmXsH_t h, const cmChar_t* csvFn )
|
1638
|
1770
|
}
|
1639
|
1771
|
|
1640
|
1772
|
|
|
1773
|
+void _cmXScoreReportTitle( cmRpt_t* rpt )
|
|
1774
|
+{
|
|
1775
|
+ cmRptPrintf(rpt," voc loc tick durtn rval flags\n");
|
|
1776
|
+ cmRptPrintf(rpt," --- ----- ------- ----- ---- --- -------------\n");
|
|
1777
|
+}
|
|
1778
|
+
|
|
1779
|
+void _cmXScoreReportNote( cmRpt_t* rpt, const cmXsNote_t* note )
|
|
1780
|
+{
|
|
1781
|
+ const cmChar_t* B = cmIsFlag(note->flags,kBarXsFl) ? "|" : "-";
|
|
1782
|
+ const cmChar_t* R = cmIsFlag(note->flags,kRestXsFl) ? "R" : "-";
|
|
1783
|
+ const cmChar_t* G = cmIsFlag(note->flags,kGraceXsFl) ? "G" : "-";
|
|
1784
|
+ const cmChar_t* D = cmIsFlag(note->flags,kDotXsFl) ? "D" : "-";
|
|
1785
|
+ const cmChar_t* C = cmIsFlag(note->flags,kChordXsFl) ? "C" : "-";
|
|
1786
|
+ const cmChar_t* e = cmIsFlag(note->flags,kEvenXsFl) ? "e" : "-";
|
|
1787
|
+ const cmChar_t* d = cmIsFlag(note->flags,kDynXsFl) ? "d" : "-";
|
|
1788
|
+ const cmChar_t* t = cmIsFlag(note->flags,kTempoXsFl) ? "t" : "-";
|
|
1789
|
+ const cmChar_t* P = cmIsFlag(note->flags,kPedalDnXsFl) ? "V" : "-";
|
|
1790
|
+ const cmChar_t* S = cmIsFlag(note->flags,kSectionXsFl) ? "S" : "-";
|
|
1791
|
+ const cmChar_t* H = cmIsFlag(note->flags,kHeelXsFl) ? "H" : "-";
|
|
1792
|
+ const cmChar_t* T0 = cmIsFlag(note->flags,kTieBegXsFl) ? "T" : "-";
|
|
1793
|
+ const cmChar_t* T1 = cmIsFlag(note->flags,kTieEndXsFl) ? "_" : "-";
|
|
1794
|
+ P = cmIsFlag(note->flags,kPedalUpXsFl) ? "^" : P;
|
|
1795
|
+ P = cmIsFlag(note->flags,kPedalUpDnXsFl) ? "X" : P;
|
|
1796
|
+ //const cmChar_t* N = note->pitch==0 ? " " : cmMidiToSciPitch( note->pitch, NULL, 0 );
|
|
1797
|
+
|
|
1798
|
+ cmChar_t N[] = {'\0','\0','\0','\0'};
|
|
1799
|
+ cmChar_t acc = note->alter==-1?'b':(note->alter==1?'#':' ');
|
|
1800
|
+ snprintf(N,4,"%c%c%1i",note->step,acc,note->octave);
|
|
1801
|
+
|
|
1802
|
+ cmRptPrintf(rpt," %3i %5i %7i %5i %4.1f %3s %s%s%s%s%s%s%s%s%s%s%s%s%s",
|
|
1803
|
+ note->voice->id,
|
|
1804
|
+ note->locIdx,
|
|
1805
|
+ note->tick,
|
|
1806
|
+ note->duration,
|
|
1807
|
+ note->rvalue,
|
|
1808
|
+ N,B,R,G,D,C,e,d,t,P,S,H,T0,T1);
|
|
1809
|
+
|
|
1810
|
+ if( cmIsFlag(note->flags,kSectionXsFl) )
|
|
1811
|
+ cmRptPrintf(rpt," %s",cmStringNullGuard(note->tvalue));
|
|
1812
|
+
|
|
1813
|
+ if( cmIsFlag(note->flags,kMetronomeXsFl) )
|
|
1814
|
+ cmRptPrintf(rpt," %i bpm",note->duration);
|
|
1815
|
+
|
|
1816
|
+}
|
|
1817
|
+
|
|
1818
|
+
|
1641
|
1819
|
void cmXScoreReport( cmXsH_t h, cmRpt_t* rpt, bool sortFl )
|
1642
|
1820
|
{
|
1643
|
1821
|
cmXScore_t* p = _cmXScoreHandleToPtr(h);
|
|
@@ -1652,9 +1830,10 @@ void cmXScoreReport( cmXsH_t h, cmRpt_t* rpt, bool sortFl )
|
1652
|
1830
|
{
|
1653
|
1831
|
cmRptPrintf(rpt," %i : div:%i beat:%i beat-type:%i (%i)\n",meas->number,meas->divisions,meas->beats,meas->beat_type,meas->divisions*meas->beats);
|
1654
|
1832
|
|
|
1833
|
+ _cmXScoreReportTitle(rpt);
|
|
1834
|
+
|
1655
|
1835
|
if( sortFl )
|
1656
|
1836
|
{
|
1657
|
|
- _cmXScoreReportTitle(rpt);
|
1658
|
1837
|
|
1659
|
1838
|
const cmXsNote_t* note = meas->noteL;
|
1660
|
1839
|
for(; note!=NULL; note=note->slink)
|
|
@@ -1671,8 +1850,6 @@ void cmXScoreReport( cmXsH_t h, cmRpt_t* rpt, bool sortFl )
|
1671
|
1850
|
else
|
1672
|
1851
|
{
|
1673
|
1852
|
|
1674
|
|
- _cmXScoreReportTitle(rpt);
|
1675
|
|
-
|
1676
|
1853
|
const cmXsVoice_t* v = meas->voiceL;
|
1677
|
1854
|
for(; v!=NULL; v=v->link)
|
1678
|
1855
|
{
|
|
@@ -1718,7 +1895,7 @@ cmXsRC_t cmXScoreWriteMidi( cmXsH_t h, const cmChar_t* fn )
|
1718
|
1895
|
}
|
1719
|
1896
|
}
|
1720
|
1897
|
|
1721
|
|
-cmXsRC_t cmXScoreTest( cmCtx_t* ctx, const cmChar_t* xmlFn, const cmChar_t* midiFn, const cmChar_t* outFn )
|
|
1898
|
+cmXsRC_t cmXScoreTest( cmCtx_t* ctx, const cmChar_t* xmlFn, const cmChar_t* midiFn, const cmChar_t* outFn, const cmChar_t* dynFn )
|
1722
|
1899
|
{
|
1723
|
1900
|
cmXsRC_t rc;
|
1724
|
1901
|
cmXsH_t h = cmXsNullHandle;
|
|
@@ -1726,9 +1903,13 @@ cmXsRC_t cmXScoreTest( cmCtx_t* ctx, const cmChar_t* xmlFn, const cmChar_t* midi
|
1726
|
1903
|
if((rc = cmXScoreInitialize( ctx, &h, xmlFn, midiFn)) != kOkXsRC )
|
1727
|
1904
|
return cmErrMsg(&ctx->err,rc,"XScore alloc failed.");
|
1728
|
1905
|
|
|
1906
|
+ if( dynFn != NULL )
|
|
1907
|
+ cmXScoreInsertDynamics(h, dynFn );
|
|
1908
|
+
|
1729
|
1909
|
if( outFn != NULL )
|
1730
|
1910
|
cmXScoreWriteCsv(h,outFn);
|
1731
|
|
- cmXScoreReport(h,&ctx->rpt,true);
|
|
1911
|
+
|
|
1912
|
+ //cmXScoreReport(h,&ctx->rpt,true);
|
1732
|
1913
|
|
1733
|
1914
|
return cmXScoreFinalize(&h);
|
1734
|
1915
|
|