/* * Midi clock tick triggered from external clock */ void FluidPlayer::musicTick() { // If we use an external device to set the bpm, then we get around // Openframeworks updating at a low fps screwing with the clock //One crotchet per 24 ticks if(clockTick % CROTCHET == 0) { isBeat = true; beatDirty = true; //Set the beat as dirty so OF updates it when it has time //Get the bpm from the last 4 notes if( beatCount >= lowerTimesig) beatCount = 0; if(beatCount == 0) { isBar = true; firstBeatMs = ofGetElapsedTimeMillis(); ofLog(OF_LOG_NOTICE, "NEW BAR"); } else { ofLog(OF_LOG_NOTICE, "BEAT"); } if(ofGetElapsedTimeMillis() - firstBeatMs != 0) bpm = 60000 * beatCount / (ofGetElapsedTimeMillis() - firstBeatMs); if(clockPeriodValue >= upperTimesig-1) { clockPeriodValue = 0; clockTick = 0; } else { clockPeriodValue++; } beatCount++; } else if(clockTick % DEMISEMIQUAVER == 0) { sendNotes(); } else if(clockTick % baseNoteMessageLength) { ofLog(OF_LOG_VERBOSE, "Smallest note"); isBeat = false; isBar = false; m_activeInstrument.tickNoteParams(); sendCC(); } clockPastTime = ofGetElapsedTimeMillis(); //int clockTick++; //int }
void Dmc3xlTimeline::onChange(Knob *sender) { #ifdef DEBUG debugString("Dmc3xlTimeline::onChange"); debug(sender->pin); debug(sender->value); debug(sender->lastValue); #endif _mappedExpressionValue = map(sender->value, 25, 990, 0, _maxExpressionValue); //debug(_mappedExpressionValue); _mappedExpressionValue = constrain(_mappedExpressionValue, 0, _maxExpressionValue); //debug(_mappedExpressionValue); sendCC(_expressionCC, _mappedExpressionValue); }