示例#1
0
double BpmControl::updateLocalBpm() {
    double prev_local_bpm = m_pLocalBpm->get();
    double local_bpm = 0;
    BeatsPointer pBeats = m_pBeats;
    if (pBeats) {
        local_bpm = pBeats->getBpmAroundPosition(
                getSampleOfTrack().current, kLocalBpmSpan);
        if (local_bpm == -1) {
            local_bpm = m_pFileBpm->get();
        }
    } else {
        local_bpm = m_pFileBpm->get();
    }
    if (local_bpm != prev_local_bpm) {
        m_pLocalBpm->set(local_bpm);
        slotUpdateEngineBpm();
    }
    return local_bpm;
}
示例#2
0
void BpmControl::slotFileBpmChanged(double file_bpm) {
    // Adjust the file-bpm with the current setting of the rate to get the
    // engine BPM. We only do this for SYNC_NONE decks because EngineSync will
    // set our BPM if the file BPM changes. See SyncControl::fileBpmChanged().
    //qDebug() << "BpmControl::slotFileBpmChanged" << file_bpm;
    BeatsPointer pBeats = m_pBeats;
    if (pBeats) {
        const double beats_bpm =
                pBeats->getBpmAroundPosition(
                        getSampleOfTrack().current, kLocalBpmSpan);
        if (beats_bpm != -1) {
            m_pLocalBpm->set(beats_bpm);
        } else {
            m_pLocalBpm->set(file_bpm);
        }
    } else {
        m_pLocalBpm->set(file_bpm);
    }
    resetSyncAdjustment();
}