cmXScore.h/c : The even-ness label is now written as a quoted string in the output CSV file so that the '*' token is correctly parsed by cmScore.
This commit is contained in:
parent
999ffe9bb4
commit
68e34d29d7
@ -16,6 +16,8 @@
|
|||||||
#include "cmMidiFile.h"
|
#include "cmMidiFile.h"
|
||||||
#include "cmLex.h"
|
#include "cmLex.h"
|
||||||
#include "cmCsv.h"
|
#include "cmCsv.h"
|
||||||
|
#include "cmSymTbl.h"
|
||||||
|
#include "cmScore.h"
|
||||||
|
|
||||||
#include "cmFile.h"
|
#include "cmFile.h"
|
||||||
#include "cmSymTbl.h"
|
#include "cmSymTbl.h"
|
||||||
@ -1424,7 +1426,7 @@ cmXsRC_t cmXScoreReorder( cmXsH_t h, const cmChar_t* fn )
|
|||||||
{
|
{
|
||||||
switch( stateId )
|
switch( stateId )
|
||||||
{
|
{
|
||||||
case kFindEventStId:
|
case kFindEventStId: // scanning past labels to an event line
|
||||||
{
|
{
|
||||||
unsigned voice,loc;
|
unsigned voice,loc;
|
||||||
if( sscanf(b,"%i %i",&voice,&loc) != 2 )
|
if( sscanf(b,"%i %i",&voice,&loc) != 2 )
|
||||||
@ -1439,6 +1441,7 @@ cmXsRC_t cmXScoreReorder( cmXsH_t h, const cmChar_t* fn )
|
|||||||
cmXsReorder_t r;
|
cmXsReorder_t r;
|
||||||
char pitchStr[4];
|
char pitchStr[4];
|
||||||
|
|
||||||
|
// parse an event line
|
||||||
if( sscanf(b,"%i %i %i %i %f %c%c%c",&r.voice,&r.locIdx,&r.tick,&r.durtn,&r.rval,pitchStr,pitchStr+1,pitchStr+2) == 8 )
|
if( sscanf(b,"%i %i %i %i %f %c%c%c",&r.voice,&r.locIdx,&r.tick,&r.durtn,&r.rval,pitchStr,pitchStr+1,pitchStr+2) == 8 )
|
||||||
{
|
{
|
||||||
pitchStr[3] = 0;
|
pitchStr[3] = 0;
|
||||||
@ -1455,12 +1458,15 @@ cmXsRC_t cmXScoreReorder( cmXsH_t h, const cmChar_t* fn )
|
|||||||
r.midi = cmSciPitchToMidi(pitchStr);
|
r.midi = cmSciPitchToMidi(pitchStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// store the record
|
||||||
assert( ri < rN );
|
assert( ri < rN );
|
||||||
rV[ri++] = r;
|
rV[ri++] = r;
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// the end of the measure was encountered -
|
||||||
|
// reorder the measure based on the cmXsReorder_t in rV[ri]
|
||||||
if((rc = _cmXScoreReorderMeas(p, measNumb, rV, ri )) != kOkXsRC )
|
if((rc = _cmXScoreReorderMeas(p, measNumb, rV, ri )) != kOkXsRC )
|
||||||
goto errLabel;
|
goto errLabel;
|
||||||
|
|
||||||
@ -1470,7 +1476,7 @@ cmXsRC_t cmXScoreReorder( cmXsH_t h, const cmChar_t* fn )
|
|||||||
// fall through
|
// fall through
|
||||||
}
|
}
|
||||||
|
|
||||||
case kFindMeasStId:
|
case kFindMeasStId: // scanning for a bar-line
|
||||||
{
|
{
|
||||||
char colon;
|
char colon;
|
||||||
if( sscanf(b,"%i %c",&measNumb,&colon) == 2 && colon == ':' )
|
if( sscanf(b,"%i %c",&measNumb,&colon) == 2 && colon == ':' )
|
||||||
@ -1878,7 +1884,7 @@ cmXsRC_t _cmXScoreWriteCsvRow(
|
|||||||
goto errLabel;
|
goto errLabel;
|
||||||
|
|
||||||
// col 15: even (all grace notes are 'even' notes
|
// col 15: even (all grace notes are 'even' notes
|
||||||
if( cmCsvInsertIdentColAfter(p->csvH,lcp,&lcp, evenStr, 0) != kOkCsvRC )
|
if( cmCsvInsertQTextColAfter(p->csvH,lcp,&lcp, evenStr, 0) != kOkCsvRC )
|
||||||
{
|
{
|
||||||
rc = cmErrMsg(&p->err,kCsvFailXsRC,"CSV insert failed on eveness flag label.");
|
rc = cmErrMsg(&p->err,kCsvFailXsRC,"CSV insert failed on eveness flag label.");
|
||||||
goto errLabel;
|
goto errLabel;
|
||||||
@ -2184,12 +2190,24 @@ cmXsRC_t cmXScoreTest( cmCtx_t* ctx, const cmChar_t* xmlFn, const cmChar_t* midi
|
|||||||
if( dynFn != NULL )
|
if( dynFn != NULL )
|
||||||
cmXScoreInsertDynamics(h, dynFn );
|
cmXScoreInsertDynamics(h, dynFn );
|
||||||
|
|
||||||
if( reorderFn != NULL )
|
//if( reorderFn != NULL )
|
||||||
cmXScoreReorder(h,reorderFn);
|
// cmXScoreReorder(h,reorderFn);
|
||||||
|
|
||||||
if( outFn != NULL )
|
if( outFn != NULL )
|
||||||
|
{
|
||||||
|
cmScH_t scH = cmScNullHandle;
|
||||||
|
double srate = 96000.0;
|
||||||
|
|
||||||
cmXScoreWriteCsv(h,outFn);
|
cmXScoreWriteCsv(h,outFn);
|
||||||
|
|
||||||
|
if( cmScoreInitialize( ctx, &scH, outFn, srate, NULL, 0, NULL, NULL, cmSymTblNullHandle) != kOkScRC )
|
||||||
|
cmErrMsg(&ctx->err,kFileFailXsRC,"The generated CSV file could not be parsed.");
|
||||||
|
else
|
||||||
|
cmScoreFinalize(&scH);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
//cmXScoreReport(h,&ctx->rpt,true);
|
//cmXScoreReport(h,&ctx->rpt,true);
|
||||||
|
|
||||||
return cmXScoreFinalize(&h);
|
return cmXScoreFinalize(&h);
|
||||||
|
@ -35,7 +35,7 @@ extern "C" {
|
|||||||
//
|
//
|
||||||
// Steps 1) and 2) can be automated by in emacs by:
|
// Steps 1) and 2) can be automated by in emacs by:
|
||||||
//
|
//
|
||||||
// M-x load-file ~/src/emacs/rpoc_music_xml.el
|
// M-x load-file ~/src/emacs/proc_music_xml.el
|
||||||
//
|
//
|
||||||
// 3) How to assigned dynamic markings (they are not attached to notes). (from MIDI file?)
|
// 3) How to assigned dynamic markings (they are not attached to notes). (from MIDI file?)
|
||||||
// 4) Tempo syntax is inconsistent (only a problem in full part2 score)
|
// 4) Tempo syntax is inconsistent (only a problem in full part2 score)
|
||||||
|
Loading…
Reference in New Issue
Block a user