本文整理汇总了C++中System::AddMeasure方法的典型用法代码示例。如果您正苦于以下问题:C++ System::AddMeasure方法的具体用法?C++ System::AddMeasure怎么用?C++ System::AddMeasure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System
的用法示例。
在下文中一共展示了System::AddMeasure方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ImportString
bool DarmsInput::ImportString(std::string data_str) {
int len, res;
int pos = 0;
const char *data = data_str.c_str();
len = data_str.length();
m_doc->Reset( Raw );
System *system = new System();
Page *page = new Page();
m_staff = new Staff( 1 );
m_measure = new Measure( true, 1 );
m_layer = new Layer( 1 );
m_current_tie = NULL;
m_staff->AddLayer(m_layer);
m_measure->AddStaff( m_staff );
system->AddMeasure( m_measure );
// do this the C style, char by char
while (pos < len) {
char c = data[pos];
if (c == '!') {
LogDebug("DarmsInput: Global spec. at %i", pos);
res = do_globalSpec(pos, data);
if (res) pos = res;
// if notehead type was specified in the !Nx option preserve it
m_staff->notAnc = m_antique_notation;
} else if (isdigit(c) || c == '-' ) { // check for '-' too as note positions can be negative
//is number followed by '!' ? it is a clef
if (data[pos + 1] == '!') {
res = do_Clef(pos, data);
if (res) pos = res;
} else { // we assume it is a note
res = do_Note(pos, data, false);
if (res) pos = res;
}
} else if (c == 'R') {
res = do_Note(pos, data, true);
if (res) pos = res;
} else {
//if (!isspace(c))
//LogMessage("Other %c", c);
}
pos++;
}
// add miniaml scoreDef
StaffGrp *staffGrp = new StaffGrp();
StaffDef *staffDef = new StaffDef();
staffDef->SetStaffNo( 1 );
staffGrp->AddStaffDef( staffDef );
m_doc->m_scoreDef.AddStaffGrp( staffGrp );
page->AddSystem( system );
m_doc->AddPage( page );
return true;
}
示例2: parsePlainAndEasy
//.........这里部分代码省略.........
if (current_measure.clef)
delete current_measure.clef;
current_measure.clef = c;
} else {
// as above
if (current_note.clef)
delete current_note.clef;
current_note.clef = c;
}
}
//time signature change
else if ((incipit[i] == '@') && (i+1 < length)) {
MeterSig *meter = new MeterSig;
i += getTimeInfo( incipit, meter, i + 1);
if (current_measure.notes.size() == 0) {
if (current_measure.meter) {
delete current_measure.meter;
}
// When will this be deleted? Potential memory leak? LP
current_measure.meter = meter;
} else {
if (current_note.meter) {
delete current_note.meter;
}
current_note.meter = meter;
}
}
//key signature change
else if ((incipit[i] == '$') && (i+1 < length)) {
KeySig *k = new KeySig;
i += getKeyInfo( incipit, k, i + 1);
if (current_measure.notes.size() == 0) {
if (current_measure.key)
delete current_measure.key;
current_measure.key = k;
} else {
if (current_note.key)
delete current_note.key;
current_note.key = k;
}
}
i++;
}
// we need to add the last measure if it has no barLine at the end
if (current_measure.notes.size() != 0) {
//current_measure.barLine = "=-";
staff.push_back( current_measure );
current_measure.notes.clear();
}
m_doc->Reset( Raw );
Page *page = new Page();
System *system = new System();
int measure_count = 1;
std::vector<MeasureObject>::iterator it;
for ( it = staff.begin() ; it < staff.end(); it++ ) {
m_staff = new Staff( 1 );
m_measure = new Measure( true, measure_count );
m_layer = new Layer( );
m_layer->SetN( 1 );
m_staff->AddLayer(m_layer);
m_measure->AddStaff( m_staff );
system->AddMeasure( m_measure );
MeasureObject obj = *it;
convertMeasure( &obj );
measure_count++;
}
// add miniaml scoreDef
StaffGrp *staffGrp = new StaffGrp();
StaffDef *staffDef = new StaffDef();
staffDef->SetN( 1 );
staffDef->SetLines(5);
if (staffDefClef) {
staffDef->SetClefShape(staffDefClef->GetShape());
staffDef->SetClefLine(staffDefClef->GetLine());
staffDef->SetClefDis(staffDefClef->GetDis());
staffDef->SetClefDisPlace(staffDefClef->GetDisPlace());
delete staffDefClef;
}
staffGrp->AddStaffDef( staffDef );
m_doc->m_scoreDef.AddStaffGrp( staffGrp );
page->AddSystem( system );
m_doc->AddPage( page );
}