本文整理汇总了C++中TrackPointer::getKeys方法的典型用法代码示例。如果您正苦于以下问题:C++ TrackPointer::getKeys方法的具体用法?C++ TrackPointer::getKeys怎么用?C++ TrackPointer::getKeys使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TrackPointer
的用法示例。
在下文中一共展示了TrackPointer::getKeys方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadStored
bool AnalyzerKey::loadStored(TrackPointer tio) const {
bool bPreferencesFastAnalysisEnabled = static_cast<bool>(
m_pConfig->getValueString(
ConfigKey(KEY_CONFIG_KEY, KEY_FAST_ANALYSIS)).toInt());
QString library = m_pConfig->getValueString(
ConfigKey(VAMP_CONFIG_KEY, VAMP_ANALYZER_KEY_LIBRARY));
QString pluginID = m_pConfig->getValueString(
ConfigKey(VAMP_CONFIG_KEY, VAMP_ANALYZER_KEY_PLUGIN_ID));
// TODO(rryan): This belongs elsewhere.
if (library.isEmpty() || library.isNull())
library = "libmixxxminimal";
// TODO(rryan): This belongs elsewhere.
if (pluginID.isEmpty() || pluginID.isNull())
pluginID = VAMP_ANALYZER_KEY_DEFAULT_PLUGIN_ID;
const Keys& keys = tio->getKeys();
if (keys.isValid()) {
QString version = keys.getVersion();
QString subVersion = keys.getSubVersion();
QHash<QString, QString> extraVersionInfo = getExtraVersionInfo(
pluginID, bPreferencesFastAnalysisEnabled);
QString newVersion = KeyFactory::getPreferredVersion();
QString newSubVersion = KeyFactory::getPreferredSubVersion(extraVersionInfo);
if (version == newVersion && subVersion == newSubVersion) {
// If the version and settings have not changed then if the world is
// sane, re-analyzing will do nothing.
qDebug() << "Keys version/sub-version unchanged since previous analysis. Not analyzing.";
return true;
} else if (m_bPreferencesReanalyzeEnabled) {
return false;
} else {
qDebug() << "Track has previous key detection result that is not up"
<< "to date with latest settings but user preferences"
<< "indicate we should not re-analyze it.";
return true;
}
} else {
// If we got here, we want to analyze this track.
return false;
}
}
示例2: initialise
// TODO(XXX): Get rid of the horrible duplication here between initialise and
// loadStored.
bool AnalyserKey::initialise(TrackPointer tio, int sampleRate, int totalSamples) {
if (totalSamples == 0) {
return false;
}
m_bPreferencesKeyDetectionEnabled = static_cast<bool>(
m_pConfig->getValueString(
ConfigKey(KEY_CONFIG_KEY, KEY_DETECTION_ENABLED)).toInt());
if (!m_bPreferencesKeyDetectionEnabled) {
qDebug() << "Key detection is deactivated";
return false;
}
m_bPreferencesFastAnalysisEnabled = static_cast<bool>(
m_pConfig->getValueString(
ConfigKey(KEY_CONFIG_KEY, KEY_FAST_ANALYSIS)).toInt());
m_bPreferencesReanalyzeEnabled = static_cast<bool>(
m_pConfig->getValueString(
ConfigKey(KEY_CONFIG_KEY, KEY_REANALYZE_WHEN_SETTINGS_CHANGE)).toInt());
QString library = m_pConfig->getValueString(
ConfigKey(VAMP_CONFIG_KEY, VAMP_ANALYSER_KEY_LIBRARY),
// TODO(rryan) this default really doesn't belong here.
"libmixxxminimal");
QString pluginID = m_pConfig->getValueString(
ConfigKey(VAMP_CONFIG_KEY, VAMP_ANALYSER_KEY_PLUGIN_ID),
// TODO(rryan) this default really doesn't belong here.
VAMP_ANALYSER_KEY_DEFAULT_PLUGIN_ID);
m_pluginId = pluginID;
m_iSampleRate = sampleRate;
m_iTotalSamples = totalSamples;
bool bShouldAnalyze = false;
const Keys& keys = tio->getKeys();
if (keys.isValid()) {
QString version = keys.getVersion();
QString subVersion = keys.getSubVersion();
QHash<QString, QString> extraVersionInfo = getExtraVersionInfo(
m_pluginId, m_bPreferencesFastAnalysisEnabled);
QString newVersion = KeyFactory::getPreferredVersion();
QString newSubVersion = KeyFactory::getPreferredSubVersion(extraVersionInfo);
if (version == newVersion && subVersion == newSubVersion) {
// If the version and settings have not changed then if the world is
// sane, re-analyzing will do nothing.
bShouldAnalyze = false;
qDebug() << "Keys version/sub-version unchanged since previous analysis. Not analyzing.";
} else if (m_bPreferencesReanalyzeEnabled) {
bShouldAnalyze = true;
} else {
bShouldAnalyze = false;
qDebug() << "Track has previous key detection result that is not up"
<< "to date with latest settings but user preferences"
<< "indicate we should not re-analyze it.";
}
} else {
// No valid keys stored so we want to analyze this track.
bShouldAnalyze = true;
}
if (bShouldAnalyze) {
m_pVamp = new VampAnalyser(m_pConfig);
bShouldAnalyze = m_pVamp->Init(
library, m_pluginId, sampleRate, totalSamples,
m_bPreferencesFastAnalysisEnabled);
if (!bShouldAnalyze) {
delete m_pVamp;
m_pVamp = NULL;
}
}
if (bShouldAnalyze) {
qDebug() << "Key calculation started with plugin" << m_pluginId;
} else {
qDebug() << "Key calculation will not start.";
}
return bShouldAnalyze;
}