本文整理汇总了C++中Note::getDuration方法的典型用法代码示例。如果您正苦于以下问题:C++ Note::getDuration方法的具体用法?C++ Note::getDuration怎么用?C++ Note::getDuration使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Note
的用法示例。
在下文中一共展示了Note::getDuration方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QString
QString
NotationStrings::makeNoteMenuLabel(timeT duration,
bool brief,
timeT &errorReturn,
bool plural)
{
Note nearestNote = Note::getNearestNote(duration);
bool triplet = false;
errorReturn = 0;
if (duration == 0) return "0";
if (nearestNote.getDuration() != duration) {
Note tripletNote = Note::getNearestNote(duration * 3 / 2);
if (tripletNote.getDuration() == duration * 3 / 2) {
nearestNote = tripletNote;
triplet = true;
} else {
errorReturn = duration - nearestNote.getDuration();
duration = nearestNote.getDuration();
}
}
QSettings settings;
settings.beginGroup( GeneralOptionsConfigGroup );
GeneralConfigurationPage::NoteNameStyle noteNameStyle =
(GeneralConfigurationPage::NoteNameStyle) settings.value
("notenamestyle", GeneralConfigurationPage::Local).toUInt();
settings.endGroup();
if (brief) {
timeT wholeNote = Note(Note::Semibreve).getDuration();
if ((wholeNote / duration) * duration == wholeNote) {
return QString("1/%1").arg(wholeNote / duration);
} else if ((duration / wholeNote) * wholeNote == duration) {
return QString("%1/1").arg(duration / wholeNote);
} else if ((wholeNote /(duration*2/3)) * (duration*2/3) == wholeNote) {
return QString("3/%1").arg(wholeNote / (duration*1/3));
} else {
return tr("%1 ticks").arg(duration);
plural = false;
}
} else {
QString noteName;
switch (noteNameStyle) {
case GeneralConfigurationPage::American:
noteName = getAmericanName(nearestNote, plural, triplet);
break;
case GeneralConfigurationPage::Local:
noteName = getNoteName(nearestNote, plural, triplet);
break;
}
// Already internationalised, if appropriate
return noteName;
}
// "control reached end of non-void function" warning:
return "0";
}
示例2: canAdd
bool Measure::canAdd( const Note& note ) const
{
return canAdd( note.getDuration() );
}
示例3: process
//.........这里部分代码省略.........
}
break;
case -7:
if(accents.at(i)->getAccent() == Accent::flat){
note--;
}
break;
case -1:
if(accents.at(i)->getAccent() == Accent::sharp){
note++;
}
break;
case 0:
if(accents.at(i)->getAccent() == Accent::flat){
note--;
}
break;
case 4:
if(accents.at(i)->getAccent() == Accent::sharp){
note++;
}
break;
case 5:
if(accents.at(i)->getAccent() == Accent::flat){
note--;
}
break;
case 11:
if(accents.at(i)->getAccent() == Accent::sharp){
note++;
}
break;
case 12:
if(accents.at(i)->getAccent() == Accent::flat){
note--;
}
break;
case 16:
if(accents.at(i)->getAccent() == Accent::sharp){
note++;
}
break;
case 17:
if(accents.at(i)->getAccent() == Accent::flat){
note--;
}
break;
case 23:
if(accents.at(i)->getAccent() == Accent::sharp){
note++;
}
break;
case 24:
if(accents.at(i)->getAccent() == Accent::flat){
note--;
}
break;
default:
break;
}
if(!midi->isConnected()){
emit finished();
return;
}else{
midi->noteOn(/* note */ note.getPitch()+60, /* voice */ voice , velocity /*velocity */);
}
// midi.noteOn(/* note */ svm->getNoteByNum(2,i+1).getPitch()+60, /* voice */ 1 /* , velocity */);
//qDebug() << "noteon\n";
switch (note.getDuration()) {
case 1:
QThread::msleep(tempo*8);
break;
case 2:
QThread::msleep(tempo*4);
break;
case 4:
QThread::msleep(tempo*2);
break;
case 8:
QThread::msleep(tempo);
break;
default:
break;
}
if(!midi->isConnected()){
emit finished();
return;
}else{
midi->noteOff(/* note */ note.getPitch()+60, /* voice */ voice);
}
//qDebug() << "noteoff";
// midi.noteOff(/* note */ svm->getNoteByNum(2,i+1).getPitch()+60, /* voice */ 1 /* , velocity */);
}
emit finished();
//this->exit();
}