本文整理汇总了C++中MeasureBase::setTick方法的典型用法代码示例。如果您正苦于以下问题:C++ MeasureBase::setTick方法的具体用法?C++ MeasureBase::setTick怎么用?C++ MeasureBase::setTick使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MeasureBase
的用法示例。
在下文中一共展示了MeasureBase::setTick方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addTitleToScore
void addTitleToScore(Score *score, const QString &string, int textCounter)
{
Text* text = new Text(score);
if (textCounter == 1)
text->setSubStyle(SubStyle::TITLE);
else if (textCounter == 2)
text->setSubStyle(SubStyle::COMPOSER);
text->setPlainText(string.right(string.size() - TEXT_PREFIX.size()));
MeasureBase* measure = score->first();
if (measure->type() != Element::Type::VBOX) {
measure = new VBox(score);
measure->setTick(0);
measure->setNext(score->first());
score->measures()->add(measure);
}
measure->add(text);
}
示例2: addTitleToScore
void addTitleToScore(Score *score, const QString &string, int textCounter)
{
Tid ssid = Tid::DEFAULT;
if (textCounter == 1)
ssid = Tid::TITLE;
else if (textCounter == 2)
ssid = Tid::COMPOSER;
Text* text = new Text(score, ssid);
text->setPlainText(string.right(string.size() - int(TEXT_PREFIX.size())));
MeasureBase* measure = score->first();
if (!measure->isVBox()) {
measure = new VBox(score);
measure->setTick(0);
measure->setNext(score->first());
score->measures()->add(measure);
}
measure->add(text);
}
示例3: addTitle
void addTitle(Score *score, const QString &string, int *textCounter)
{
if (string.left(TEXT_PREFIX.size()) == QString::fromStdString(TEXT_PREFIX)) {
++*textCounter;
Text* text = new Text(score);
if (*textCounter == 1)
text->setTextStyleType(TextStyleType::TITLE);
else if (*textCounter == 2)
text->setTextStyleType(TextStyleType::COMPOSER);
text->setText(string.right(string.size() - TEXT_PREFIX.size()));
MeasureBase* measure = score->first();
if (measure->type() != Element::Type::VBOX) {
measure = new VBox(score);
measure->setTick(0);
measure->setNext(score->first());
score->measures()->add(measure);
}
measure->add(text);
}
}
示例4: readStaff
void Score::readStaff(XmlReader& e)
{
int staff = e.intAttribute("id", 1) - 1;
int measureIdx = 0;
e.setCurrentMeasureIndex(0);
e.initTick(0);
e.setTrack(staff * VOICES);
if (staff == 0) {
while (e.readNextStartElement()) {
const QStringRef& tag(e.name());
if (tag == "Measure") {
Measure* measure = 0;
measure = new Measure(this);
measure->setTick(e.tick());
e.setCurrentMeasureIndex(measureIdx++);
//
// inherit timesig from previous measure
//
Measure* m = e.lastMeasure(); // measure->prevMeasure();
Fraction f(m ? m->timesig() : Fraction(4,4));
measure->setLen(f);
measure->setTimesig(f);
measure->read(e, staff);
measure->checkMeasure(staff);
if (!measure->isMMRest()) {
measures()->add(measure);
e.setLastMeasure(measure);
e.initTick(measure->tick() + measure->ticks());
}
else {
// this is a multi measure rest
// always preceded by the first measure it replaces
Measure* m1 = e.lastMeasure();
if (m1) {
m1->setMMRest(measure);
measure->setTick(m1->tick());
}
}
}
else if (tag == "HBox" || tag == "VBox" || tag == "TBox" || tag == "FBox") {
MeasureBase* mb = toMeasureBase(Element::name2Element(tag, this));
mb->read(e);
mb->setTick(e.tick());
measures()->add(mb);
}
else if (tag == "tick")
e.initTick(fileDivision(e.readInt()));
else
e.unknown();
}
}
else {
Measure* measure = firstMeasure();
while (e.readNextStartElement()) {
const QStringRef& tag(e.name());
if (tag == "Measure") {
if (measure == 0) {
qDebug("Score::readStaff(): missing measure!");
measure = new Measure(this);
measure->setTick(e.tick());
measures()->add(measure);
}
e.initTick(measure->tick());
e.setCurrentMeasureIndex(measureIdx++);
measure->read(e, staff);
measure->checkMeasure(staff);
if (measure->isMMRest())
measure = e.lastMeasure()->nextMeasure();
else {
e.setLastMeasure(measure);
if (measure->mmRest())
measure = measure->mmRest();
else
measure = measure->nextMeasure();
}
}
else if (tag == "tick")
e.initTick(fileDivision(e.readInt()));
else
e.unknown();
}
}
}
示例5: processMeta
void MTrack::processMeta(int tick, const MidiEvent& mm)
{
if (!staff) {
qDebug("processMeta: no staff");
return;
}
const uchar* data = (uchar*)mm.edata();
int staffIdx = staff->idx();
Score* cs = staff->score();
switch (mm.metaType()) {
case META_TEXT:
case META_LYRIC: {
QString s((char*)data);
cs->addLyrics(tick, staffIdx, s);
}
break;
case META_TRACK_NAME:
name = (const char*)data;
break;
case META_TEMPO:
{
unsigned tempo = data[2] + (data[1] << 8) + (data[0] <<16);
double t = 1000000.0 / double(tempo);
cs->setTempo(tick, t);
// TODO: create TempoText
}
break;
case META_KEY_SIGNATURE:
{
int key = ((const char*)data)[0];
if (key < -7 || key > 7) {
qDebug("ImportMidi: illegal key %d", key);
break;
}
KeySigEvent ks;
ks.setAccidentalType(key);
(*staff->keymap())[tick] = ks;
hasKey = true;
}
break;
case META_COMPOSER: // mscore extension
case META_POET:
case META_TRANSLATOR:
case META_SUBTITLE:
case META_TITLE:
{
Text* text = new Text(cs);
switch(mm.metaType()) {
case META_COMPOSER:
text->setTextStyleType(TEXT_STYLE_COMPOSER);
break;
case META_TRANSLATOR:
text->setTextStyleType(TEXT_STYLE_TRANSLATOR);
break;
case META_POET:
text->setTextStyleType(TEXT_STYLE_POET);
break;
case META_SUBTITLE:
text->setTextStyleType(TEXT_STYLE_SUBTITLE);
break;
case META_TITLE:
text->setTextStyleType(TEXT_STYLE_TITLE);
break;
}
text->setText((const char*)(mm.edata()));
MeasureBase* measure = cs->first();
if (measure->type() != Element::VBOX) {
measure = new VBox(cs);
measure->setTick(0);
measure->setNext(cs->first());
cs->add(measure);
}
measure->add(text);
}
break;
case META_COPYRIGHT:
cs->setMetaTag("Copyright", QString((const char*)(mm.edata())));
break;
case META_TIME_SIGNATURE:
qDebug("midi: meta timesig: %d, division %d", tick, MScore::division);
cs->sigmap()->add(tick, Fraction(data[0], 1 << data[1]));
break;
default:
if (MScore::debugMode)
qDebug("unknown meta type 0x%02x", mm.metaType());
break;
}
}