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


C++ AudioMixerClientData::clearStagedIgnoreChanges方法代码示例

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


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

示例1: prepareMix


//.........这里部分代码省略.........
                      isSoloing);

            if (shouldBeInactive(stream)) {
                // To reduce artifacts we still call render to flush the HRTF for every silent
                // sources on the first frame where the source becomes silent
                // this ensures the correct tail from last mixed block
                streams.inactive.push_back(move(stream));
                ++stats.activeToInactive;
                return true;
            }
        }

        return false;
    });

    if (isThrottling) {
        // since we're throttling, we need to partition the mixable into throttled and unthrottled streams
        int numToRetain = min(_numToRetain, (int)streams.active.size()); // Make sure we don't overflow
        auto throttlePoint = begin(streams.active) + numToRetain;

        std::nth_element(streams.active.begin(), throttlePoint, streams.active.end(),
                         [](const auto& a, const auto& b)
                         {
                             return a.approximateVolume > b.approximateVolume;
                         });

        SegmentedEraseIf<MixableStreamsVector> erase(streams.active);
        erase.iterateTo(throttlePoint, [&](MixableStream& stream) {
            if (shouldBeSkipped(stream, *listener, *listenerAudioStream, *listenerData)) {
                resetHRTFState(stream);
                streams.skipped.push_back(move(stream));
                ++stats.activeToSkipped;
                return true;
            }

            addStream(stream, *listenerAudioStream, listenerData->getMasterAvatarGain(),
                      isSoloing);

            if (shouldBeInactive(stream)) {
                // To reduce artifacts we still call render to flush the HRTF for every silent
                // sources on the first frame where the source becomes silent
                // this ensures the correct tail from last mixed block
                streams.inactive.push_back(move(stream));
                ++stats.activeToInactive;
                return true;
            }

            return false;
        });
        erase.iterateTo(end(streams.active), [&](MixableStream& stream) {
            // To reduce artifacts we reset the HRTF state for every throttled
            // sources on the first frame where the source becomes throttled
            // this ensures at least remove the tail from last mixed block
            // preventing excessive artifacts on the next first block
            resetHRTFState(stream);

            if (shouldBeSkipped(stream, *listener, *listenerAudioStream, *listenerData)) {
                streams.skipped.push_back(move(stream));
                ++stats.activeToSkipped;
                return true;
            }

            if (shouldBeInactive(stream)) {
                streams.inactive.push_back(move(stream));
                ++stats.activeToInactive;
                return true;
            }

            return false;
        });
    }

    stats.skipped += (int)streams.skipped.size();
    stats.inactive += (int)streams.inactive.size();
    stats.active += (int)streams.active.size();

    // clear the newly ignored, un-ignored, ignoring, and un-ignoring streams now that we've processed them
    listenerData->clearStagedIgnoreChanges();

#ifdef HIFI_AUDIO_MIXER_DEBUG
    auto mixEnd = p_high_resolution_clock::now();
    auto mixTime = std::chrono::duration_cast<std::chrono::nanoseconds>(mixEnd - mixStart);
    stats.mixTime += mixTime.count();
#endif

    // check for silent audio before limiting
    // limiting uses a dither and can only guarantee abs(sample) <= 1
    bool hasAudio = false;
    for (int i = 0; i < AudioConstants::NETWORK_FRAME_SAMPLES_STEREO; ++i) {
        if (_mixSamples[i] != 0.0f) {
            hasAudio = true;
            break;
        }
    }

    // use the per listener AudioLimiter to render the mixed data
    listenerData->audioLimiter.render(_mixSamples, _bufferSamples, AudioConstants::NETWORK_FRAME_SAMPLES_PER_CHANNEL);

    return hasAudio;
}
开发者ID:Menithal,项目名称:hifi,代码行数:101,代码来源:AudioMixerSlave.cpp


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