本文整理汇总了C++中TrackPointer::setBeats方法的典型用法代码示例。如果您正苦于以下问题:C++ TrackPointer::setBeats方法的具体用法?C++ TrackPointer::setBeats怎么用?C++ TrackPointer::setBeats使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TrackPointer
的用法示例。
在下文中一共展示了TrackPointer::setBeats方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: finalise
void AnalyserBeats::finalise(TrackPointer tio) {
if (m_pVamp == NULL) {
return;
}
// Call End() here, because the number of total samples may have been
// estimated incorrectly.
bool success = m_pVamp->End();
qDebug() << "Beat Calculation" << (success ? "complete" : "failed");
QVector<double> beats = m_pVamp->GetInitFramesVector();
delete m_pVamp;
m_pVamp = NULL;
if (beats.isEmpty()) {
qDebug() << "Could not detect beat positions from Vamp.";
return;
}
QHash<QString, QString> extraVersionInfo = getExtraVersionInfo(
m_pluginId, m_bPreferencesFastAnalysis);
BeatsPointer pBeats = BeatFactory::makePreferredBeats(
tio, beats, extraVersionInfo,
m_bPreferencesFixedTempo, m_bPreferencesOffsetCorrection,
m_iSampleRate, m_iTotalSamples,
m_iMinBpm, m_iMaxBpm);
BeatsPointer pCurrentBeats = tio->getBeats();
// If the track has no beats object then set our newly generated one
// regardless of beat lock.
if (!pCurrentBeats) {
tio->setBeats(pBeats);
return;
}
// If the track received the beat lock while we were analyzing it then we
// abort setting it.
if (tio->hasBpmLock()) {
qDebug() << "Track was BPM-locked as we were analysing it. Aborting analysis.";
return;
}
// If the user prefers to replace old beatgrids with newly generated ones or
// the old beatgrid has 0-bpm then we replace it.
bool zeroCurrentBpm = pCurrentBeats->getBpm() == 0.0f;
if (m_bPreferencesReanalyzeOldBpm || zeroCurrentBpm) {
if (zeroCurrentBpm) {
qDebug() << "Replacing 0-BPM beatgrid with a" << pBeats->getBpm()
<< "beatgrid.";
}
tio->setBeats(pBeats);
return;
}
// If we got here then the user doesn't want to replace the beatgrid but
// since the first beat is zero we'll apply the offset we just detected.
double currentFirstBeat = pCurrentBeats->findNextBeat(0);
double newFirstBeat = pBeats->findNextBeat(0);
if (currentFirstBeat == 0.0 && newFirstBeat > 0) {
pCurrentBeats->translate(newFirstBeat);
}
}