当前位置: 首页>>代码示例>>C++>>正文


C++ TrackPointer::getKeys方法代码示例

本文整理汇总了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;
    }
}
开发者ID:Pegasus-RPG,项目名称:mixxx,代码行数:46,代码来源:analyzerkey.cpp

示例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;
}
开发者ID:kain88-de,项目名称:mixxx,代码行数:83,代码来源:analyserkey.cpp


注:本文中的TrackPointer::getKeys方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。