本文整理汇总了C++中Composition::getTimeSignatureChange方法的典型用法代码示例。如果您正苦于以下问题:C++ Composition::getTimeSignatureChange方法的具体用法?C++ Composition::getTimeSignatureChange怎么用?C++ Composition::getTimeSignatureChange使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Composition
的用法示例。
在下文中一共展示了Composition::getTimeSignatureChange方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: str
bool
MupExporter::write()
{
Composition *c = m_composition;
std::ofstream str(m_fileName.c_str(), std::ios::out);
if (!str) {
std::cerr << "MupExporter::write() - can't write file " << m_fileName
<< std::endl;
return false;
}
str << "score\n";
str << "\tstaffs=" << c->getNbTracks() << "\n";
int ts = c->getTimeSignatureCount();
std::pair<timeT, TimeSignature> tspair;
if (ts > 0)
tspair = c->getTimeSignatureChange(0);
str << "\ttime="
<< tspair.second.getNumerator() << "/"
<< tspair.second.getDenominator() << "\n";
for (int barNo = -1; barNo < c->getNbBars(); ++barNo) {
for (TrackId trackNo = c->getMinTrackId();
trackNo <= c->getMaxTrackId(); ++trackNo) {
if (barNo < 0) {
writeClefAndKey(str, trackNo);
continue;
}
if (barNo == 0 && trackNo == 0) {
str << "\nmusic\n";
}
str << "\t" << trackNo + 1 << ":";
Segment *s = 0;
timeT barStart = c->getBarStart(barNo);
timeT barEnd = c->getBarEnd(barNo);
for (Composition::iterator ci = c->begin(); ci != c->end(); ++ci) {
if ((*ci)->getTrack() == trackNo &&
(*ci)->getStartTime() < barEnd &&
(*ci)->getEndMarkerTime() > barStart) {
s = *ci;
break;
}
}
TimeSignature timeSig(c->getTimeSignatureAt(barStart));
if (!s) {
// write empty bar
writeInventedRests(str, timeSig, 0, barEnd - barStart);
continue;
}
if (s->getStartTime() > barStart) {
writeInventedRests(str, timeSig,
0, s->getStartTime() - barStart);
}
// Mup insists that every bar has the correct duration, and won't
// recover if one goes wrong. Keep careful tabs on this: it means
// that for example we have to round chord durations down where
// the next chord starts too soon
//!!! we _really_ can't cope with time sig changes yet!
timeT writtenDuration = writeBar(str, c, s, barStart, barEnd,
timeSig, trackNo);
if (writtenDuration < timeSig.getBarDuration()) {
RG_DEBUG << "writtenDuration: " << writtenDuration
<< ", bar duration " << timeSig.getBarDuration()
<< endl;
writeInventedRests(str, timeSig, writtenDuration,
timeSig.getBarDuration() - writtenDuration);
} else if (writtenDuration > timeSig.getBarDuration()) {
std::cerr << "WARNING: overfull bar in Mup export: duration " << writtenDuration
<< " into bar of duration " << timeSig.getBarDuration()
<< std::endl;
//!!! warn user
}
str << "\n";
}
if (barNo >= 0)
str << "bar" << std::endl;
}
str << "\n" << std::endl;
str.close();
return true;
}