cwSfScore.h/cpp :

1. The SF score now includes measurement stats from previous performances
2. event_t now contains a pointer too the section to which the event belongs.
This commit is contained in:
kevin 2024-02-08 11:07:45 -05:00
parent 57d35b09db
commit 36496e8b79
2 changed files with 21 additions and 2 deletions

View File

@ -242,6 +242,20 @@ namespace cw
errLabel:
return rc;
}
rc_t _assign_section_to_events( sfscore_t* p )
{
for(unsigned si=0,ei=0; si<p->sectionN ; ++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(; ei<end_evt_idx; ++ei)
p->eventA[ 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;

View File

@ -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