本文整理汇总了C++中KeySigEvent::setAccidentalType方法的典型用法代码示例。如果您正苦于以下问题:C++ KeySigEvent::setAccidentalType方法的具体用法?C++ KeySigEvent::setAccidentalType怎么用?C++ KeySigEvent::setAccidentalType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KeySigEvent
的用法示例。
在下文中一共展示了KeySigEvent::setAccidentalType方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: read
void KeyList::read(QDomElement e, Score* cs)
{
for (e = e.firstChildElement(); !e.isNull(); e = e.nextSiblingElement()) {
QString tag(e.tagName());
if (tag == "key") {
KeySigEvent ke;
int tick = e.attribute("tick", "0").toInt();
if (e.hasAttribute("custom"))
ke.setCustomType(e.attribute("custom").toInt());
else
ke.setAccidentalType(e.attribute("idx").toInt());
(*this)[cs->fileDivision(tick)] = ke;
}
else
domError(e);
}
}
示例2: read
void KeyList::read(XmlReader& e, Score* cs)
{
while (e.readNextStartElement()) {
if (e.name() == "key") {
KeySigEvent ke;
int tick = e.intAttribute("tick", 0);
if (e.hasAttribute("custom"))
ke.setCustomType(e.intAttribute("custom"));
else
ke.setAccidentalType(e.intAttribute("idx"));
(*this)[cs->fileDivision(tick)] = ke;
e.readNext();
}
else
e.unknown();
}
}
示例3: convertTrack
void MTrack::convertTrack(const Fraction &lastTick)
{
Score* score = staff->score();
int key = 0; // TODO-LIB findKey(mtrack, score->sigmap());
int track = staff->idx() * VOICES;
int voices = VOICES;
for (int voice = 0; voice < voices; ++voice) {
// startChordTick is onTime value of all simultaneous notes
// chords here are consist of notes with equal durations
// several chords may have the same onTime value
Fraction startChordTick;
QList<MidiChord> midiChords;
for (auto it = chords.begin(); it != chords.end();) {
const Fraction &nextChordTick = it->first;
const MidiChord& midiChord = it->second;
if (midiChord.voice != voice) {
++it;
continue;
}
processPendingNotes(midiChords, voice, startChordTick, nextChordTick);
// now 'midiChords' list is empty
// so - fill it:
// collect all midiChords on current tick position
startChordTick = nextChordTick; // debug
for (;it != chords.end(); ++it) {
const MidiChord& midiChord = it->second;
if (it->first != startChordTick)
break;
if (midiChord.voice != voice)
continue;
midiChords.append(midiChord);
}
if (midiChords.isEmpty())
break;
}
// process last chords at the end of the score
processPendingNotes(midiChords, voice, startChordTick, lastTick);
}
createTuplets(track, score);
KeyList* km = staff->keymap();
if (!hasKey && !mtrack->drumTrack()) {
KeySigEvent ks;
ks.setAccidentalType(key);
(*km)[0] = ks;
}
for (auto it = km->begin(); it != km->end(); ++it) {
int tick = it->first;
KeySigEvent key = it->second;
KeySig* ks = new KeySig(score);
ks->setTrack(track);
ks->setGenerated(false);
ks->setKeySigEvent(key);
ks->setMag(staff->mag());
Measure* m = score->tick2measure(tick);
Segment* seg = m->getSegment(ks, tick);
seg->add(ks);
}
#if 0 // TODO
ClefList* cl = staff->clefList();
for (ciClefEvent i = cl->begin(); i != cl->end(); ++i) {
int tick = i.key();
Clef* clef = new Clef(score);
clef->setClefType(i.value());
clef->setTrack(track);
clef->setGenerated(false);
clef->setMag(staff->mag());
Measure* m = score->tick2measure(tick);
Segment* seg = m->getSegment(clef, tick);
seg->add(clef);
}
#endif
}
示例4: beginMeasure
void MsScWriter::beginMeasure(const Bww::MeasureBeginFlags mbf)
{
qDebug() << "MsScWriter::beginMeasure()";
++measureNumber;
// create a new measure
currentMeasure = new Measure(score);
currentMeasure->setTick(tick);
currentMeasure->setTimesig(Fraction(beats, beat));
currentMeasure->setNo(measureNumber);
score->measures()->add(currentMeasure);
if (mbf.repeatBegin)
currentMeasure->setRepeatFlags(RepeatStart);
if (mbf.irregular)
currentMeasure->setIrregular(true);
if (mbf.endingFirst || mbf.endingSecond) {
Volta* volta = new Volta(score);
volta->setTrack(0);
volta->endings().clear();
if (mbf.endingFirst) {
volta->setText("1");
volta->endings().append(1);
ending = 1;
}
else {
volta->setText("2");
volta->endings().append(2);
ending = 2;
}
volta->setStartElement(currentMeasure);
currentMeasure->add(volta);
lastVolta = volta;
}
// set clef, key and time signature in the first measure
if (measureNumber == 1) {
// clef
Clef* clef = new Clef(score);
clef->setClefType(CLEF_G);
clef->setTrack(0);
Segment* s = currentMeasure->getSegment(clef, tick);
s->add(clef);
// keysig
KeySigEvent key;
key.setAccidentalType(2);
KeySig* keysig = new KeySig(score);
keysig->setKeySigEvent(key);
keysig->setTrack(0);
s = currentMeasure->getSegment(keysig, tick);
s->add(keysig);
// timesig
TimeSig* timesig = new TimeSig(score);
timesig->setSig(Fraction(beats, beat));
timesig->setTrack(0);
s = currentMeasure->getSegment(timesig, tick);
s->add(timesig);
}
}
示例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;
}
}