Beispiel #1
0
Datei: ofApp.cpp Projekt: whg/dst
void ofApp::newMidiMessage(ofxMidiMessage& msg) {

    if (msg.channel != 1) return;
    
    if (msg.status == MIDI_CONTROL_CHANGE) {
        if (msg.control == METER_CONTROL_NUMBER) {
            if (useDecay) {
                if (msg.value > audioValue) {
                    setMeter(msg.value);
                    audioValue = msg.value;
                }
            }
            else {
                setMeter(msg.value);
            }
        }
    }
    else if (msg.status == MIDI_NOTE_ON) {
    
        channels[1]->set(255);
    
//        for (const auto &pair : lightMap) {
//            auto lightIndex = pair.first;
//            auto lightName = pair.second;
//            if (msg.pitch == lightIndex) {
//                channels[lightIndex]->set(msg.velocity * 2);
//            }
//        }
//        if (msg.channel == 3) washCol.set(ofColor(msg.velocity * 2, washCol->g, washCol->b));
//        if (msg.channel == 4) washCol.set(ofColor(washCol->r, msg.velocity * 2, washCol->b));
//        if (msg.channel == 5) washCol.set(ofColor(washCol->r, washCol->g, msg.velocity * 2));
//        
//        if (msg.channel == 6) {
//            channels[55]->set(msg.velocity*2);
//        }
    }
    else if (msg.status == MIDI_NOTE_OFF) {
    
        channels[1]->set(0);
    
//        for (const auto &pair : lightMap) {
//            auto lightIndex = pair.first;
//            auto lightName = pair.second;
//            if (msg.pitch == lightIndex) {
//                channels[lightIndex]->set(0);
//            }
//        }
//        if (msg.channel == 3) washCol.set(ofColor(0, washCol->g, washCol->b));
//        if (msg.channel == 4) washCol.set(ofColor(washCol->r, 0, washCol->b));
//        if (msg.channel == 5) washCol.set(ofColor(washCol->r, washCol->g, 0));
//
//        if (msg.channel == 6) {
//            channels[55]->set(0);
//        }
    }
}
Beispiel #2
0
void TmultiScore::setMeter(const Tmeter& m) {
  bool meterCreated = m.meter() != Tmeter::e_none && !scoreScene()->scoreMeter();
  // TODO: what with case of disabling meter?
  if (meterCreated) {
    staff()->setMeter(m);
    connect(scoreScene()->scoreMeter(), &TscoreMeter::meterChanged, [=]{ setMeter(*scoreScene()->scoreMeter()->meter()); });
  // TODO; all staves as well
  // TODO: following call will introduce measures recalculation, so updating every note (and staff) from above is not necessary there
  }
//   scoreScene()->measureDispatcher()->setScoreMeter(scoreScene()->scoreMeter());
}