Exemplo n.º 1
0
void DebugObserver::noteAdded(const Note &note)
{
	LOG("Note " << std::hex << (unsigned int)note.getPitch() << " added with "
            "velocity " << std::hex << (unsigned int)note.getVelocity());
}
Exemplo n.º 2
0
void DebugObserver::noteRemoved(const Note &note)
{
	LOG("Note " << std::hex << (unsigned int)note.getPitch() << " removed");
}
Exemplo n.º 3
0
void PlayBack::process()
{
    for(unsigned int i=0; i<staff.getNumOfNotes(); i++){

        Note note = staff.getNoteByNum(i+1);

        switch (staff.getNoteByNum(i+1).getPitch()) {
        case -24:
            if(accents.at(i)->getAccent() == Accent::flat){
                note--;
            }
            break;
        case -20:
            if(accents.at(i)->getAccent() == Accent::sharp){
                note++;
            }
            break;
        case -19:
            if(accents.at(i)->getAccent() == Accent::flat){
                note--;
            }
            break;
        case -13:
            if(accents.at(i)->getAccent() == Accent::sharp){
                note++;
            }
            break;
        case -12:
            if(accents.at(i)->getAccent() == Accent::flat){
                note--;
            }
            break;
        case -8:
            if(accents.at(i)->getAccent() == Accent::sharp){
                note++;
            }
            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();

}