From 7cef3bc4e16abef3e1aa0040a5afaccdbcefae29 Mon Sep 17 00:00:00 2001 From: kevin Date: Wed, 30 Mar 2016 19:17:41 -0400 Subject: [PATCH] cmScore.h/c : Removed "graphic score" processig. This is now in cmScoreMatchGraphic.h/c. --- app/cmScore.c | 145 ++------------------------------------------------ app/cmScore.h | 16 ------ 2 files changed, 4 insertions(+), 157 deletions(-) diff --git a/app/cmScore.c b/app/cmScore.c index c45ec24..e559e34 100644 --- a/app/cmScore.c +++ b/app/cmScore.c @@ -2082,7 +2082,10 @@ bool _cmScPerfDyn( cmSc_t* p, cmScoreSet_t* stp, bool printMissFl) stp->eleArray[i]->perfDynLvl = j+1; - a += abs((j+1) - stp->eleArray[i]->dynVal); + if( j + 1 > stp->eleArray[i]->dynVal ) + a += (j+1) - stp->eleArray[i]->dynVal; + else + a += stp->eleArray[i]->dynVal - (j+1); if( p->cbFunc != NULL ) { @@ -2426,146 +2429,6 @@ void cmScorePrint( cmScH_t h, cmRpt_t* rpt ) } } -cmScRC_t cmScoreGraphicAlloc( cmScH_t h, cmScGraphic_t** vRef, unsigned* nRef) -{ - cmScRC_t rc = kOkScRC; - cmSc_t* p = _cmScHandleToPtr(h); - cmScGraphic_t* v = cmMemAllocZ(cmScGraphic_t,p->cnt); - unsigned i,j,k,k0; - - unsigned bordH = 5; - unsigned bordW = 5; - unsigned noteW = 30; - unsigned noteH = 30; - unsigned left = bordH; - unsigned top = bordW; - - // for each score location - for(i=0,k=0; ilocCnt; ++i) - { - left += k0!=k ? noteW + bordW : 0; - top = noteH + 2*bordH; - - k0 = k; - - // for each event in location i - for(j=0; jloc[i].evtCnt; ++j) - { - const cmScoreEvt_t* e = p->loc[i].evtArray[j]; - - switch( e->type) - { - case kBarEvtScId: - top = bordH; - - case kNonEvtScId: - - assert( k < p->cnt ); - - v[k].type = e->type; - v[k].csvEventId = e->csvEventId; - v[k].left = left; - v[k].top = top; - v[k].width = noteW; - v[k].height = noteH; - - if( e->type == kBarEvtScId ) - v[k].text = cmTsPrintfP(NULL,"%i",e->barNumb); - else - v[k].text = cmMemAllocStr( cmMidiToSciPitch( e->pitch, NULL, 0)); - - top += noteH + bordH; - - - k += 1; - - break; - } - } - } - - *nRef = k; - *vRef = v; - - return rc; -} - -cmScRC_t cmScoreGraphicRelease( cmScH_t h, cmScGraphic_t** vRef, unsigned* nRef) -{ - if( vRef == NULL || nRef==NULL ) - return kOkScRC; - - unsigned i; - cmScGraphic_t* v = *vRef; - unsigned n = *nRef; - for(i=0; ierr.rpt) != kOkFileRC ) - return cmErrMsg(&p->err,kFileFailScRC,"Graphic file create failed for '%s'.",cmStringNullGuard(fn)); - - unsigned svgWidth = v[n-1].left + v[n-1].width + 10; - unsigned svgHeight = 0; - - for(i=0; i svgHeight ) - svgHeight = v[i].top + v[i].height; - - svgHeight += 10; - - cmFilePrintf(fH,"\n\n\n\n",svgWidth,svgHeight); - - if((rc != cmScoreGraphicWrite(h,fH,v,n)) != kOkScRC ) - goto errLabel; - - cmFilePrint(fH,"\n\n\n"); - - errLabel: - cmFileClose(&fH); - return rc; -} - -cmScRC_t cmScoreGraphicWrite( cmScH_t h, cmFileH_t fH, cmScGraphic_t* v, unsigned n ) -{ - cmSc_t* p = _cmScHandleToPtr(h); - unsigned i; - for(i=0; i\n",g->left,g->top,g->width,g->height) != kOkFileRC ) - return cmErrMsg(&p->err,kFileFailScRC,"File write failed on graphic file output."); - - if( g->text != NULL ) - { - unsigned tx = g->left + g->width/2; - unsigned ty = g->top + 20; //g->height/2; - - if( cmFilePrintf(fH,"%s\n",tx,ty,g->text) != kOkFileRC ) - return cmErrMsg(&p->err,kFileFailScRC,"File write failed on graphic file output."); - } - - // - //TEXT - - } - - return kOkScRC; -} - - cmScRC_t cmScoreFileFromMidi( cmCtx_t* ctx, const cmChar_t* midiFn, const cmChar_t* scoreFn ) { diff --git a/app/cmScore.h b/app/cmScore.h index 9e4afd6..87aa98d 100644 --- a/app/cmScore.h +++ b/app/cmScore.h @@ -272,22 +272,6 @@ extern "C" { void cmScorePrint( cmScH_t h, cmRpt_t* rpt ); - typedef struct - { - unsigned type; - unsigned csvEventId; - unsigned left; - unsigned top; - unsigned width; - unsigned height; - const cmChar_t* text; - } cmScGraphic_t; - - cmScRC_t cmScoreGraphicAlloc( cmScH_t h, cmScGraphic_t** vRef, unsigned* nRef ); - cmScRC_t cmScoreGraphicRelease( cmScH_t h, cmScGraphic_t** vRef, unsigned* nRef ); - cmScRC_t cmScoreGraphicWriteF( cmScH_t h, const cmChar_t* fn, cmScGraphic_t* v, unsigned n ); - cmScRC_t cmScoreGraphicWrite( cmScH_t h, cmFileH_t fH, cmScGraphic_t* v, unsigned n ); - // Generate a new score file from a MIDI file. cmScRC_t cmScoreFileFromMidi( cmCtx_t* ctx, const cmChar_t* midiFn, const cmChar_t* scoreFn );