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


C++ AudioContext::sampleRate方法代码示例

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


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

示例1: AudioBasicProcessorNode

WaveShaperNode::WaveShaperNode(AudioContext& context)
    : AudioBasicProcessorNode(context, context.sampleRate())
{
    m_processor = std::make_unique<WaveShaperProcessor>(context.sampleRate(), 1);
    setNodeType(NodeTypeWaveShaper);

    initialize();
}
开发者ID:ollie314,项目名称:webkit,代码行数:8,代码来源:WaveShaperNode.cpp

示例2: AudioNode

MediaElementAudioSourceNode::MediaElementAudioSourceNode(AudioContext& context, HTMLMediaElement& mediaElement)
    : AudioNode(context, context.sampleRate())
    , m_mediaElement(mediaElement)
    , m_sourceNumberOfChannels(0)
    , m_sourceSampleRate(0)
{
    // Default to stereo. This could change depending on what the media element .src is set to.
    addOutput(std::make_unique<AudioNodeOutput>(this, 2));

    setNodeType(NodeTypeMediaElementAudioSource);

    initialize();
}
开发者ID:Comcast,项目名称:WebKitForWayland,代码行数:13,代码来源:MediaElementAudioSourceNode.cpp

示例3: valueForContextTime

float AudioParamTimeline::valueForContextTime(AudioContext& context, float defaultValue, bool& hasValue)
{
    {
        std::unique_lock<Lock> lock(m_eventsMutex, std::try_to_lock);
        if (!lock.owns_lock() || !m_events.size() || context.currentTime() < m_events[0].time()) {
            hasValue = false;
            return defaultValue;
        }
    }

    // Ask for just a single value.
    float value;
    double sampleRate = context.sampleRate();
    double startTime = context.currentTime();
    double endTime = startTime + 1.1 / sampleRate; // time just beyond one sample-frame
    double controlRate = sampleRate / AudioNode::ProcessingSizeInFrames; // one parameter change per render quantum
    value = valuesForTimeRange(startTime, endTime, defaultValue, &value, 1, sampleRate, controlRate);

    hasValue = true;
    return value;
}
开发者ID:Comcast,项目名称:WebKitForWayland,代码行数:21,代码来源:AudioParamTimeline.cpp

示例4: AudioNode

PannerNode::PannerNode(AudioContext& context, float sampleRate)
    : AudioNode(context, sampleRate)
    , m_panningModel(PanningModelType::HRTF)
    , m_lastGain(-1.0)
    , m_connectionCount(0)
{
    // Load the HRTF database asynchronously so we don't block the Javascript thread while creating the HRTF database.
    m_hrtfDatabaseLoader = HRTFDatabaseLoader::createAndLoadAsynchronouslyIfNecessary(context.sampleRate());

    addInput(std::make_unique<AudioNodeInput>(this));
    addOutput(std::make_unique<AudioNodeOutput>(this, 2));

    // Node-specific default mixing rules.
    m_channelCount = 2;
    m_channelCountMode = ClampedMax;
    m_channelInterpretation = AudioBus::Speakers;

    m_distanceGain = AudioParam::create(context, "distanceGain", 1.0, 0.0, 1.0);
    m_coneGain = AudioParam::create(context, "coneGain", 1.0, 0.0, 1.0);

    m_position = FloatPoint3D(0, 0, 0);
    m_orientation = FloatPoint3D(1, 0, 0);
    m_velocity = FloatPoint3D(0, 0, 0);

    setNodeType(NodeTypePanner);

    initialize();
}
开发者ID:eocanha,项目名称:webkit,代码行数:28,代码来源:PannerNode.cpp

示例5: AudioNode

WaveShaperNode::WaveShaperNode(AudioContext& context)
    : AudioNode(context)
{
    setHandler(AudioBasicProcessorHandler::create(AudioHandler::NodeTypeWaveShaper, *this, context.sampleRate(), adoptPtr(new WaveShaperProcessor(context.sampleRate(), 1))));

    handler().initialize();
}
开发者ID:alexanderbill,项目名称:blink-crosswalk,代码行数:7,代码来源:WaveShaperNode.cpp


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