diff --git a/cwSfScore.cpp b/cwSfScore.cpp index efc15ad..686fde7 100644 --- a/cwSfScore.cpp +++ b/cwSfScore.cpp @@ -242,6 +242,20 @@ namespace cw errLabel: return rc; } + + rc_t _assign_section_to_events( sfscore_t* p ) + { + for(unsigned si=0,ei=0; sisectionN ; ++si) + { + // the last event in a section is the event just prior to the first event in the next section + unsigned end_evt_idx = si>=p->sectionN-1 ? p->eventN : p->sectionA[si+1].begEvtIndex; + + for(; eieventA[ ei ].section = p->sectionA + si; + + } + return kOkRC; + } rc_t _create_section_array( sfscore_t* p ) { @@ -785,6 +799,9 @@ namespace cw if((rc = _create_section_array( p )) != kOkRC ) goto errLabel; + if((rc = _assign_section_to_events(p)) != kOkRC ) + goto errLabel; + if((rc = _create_set_array( p )) != kOkRC ) goto errLabel; diff --git a/cwSfScore.h b/cwSfScore.h index 8ce1467..10bb7ce 100644 --- a/cwSfScore.h +++ b/cwSfScore.h @@ -9,6 +9,8 @@ namespace cw struct loc_str; struct set_str; + typedef score_parse::stats_t stats_t; + // The score can be divided into arbitrary non-overlapping sections. typedef struct section_str { @@ -20,8 +22,7 @@ namespace cw unsigned endEvtIndex; // last element in this section unsigned setCnt; // Count of elements in setArray[] struct set_str** setArray; // Ptrs to sets which are applied to this section. - - //double vars[ score_parse::kVarCnt ]; // Set to DBL_MAX by default. + //stats_t statsA[ score_parse::kStatCnt ]; } section_t; typedef struct var_str @@ -43,6 +44,7 @@ namespace cw unsigned flags; // Attribute flags for this event unsigned dynLevel; // Dynamcis value pppp to ffff (1 to 11) for this note. double frac; // Note's time value for tempo and non-grace evenness notes. + section_t* section; // The section to which this event belongs unsigned barNumb; // Bar id of the measure containing this event. unsigned barNoteIdx; // Index of this note in this bar unsigned csvRowNumb; // File row number (not index) from which this record originated