Esempio n. 1
0
void BpmControl::slotAdjustBeatsSlower(double v) {
    BeatsPointer pBeats = m_pBeats;
    if (v > 0 && pBeats && (pBeats->getCapabilities() & Beats::BEATSCAP_SETBPM)) {
        double new_bpm = math_max(10.0, pBeats->getBpm() - .01);
        pBeats->setBpm(new_bpm);
    }
}
Esempio n. 2
0
void BpmControl::slotTapFilter(double averageLength, int numSamples) {
    // averageLength is the average interval in milliseconds tapped over
    // numSamples samples.  Have to convert to BPM now:

    if (averageLength <= 0)
        return;

    if (numSamples < 4)
        return;

    BeatsPointer pBeats = m_pBeats;
    if (!pBeats)
        return;

    // (60 seconds per minute) * (1000 milliseconds per second) / (X millis per
    // beat) = Y beats/minute
    double averageBpm = 60.0 * 1000.0 / averageLength / calcRateRatio();
    pBeats->setBpm(averageBpm);
}