当前位置: 首页>>代码示例>>C++>>正文


C++ Note::getDuration方法代码示例

本文整理汇总了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";
}
开发者ID:UIKit0,项目名称:rosegarden,代码行数:67,代码来源:NotationStrings.cpp

示例2: canAdd

 bool Measure::canAdd( const Note& note ) const
 {
     return canAdd( note.getDuration() );
 }
开发者ID:Webern,项目名称:Entropy,代码行数:4,代码来源:Measure.cpp

示例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();

}
开发者ID:Kollgergo,项目名称:Counterpoint-project,代码行数:101,代码来源:playback.cpp


注:本文中的Note::getDuration方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。