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


C++ AudioParameter::getFloat方法代码示例

本文整理汇总了C++中AudioParameter::getFloat方法的典型用法代码示例。如果您正苦于以下问题:C++ AudioParameter::getFloat方法的具体用法?C++ AudioParameter::getFloat怎么用?C++ AudioParameter::getFloat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AudioParameter的用法示例。


在下文中一共展示了AudioParameter::getFloat方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: setParameters

status_t AudioHardwareOutput::setParameters(const char* kvpairs) {
    AudioParameter param = AudioParameter(String8(kvpairs));
    status_t status = NO_ERROR;
    float floatVal;
    int intVal;
    Settings initial, s;

    {
        // Record the initial state of the settings from inside the lock.  Then
        // leave the lock in order to parse the changes to be made.
        Mutex::Autolock _l(mSettingsLock);
        initial = s = mSettings;
    }

    /***************************************************************
     *                     HDMI Audio Options                      *
     ***************************************************************/
    if (param.getInt(kHDMIAllowedParamKey, intVal) == NO_ERROR) {
        s.hdmi.allowed = (intVal != 0);
        param.remove(kHDMIAllowedParamKey);
    }

    if ((param.getFloat(kHDMIDelayCompParamKey, floatVal) == NO_ERROR) &&
        (floatVal >= 0.0) &&
        (floatVal <= AudioOutput::kMaxDelayCompensationMSec)) {
        uint32_t delay_comp = static_cast<uint32_t>(floatVal * 1000.0);
        s.hdmi.delayCompUsec = delay_comp;
        param.remove(kHDMIDelayCompParamKey);
    }

    if (param.getInt(kFixedHDMIOutputParamKey, intVal) == NO_ERROR) {
        s.hdmi.isFixed = (intVal != 0);
        param.remove(kFixedHDMIOutputParamKey);
    }

    if ((param.getFloat(kFixedHDMIOutputLevelParamKey, floatVal) == NO_ERROR)
        && (floatVal <= 0.0)) {
        s.hdmi.fixedLvl = floatVal;
        param.remove(kFixedHDMIOutputLevelParamKey);
    }

    /***************************************************************
     *                       Other Options                         *
     ***************************************************************/
    if ((param.getFloat(kVideoDelayCompParamKey, floatVal) == NO_ERROR) &&
        (floatVal >= 0.0) &&
        (floatVal <= AudioOutput::kMaxDelayCompensationMSec)) {
        s.videoDelayCompUsec = static_cast<uint32_t>(floatVal * 1000.0);
        param.remove(kVideoDelayCompParamKey);
    }

    if (param.size())
        status = BAD_VALUE;

    // If there was a change made to settings, go ahead and apply it now.
    bool allowedOutputsChanged = false;
    if (memcmp(&initial, &s, sizeof(initial)))  {
        Mutex::Autolock _l1(mOutputLock);
        Mutex::Autolock _l2(mSettingsLock);

        if (memcmp(&initial.hdmi, &s.hdmi, sizeof(initial.hdmi)))
            allowedOutputsChanged = allowedOutputsChanged ||
                applyOutputSettings_l(initial.hdmi, s.hdmi, mSettings.hdmi,
                                      HDMIAudioOutput::classDevMask());

        if (initial.videoDelayCompUsec != s.videoDelayCompUsec)
            mSettings.videoDelayCompUsec = s.videoDelayCompUsec;

        uint32_t tmp = 0;
        if (mSettings.hdmi.allowed && (tmp < mSettings.hdmi.delayCompUsec))
            tmp = mSettings.hdmi.delayCompUsec;
        if (mMaxDelayCompUsec != tmp)
            mMaxDelayCompUsec = tmp;
    }

    if (allowedOutputsChanged) {
        Mutex::Autolock _l(mStreamLock);
        updateTgtDevices_l();
    }

    return status;
}
开发者ID:MIPS,项目名称:device-asus-fugu,代码行数:82,代码来源:AudioHardwareOutput.cpp


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