diff --git a/cwPianoScore.cpp b/cwPianoScore.cpp index 70174d4..42f4fdc 100644 --- a/cwPianoScore.cpp +++ b/cwPianoScore.cpp @@ -17,32 +17,6 @@ namespace cw { namespace perf_score { - /* - enum { - kMeasColIdx = 0, - kLocColIdx, - kSecColIdx, - kSciPitchColIdx, - kStatusColIdx, - kD0ColIdx, - kD1ColIdx, - kBarColIdx, - kSectionColIdx, - kEvenColIdx, - kDynColIdx, - kTempoColIdx, - kCostColIdx, - kColCnt - }; - - typedef struct col_map_str - { - unsigned colId; - const char* label; - bool enableFl; - } col_map_t; - */ - typedef struct score_str { event_t* base; @@ -57,24 +31,6 @@ namespace cw } score_t; - /* - col_map_t col_map_array[] = { - { kMeasColIdx, "meas", true }, - { kLocColIdx, "loc", true }, - { kLocColIdx, "oloc", false }, - { kSecColIdx, "sec", true }, - { kSciPitchColIdx, "sci_pitch", true }, - { kStatusColIdx, "status", true }, - { kD0ColIdx, "d0", true }, - { kD1ColIdx, "d1", true }, - { kBarColIdx, "bar", true }, - { kSectionColIdx, "section", true }, - { kEvenColIdx, "even", true }, - { kDynColIdx, "dyn", true }, - { kTempoColIdx, "tempo", true }, - { kCostColIdx, "cost", true }, - }; - */ score_t* _handleToPtr(handle_t h) { return handleToPtr(h); @@ -203,16 +159,6 @@ namespace cw csv::handle_t csvH; rc_t rc = kOkRC; bool score_fl = false; - /* - //unsigned titleN = sizeof(col_map_array)/sizeof(col_map_array[0]); - //const char* titleA[ titleN ]; - - for(unsigned i=0; imeas ); - break; - - case kLoc_FIdx: - rc = _parse_csv_unsigned( line_buf, bfi, efi, e->loc ); - break; - - case kSec_FIdx: - rc = _parse_csv_double( line_buf, bfi, efi, e->sec ); - break; - - case kStatus_FIdx: - rc = _parse_csv_unsigned( line_buf, bfi, efi, e->status ); - break; - - case kD0_FIdx: - rc = _parse_csv_unsigned( line_buf, bfi, efi, e->d0 ); - break; - - case kD1_FIdx: - rc = _parse_csv_unsigned( line_buf, bfi, efi, e->d1 ); - break; - - case kBar_FIdx: - rc = _parse_csv_unsigned( line_buf, bfi, efi, e->bar ); - break; - - case kSection_FIdx: - rc = _parse_csv_unsigned( line_buf, bfi, efi, e->section ); - break; - - case kSPitch_FIdx: - rc = _parse_csv_string( line_buf, bfi, efi, e->sci_pitch, sizeof(e->sci_pitch) ); - break; - - case kEven_FIdx: - e->even = INVALID_PERF_MEAS; - if( efi > bfi+1 ) - rc = _parse_csv_double( line_buf, bfi, efi, e->even ); - break; - - case kDyn_FIdx: - e->dyn = INVALID_PERF_MEAS; - if( efi > bfi+1 ) - rc = _parse_csv_double( line_buf, bfi, efi, e->dyn ); - break; - - case kTempo_FIdx: - e->tempo = INVALID_PERF_MEAS; - if( efi > bfi+1 ) - rc = _parse_csv_double( line_buf, bfi, efi, e->tempo ); - break; - - case kCost_FIdx: - e->cost = INVALID_PERF_MEAS; - if( efi > bfi+1 ) - rc = _parse_csv_double( line_buf, bfi, efi, e->cost ); - break; - - default: - break; - } - } - - bfi = efi + 1; - efi = efi + 1; - - } - - errLabel: - - return rc; - } - - - rc_t _parse_csv( score_t* p, const char* fn ) - { - rc_t rc; - file::handle_t fH; - unsigned line_count = 0; - char* lineBufPtr = nullptr; - unsigned lineBufCharCnt = 0; - event_t* e = nullptr; - - if((rc = file::open( fH, fn, file::kReadFl )) != kOkRC ) - { - rc = cwLogError( rc, "Piano score file open failed on '%s'.",cwStringNullGuard(fn)); - goto errLabel; - } - - if((rc = file::lineCount(fH,&line_count)) != kOkRC ) - { - rc = cwLogError( rc, "Line count query failed on '%s'.",cwStringNullGuard(fn)); - goto errLabel; - } - - p->min_uid = kInvalidId; - p->uid_mapN = 0; - - for(unsigned line=0; line 0 ) // skip column title line - { - - e = mem::allocZ(); - - if((rc = _parse_csv_line( p, e, lineBufPtr, lineBufCharCnt )) != kOkRC ) - { - mem::release(e); - rc = cwLogError( rc, "Line parse failed on '%s' line number '%i'.",cwStringNullGuard(fn),line+1); - goto errLabel; - } - - // assign the UID - e->uid = line; - - // link the event into the event list - if( p->end != nullptr ) - p->end->link = e; - else - p->base = e; - - p->end = e; - - // track the max 'loc' id - if( e->loc > p->maxLocId ) - p->maxLocId = e->loc; - - if( p->min_uid == kInvalidId || e->uid < p->min_uid ) - p->min_uid = e->uid; - - p->uid_mapN += 1; - } - - } - - errLabel: - mem::release(lineBufPtr); - file::close(fH); - - return rc; - } - */ rc_t _parse_event_list( score_t* p, const object_t* cfg ) { rc_t rc; @@ -574,16 +262,6 @@ namespace cw textCopy( e->sci_pitch,sizeof(e->sci_pitch),sci_pitch); textCopy( e->dmark,sizeof(e->dmark),dmark); textCopy( e->grace_mark, sizeof(e->grace_mark),grace_mark); - /* - if( sci_pitch != nullptr ) - strncpy(e->sci_pitch,sci_pitch,sizeof(e->sci_pitch)-1); - - if( dmark != nullptr ) - strncpy(e->dmark,dmark,sizeof(e->dmark)-1); - - if( grace_mark != nullptr ) - strncpy(e->grace_mark,grace_mark,sizeof(e->grace_mark)-1); - */ // assign the UID e->uid = i;