Changeset 113769 in webkit


Ignore:
Timestamp:
Apr 10, 2012 2:28:57 PM (12 years ago)
Author:
crogers@google.com
Message:

AudioParam must support connections from audio-rate signals
https://bugs.webkit.org/show_bug.cgi?id=83524

Source/WebCore:

Reviewed by Eric Carlson.

In the Web Audio API, it's possible to connect one AudioNode to another AudioNode.
Similary we should allow an AudioNode to connect to an AudioParam, thus controlling
a parameter with an audio-rate signal. This is important in many audio processing
applications.

Test: webaudio/audioparam-connect-audioratesignal.html

Simple method name change of AudioParam::hasTimelineValues() to AudioParam::hasSampleAccurateValues().

  • Modules/webaudio/AudioGainNode.cpp:

(WebCore::AudioGainNode::process):

  • Modules/webaudio/AudioNode.cpp:

(WebCore::AudioNode::connect): Add connect() method from AudioNode -> AudioParam.
(WebCore):
(WebCore::AudioNode::disconnect):
(WebCore::AudioNode::finishDeref):
Use AudioNodeOutput::disconnectAll() instead of AudioNodeOutput::disconnectAllInputs().

  • Modules/webaudio/AudioNode.h: Add connect() method from AudioNode -> AudioParam.

(WebCore):
(AudioNode):

  • Modules/webaudio/AudioNode.idl: Add connect() method from AudioNode -> AudioParam.

Implement support for an AudioNodeOutput to fanout to multiple AudioParams.

  • Modules/webaudio/AudioNodeOutput.cpp:

(WebCore::AudioNodeOutput::AudioNodeOutput):
(WebCore::AudioNodeOutput::updateRenderingState): Update rendering state related to AudioParams.
(WebCore::AudioNodeOutput::pull): pull() must now take into account fanout to AudioParams for in-place processing.
(WebCore::AudioNodeOutput::fanOutCount):
(WebCore):
(WebCore::AudioNodeOutput::paramFanOutCount): New method keeping track of number of connections to AudioParams.
(WebCore::AudioNodeOutput::renderingParamFanOutCount): New method keeping track of number of connections to AudioParams for rendering.
(WebCore::AudioNodeOutput::addParam): Add a connection to an AudioParam.
(WebCore::AudioNodeOutput::removeParam): Remove a connection to an AudioParam.
(WebCore::AudioNodeOutput::disconnectAllParams): Remove all connections to AudioParams.
(WebCore::AudioNodeOutput::disconnectAll): New method to disconnect all AudioNodeInputs and AudioParams.

  • Modules/webaudio/AudioNodeOutput.h:

(AudioNodeOutput):

Allow an AudioParam to accept a connection from an AudioNodeOutput, thus being controlled
by an audio-rate signal.

  • Modules/webaudio/AudioParam.cpp:

(WebCore::AudioParam::calculateSampleAccurateValues): Calculates sample-accurate values from timeline or an AudioNode.
(WebCore):
(WebCore::AudioParam::calculateAudioRateSignalValues): Calculates sample-accurate values from an AudioNode.
(WebCore::AudioParam::calculateTimelineValues): Calculates sample-accurate values scheduled on the timeline.
(WebCore::AudioParam::connect): Connect from an AudioNodeOutput for control from an audio-rate signal.
(WebCore::AudioParam::disconnect): Disconnect from an AudioNodeOutput.

  • Modules/webaudio/AudioParam.h:

(WebCore):
(WebCore::AudioParam::AudioParam):
(WebCore::AudioParam::hasSampleAccurateValues): Change name from hasTimelineValues() and return true
either if we have timeline values or if we've been connected from an AudioNode.
(AudioParam):

Simple method name change of AudioParam::hasTimelineValues() to AudioParam::hasSampleAccurateValues().

  • Modules/webaudio/Oscillator.cpp:

(WebCore::Oscillator::calculateSampleAccuratePhaseIncrements):
(WebCore::Oscillator::process):

LayoutTests:

Reviewed by Eric Carlson.

  • webaudio/audioparam-connect-audioratesignal-expected.txt: Added.
  • webaudio/audioparam-connect-audioratesignal.html: Added.
  • webaudio/resources/audio-testing.js:

(createLinearRampBuffer):
(createConstantBuffer):

Location:
trunk
Files:
2 added
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r113759 r113769  
     12012-04-10  Chris Rogers  <crogers@google.com>
     2
     3        AudioParam must support connections from audio-rate signals
     4        https://bugs.webkit.org/show_bug.cgi?id=83524
     5
     6        Reviewed by Eric Carlson.
     7
     8        * webaudio/audioparam-connect-audioratesignal-expected.txt: Added.
     9        * webaudio/audioparam-connect-audioratesignal.html: Added.
     10        * webaudio/resources/audio-testing.js:
     11        (createLinearRampBuffer):
     12        (createConstantBuffer):
     13
    1142012-04-10  Abhishek Arya  <inferno@chromium.org>
    215
  • trunk/LayoutTests/webaudio/resources/audio-testing.js

    r109518 r113769  
    116116}
    117117
     118// Create a buffer of the given length with a linear ramp having values 0 <= x < 1.
     119function createLinearRampBuffer(context, sampleFrameLength) {
     120    var audioBuffer = context.createBuffer(1, sampleFrameLength, context.sampleRate);
     121    var n = audioBuffer.length;
     122    var dataL = audioBuffer.getChannelData(0);
     123
     124    for (var i = 0; i < n; ++i)
     125        dataL[i] = i / n;
     126
     127    return audioBuffer;
     128}
     129
     130// Create a buffer of the given length having a constant value.
     131function createConstantBuffer(context, sampleFrameLength, constantValue) {
     132    var audioBuffer = context.createBuffer(1, sampleFrameLength, context.sampleRate);
     133    var n = audioBuffer.length;
     134    var dataL = audioBuffer.getChannelData(0);
     135
     136    for (var i = 0; i < n; ++i)
     137        dataL[i] = constantValue;
     138
     139    return audioBuffer;
     140}
     141
    118142// Convert time (in seconds) to sample frames.
    119143function timeToSampleFrame(time, sampleRate) {
  • trunk/Source/WebCore/ChangeLog

    r113764 r113769  
     12012-04-10  Chris Rogers  <crogers@google.com>
     2
     3        AudioParam must support connections from audio-rate signals
     4        https://bugs.webkit.org/show_bug.cgi?id=83524
     5
     6        Reviewed by Eric Carlson.
     7       
     8        In the Web Audio API, it's possible to connect one AudioNode to another AudioNode.
     9        Similary we should allow an AudioNode to connect to an AudioParam, thus controlling
     10        a parameter with an audio-rate signal.  This is important in many audio processing
     11        applications.
     12
     13        Test: webaudio/audioparam-connect-audioratesignal.html
     14
     15        Simple method name change of AudioParam::hasTimelineValues() to AudioParam::hasSampleAccurateValues().
     16        * Modules/webaudio/AudioGainNode.cpp:
     17        (WebCore::AudioGainNode::process):
     18
     19        * Modules/webaudio/AudioNode.cpp:
     20        (WebCore::AudioNode::connect): Add connect() method from AudioNode -> AudioParam.
     21        (WebCore):
     22        (WebCore::AudioNode::disconnect):
     23        (WebCore::AudioNode::finishDeref):
     24        Use AudioNodeOutput::disconnectAll() instead of AudioNodeOutput::disconnectAllInputs().
     25        * Modules/webaudio/AudioNode.h: Add connect() method from AudioNode -> AudioParam.
     26        (WebCore):
     27        (AudioNode):
     28        * Modules/webaudio/AudioNode.idl: Add connect() method from AudioNode -> AudioParam.
     29
     30        Implement support for an AudioNodeOutput to fanout to multiple AudioParams.
     31        * Modules/webaudio/AudioNodeOutput.cpp:
     32        (WebCore::AudioNodeOutput::AudioNodeOutput):
     33        (WebCore::AudioNodeOutput::updateRenderingState): Update rendering state related to AudioParams.
     34        (WebCore::AudioNodeOutput::pull): pull() must now take into account fanout to AudioParams for in-place processing.
     35        (WebCore::AudioNodeOutput::fanOutCount):
     36        (WebCore):
     37        (WebCore::AudioNodeOutput::paramFanOutCount): New method keeping track of number of connections to AudioParams.
     38        (WebCore::AudioNodeOutput::renderingParamFanOutCount): New method keeping track of number of connections to AudioParams for rendering.
     39        (WebCore::AudioNodeOutput::addParam): Add a connection to an AudioParam.
     40        (WebCore::AudioNodeOutput::removeParam): Remove a connection to an AudioParam.
     41        (WebCore::AudioNodeOutput::disconnectAllParams): Remove all connections to AudioParams.
     42        (WebCore::AudioNodeOutput::disconnectAll): New method to disconnect all AudioNodeInputs and AudioParams.
     43        * Modules/webaudio/AudioNodeOutput.h:
     44        (AudioNodeOutput):
     45
     46        Allow an AudioParam to accept a connection from an AudioNodeOutput, thus being controlled
     47        by an audio-rate signal.
     48        * Modules/webaudio/AudioParam.cpp:
     49        (WebCore::AudioParam::calculateSampleAccurateValues): Calculates sample-accurate values from timeline or an AudioNode.
     50        (WebCore):
     51        (WebCore::AudioParam::calculateAudioRateSignalValues): Calculates sample-accurate values from an AudioNode.
     52        (WebCore::AudioParam::calculateTimelineValues): Calculates sample-accurate values scheduled on the timeline.
     53        (WebCore::AudioParam::connect): Connect from an AudioNodeOutput for control from an audio-rate signal.
     54        (WebCore::AudioParam::disconnect): Disconnect from an AudioNodeOutput.
     55        * Modules/webaudio/AudioParam.h:
     56        (WebCore):
     57        (WebCore::AudioParam::AudioParam):
     58        (WebCore::AudioParam::hasSampleAccurateValues): Change name from hasTimelineValues() and return true
     59        either if we have timeline values or if we've been connected from an AudioNode.
     60        (AudioParam):
     61
     62        Simple method name change of AudioParam::hasTimelineValues() to AudioParam::hasSampleAccurateValues().
     63        * Modules/webaudio/Oscillator.cpp:
     64        (WebCore::Oscillator::calculateSampleAccuratePhaseIncrements):
     65        (WebCore::Oscillator::process):
     66
    1672012-04-10  Patrick Gansterer  <paroga@webkit.org>
    268
  • trunk/Source/WebCore/Modules/webaudio/AudioGainNode.cpp

    r111474 r113769  
    6565        AudioBus* inputBus = input(0)->bus();
    6666
    67         if (gain()->hasTimelineValues()) {
     67        if (gain()->hasSampleAccurateValues()) {
    6868            // Apply sample-accurate gain scaling for precise envelopes, grain windows, etc.
    6969            ASSERT(framesToProcess <= m_sampleAccurateGainValues.size());
  • trunk/Source/WebCore/Modules/webaudio/AudioNode.cpp

    r113728 r113769  
    3232#include "AudioNodeInput.h"
    3333#include "AudioNodeOutput.h"
     34#include "AudioParam.h"
    3435#include "ExceptionCode.h"
    3536#include <wtf/Atomics.h>
     
    150151}
    151152
     153void AudioNode::connect(AudioParam* param, unsigned outputIndex, ExceptionCode& ec)
     154{
     155    ASSERT(isMainThread());
     156    AudioContext::AutoLocker locker(context());
     157
     158    if (!param) {
     159        ec = SYNTAX_ERR;
     160        return;
     161    }
     162
     163    if (outputIndex >= numberOfOutputs()) {
     164        ec = INDEX_SIZE_ERR;
     165        return;
     166    }
     167
     168    if (context() != param->context()) {
     169        ec = SYNTAX_ERR;
     170        return;
     171    }
     172
     173    AudioNodeOutput* output = this->output(outputIndex);
     174    param->connect(output);
     175}
     176
    152177void AudioNode::disconnect(unsigned outputIndex, ExceptionCode& ec)
    153178{
     
    162187
    163188    AudioNodeOutput* output = this->output(outputIndex);
    164     output->disconnectAllInputs();
     189    output->disconnectAll();
    165190}
    166191
     
    338363                // All references are gone - we need to go away.
    339364                for (unsigned i = 0; i < m_outputs.size(); ++i)
    340                     output(i)->disconnectAllInputs(); // this will deref() nodes we're connected to...
     365                    output(i)->disconnectAll(); // This will deref() nodes we're connected to.
    341366
    342367                // Mark for deletion at end of each render quantum or when context shuts down.
  • trunk/Source/WebCore/Modules/webaudio/AudioNode.h

    r113728 r113769  
    3838class AudioNodeInput;
    3939class AudioNodeOutput;
     40class AudioParam;
    4041
    4142typedef int ExceptionCode;
     
    117118    // Called from main thread by corresponding JavaScript methods.
    118119    void connect(AudioNode*, unsigned outputIndex, unsigned inputIndex, ExceptionCode&);
     120    void connect(AudioParam*, unsigned outputIndex, ExceptionCode&);
    119121    void disconnect(unsigned outputIndex, ExceptionCode&);
    120122
  • trunk/Source/WebCore/Modules/webaudio/AudioNode.idl

    r111474 r113769  
    3434            raises(DOMException);
    3535
     36        void connect(in AudioParam destination, in [Optional=DefaultIsUndefined] unsigned long output)
     37            raises(DOMException);
     38
    3639        void disconnect(in [Optional=DefaultIsUndefined] unsigned long output)
    3740            raises(DOMException);
  • trunk/Source/WebCore/Modules/webaudio/AudioNodeOutput.cpp

    r111474 r113769  
    3232#include "AudioContext.h"
    3333#include "AudioNodeInput.h"
     34#include "AudioParam.h"
    3435#include <wtf/Threading.h>
    3536
     
    4344    , m_isEnabled(true)
    4445    , m_renderingFanOutCount(0)
     46    , m_renderingParamFanOutCount(0)
    4547{
    4648    ASSERT(numberOfChannels <= AudioContext::maxNumberOfChannels());
     
    8183    updateNumberOfChannels();
    8284    m_renderingFanOutCount = fanOutCount();
     85    m_renderingParamFanOutCount = paramFanOutCount();
    8386}
    8487
     
    111114{
    112115    ASSERT(context()->isAudioThread());
    113     ASSERT(m_renderingFanOutCount > 0);
     116    ASSERT(m_renderingFanOutCount > 0 || m_renderingParamFanOutCount > 0);
    114117   
    115118    // Causes our AudioNode to process if it hasn't already for this render quantum.
     
    119122    // cause our node to process() only the first time, caching the output in m_internalOutputBus for subsequent calls.   
    120123   
    121     bool isInPlace = inPlaceBus && inPlaceBus->numberOfChannels() == numberOfChannels() && m_renderingFanOutCount == 1;
     124    bool isInPlace = inPlaceBus && inPlaceBus->numberOfChannels() == numberOfChannels() && (m_renderingFanOutCount + m_renderingParamFanOutCount) == 1;
    122125
    123126    // Setup the actual destination bus for processing when our node's process() method gets called in processIfNecessary() below.
     
    135138}
    136139
     140unsigned AudioNodeOutput::fanOutCount()
     141{
     142    ASSERT(context()->isGraphOwner());
     143    return m_inputs.size();
     144}
     145
     146unsigned AudioNodeOutput::paramFanOutCount()
     147{
     148    ASSERT(context()->isGraphOwner());
     149    return m_params.size();
     150}
     151
    137152unsigned AudioNodeOutput::renderingFanOutCount() const
    138153{
     
    140155}
    141156
    142 unsigned AudioNodeOutput::fanOutCount()
    143 {
    144     ASSERT(context()->isGraphOwner());
    145     return m_inputs.size();
     157unsigned AudioNodeOutput::renderingParamFanOutCount() const
     158{
     159    return m_renderingParamFanOutCount;
    146160}
    147161
     
    177191        input->disconnect(this);
    178192    }
     193}
     194
     195void AudioNodeOutput::addParam(AudioParam* param)
     196{
     197    ASSERT(context()->isGraphOwner());
     198
     199    ASSERT(param);
     200    if (!param)
     201        return;
     202
     203    m_params.add(param);
     204}
     205
     206void AudioNodeOutput::removeParam(AudioParam* param)
     207{
     208    ASSERT(context()->isGraphOwner());
     209
     210    ASSERT(param);
     211    if (!param)
     212        return;
     213
     214    m_params.remove(param);
     215}
     216
     217void AudioNodeOutput::disconnectAllParams()
     218{
     219    ASSERT(context()->isGraphOwner());
     220
     221    for (ParamsIterator i = m_params.begin(); i != m_params.end(); ++i) {
     222        AudioParam* param = *i;
     223        param->disconnect(this);
     224    }
     225
     226    m_params.clear();
     227}
     228
     229void AudioNodeOutput::disconnectAll()
     230{
     231    disconnectAllInputs();
     232    disconnectAllParams();
    179233}
    180234
  • trunk/Source/WebCore/Modules/webaudio/AudioNodeOutput.h

    r111474 r113769  
    5858    AudioBus* bus() const;
    5959
    60     // fanOutCount() is the number of AudioNodeInputs that we're connected to.
    61     // This function should not be called in audio thread rendering code, instead renderingFanOutCount() should be used.
    62     // It must be called with the context's graph lock.
    63     unsigned fanOutCount();
    64 
    6560    // renderingFanOutCount() is the number of AudioNodeInputs that we're connected to during rendering.
    6661    // Unlike fanOutCount() it will not change during the course of a render quantum.
    6762    unsigned renderingFanOutCount() const;
    6863
    69     // It must be called with the context's graph lock.
    70     void disconnectAllInputs();
     64    // renderingParamFanOutCount() is the number of AudioParams that we're connected to during rendering.
     65    // Unlike paramFanOutCount() it will not change during the course of a render quantum.
     66    unsigned renderingParamFanOutCount() const;
     67
     68    // Must be called with the context's graph lock.
     69    void disconnectAll();
    7170
    7271    void setNumberOfChannels(unsigned);
     
    8887
    8988    friend class AudioNodeInput;
     89    friend class AudioParam;
    9090   
    9191    // These are called from AudioNodeInput.
     
    9393    void addInput(AudioNodeInput*);
    9494    void removeInput(AudioNodeInput*);
     95    void addParam(AudioParam*);
     96    void removeParam(AudioParam*);
     97
     98    // fanOutCount() is the number of AudioNodeInputs that we're connected to.
     99    // This method should not be called in audio thread rendering code, instead renderingFanOutCount() should be used.
     100    // It must be called with the context's graph lock.
     101    unsigned fanOutCount();
     102
     103    // Similar to fanOutCount(), paramFanOutCount() is the number of AudioParams that we're connected to.
     104    // This method should not be called in audio thread rendering code, instead renderingParamFanOutCount() should be used.
     105    // It must be called with the context's graph lock.
     106    unsigned paramFanOutCount();
     107
     108    // Must be called with the context's graph lock.
     109    void disconnectAllInputs();
     110    void disconnectAllParams();
    95111
    96112    // updateInternalBus() updates m_internalBus appropriately for the number of channels.
     
    121137    typedef HashSet<AudioNodeInput*>::iterator InputsIterator;
    122138    bool m_isEnabled;
    123    
    124     // For the purposes of rendering, keeps track of the number of inputs we're connected to.
    125     // This value should only be changed at the very start or end of the rendering quantum.
     139
     140    // For the purposes of rendering, keeps track of the number of inputs and AudioParams we're connected to.
     141    // These value should only be changed at the very start or end of the rendering quantum.
    126142    unsigned m_renderingFanOutCount;
     143    unsigned m_renderingParamFanOutCount;
     144
     145    HashSet<AudioParam*> m_params;
     146    typedef HashSet<AudioParam*>::iterator ParamsIterator;
    127147};
    128148
  • trunk/Source/WebCore/Modules/webaudio/AudioParam.cpp

    r111474 r113769  
    3131
    3232#include "AudioNode.h"
     33#include "AudioNodeOutput.h"
    3334#include "AudioUtilities.h"
    3435#include "FloatConversion.h"
     
    9697void AudioParam::calculateSampleAccurateValues(float* values, unsigned numberOfValues)
    9798{
    98     bool isSafe = context() && context()->isAudioThread() && values;
     99    bool isSafe = context() && context()->isAudioThread() && values && numberOfValues;
    99100    ASSERT(isSafe);
    100101    if (!isSafe)
    101102        return;
    102103
     104    if (m_audioRateSignal)
     105        calculateAudioRateSignalValues(values, numberOfValues);
     106    else
     107        calculateTimelineValues(values, numberOfValues);
     108}
     109
     110void AudioParam::calculateAudioRateSignalValues(float* values, unsigned numberOfValues)
     111{
     112    // FIXME: support fan-in (multiple audio connections to this parameter with unity-gain summing).
     113    // https://bugs.webkit.org/show_bug.cgi?id=83610
     114    ASSERT(m_audioRateSignal);
     115
     116    AudioBus* bus = m_audioRateSignal->pull(0, numberOfValues);
     117    bool isBusGood = bus && bus->numberOfChannels() && bus->length() >= numberOfValues;
     118    ASSERT(isBusGood);
     119    if (!isBusGood)
     120        return;
     121
     122    if (bus->numberOfChannels() == 1) {
     123        // The normal case is to deal with a mono audio-rate signal.
     124        memcpy(values, bus->channel(0)->data(), sizeof(float) * numberOfValues);
     125    } else {
     126        // Do a standard mixdown to one channel if necessary.
     127        AudioBus wrapperBus(1, numberOfValues, false);
     128        wrapperBus.setChannelMemory(0, values, numberOfValues);
     129        wrapperBus.copyFrom(*bus); // Mixdown.
     130    }
     131    m_value = values[0]; // Update to first value.
     132}
     133
     134void AudioParam::calculateTimelineValues(float* values, unsigned numberOfValues)
     135{
    103136    // Calculate values for this render quantum.
    104137    // Normally numberOfValues will equal AudioNode::ProcessingSizeInFrames (the render quantum size).
     
    112145}
    113146
     147void AudioParam::connect(AudioNodeOutput* audioRateSignal)
     148{
     149    ASSERT(context()->isGraphOwner());
     150    ASSERT(audioRateSignal);
     151    if (!audioRateSignal)
     152        return;
     153
     154    if (m_audioRateSignal && m_audioRateSignal != audioRateSignal) {
     155        // Because we don't currently support fan-in we must explicitly disconnect from an old output.
     156        m_audioRateSignal->removeParam(this);
     157    }
     158
     159    audioRateSignal->addParam(this);
     160    m_audioRateSignal = audioRateSignal;
     161}
     162
     163void AudioParam::disconnect(AudioNodeOutput* audioRateSignal)
     164{
     165    ASSERT(context()->isGraphOwner());
     166    ASSERT(audioRateSignal);
     167    if (!audioRateSignal)
     168        return;
     169
     170    // FIXME: support fan-in (multiple audio connections to this parameter with unity-gain summing).
     171    // https://bugs.webkit.org/show_bug.cgi?id=83610
     172    if (m_audioRateSignal == audioRateSignal)
     173        m_audioRateSignal = 0;
     174}
     175
    114176} // namespace WebCore
    115177
  • trunk/Source/WebCore/Modules/webaudio/AudioParam.h

    r111474 r113769  
    4040namespace WebCore {
    4141
     42class AudioNodeOutput;
     43
    4244class AudioParam : public RefCounted<AudioParam> {
    4345public:
     
    5961        , m_smoothedValue(defaultValue)
    6062        , m_smoothingConstant(DefaultSmoothingConstant)
     63        , m_audioRateSignal(0)
    6164    {
    6265    }
     
    97100    void cancelScheduledValues(float startTime) { m_timeline.cancelScheduledValues(startTime); }
    98101
    99     bool hasTimelineValues() { return m_timeline.hasValues(); }
     102    bool hasSampleAccurateValues() { return m_timeline.hasValues() || m_audioRateSignal; }
    100103   
    101104    // Calculates numberOfValues parameter values starting at the context's current time.
     
    103106    void calculateSampleAccurateValues(float* values, unsigned numberOfValues);
    104107
     108    // Connect an audio-rate signal to control this parameter.
     109    void connect(AudioNodeOutput*);
     110    void disconnect(AudioNodeOutput*);
     111
    105112private:
     113    void calculateAudioRateSignalValues(float* values, unsigned numberOfValues);
     114    void calculateTimelineValues(float* values, unsigned numberOfValues);
     115
    106116    RefPtr<AudioContext> m_context;
    107117    String m_name;
     
    117127   
    118128    AudioParamTimeline m_timeline;
     129
     130    // An audio-rate signal directly providing parameter values.
     131    // FIXME: support fan-in (multiple audio connections to this parameter with unity-gain summing).
     132    // https://bugs.webkit.org/show_bug.cgi?id=83610
     133    AudioNodeOutput* m_audioRateSignal;
    119134};
    120135
  • trunk/Source/WebCore/Modules/webaudio/Oscillator.cpp

    r113245 r113769  
    113113        return false;
    114114
    115     bool hasTimelineValues = false;
     115    bool hasSampleAccurateValues = false;
    116116    bool hasFrequencyChanges = false;
    117117    float* phaseIncrements = m_phaseIncrements.data();
     
    119119    float finalScale = m_waveTable->rateScale();
    120120
    121     if (m_frequency->hasTimelineValues()) {
    122         hasTimelineValues = true;
     121    if (m_frequency->hasSampleAccurateValues()) {
     122        hasSampleAccurateValues = true;
    123123        hasFrequencyChanges = true;
    124124
     
    133133    }
    134134
    135     if (m_detune->hasTimelineValues()) {
    136         hasTimelineValues = true;
     135    if (m_detune->hasSampleAccurateValues()) {
     136        hasSampleAccurateValues = true;
    137137
    138138        // Get the sample-accurate detune values.
     
    158158    }
    159159
    160     if (hasTimelineValues) {
     160    if (hasSampleAccurateValues) {
    161161        // Convert from frequency to wavetable increment.
    162162        vsmul(phaseIncrements, 1, &finalScale, phaseIncrements, 1, framesToProcess);
    163163    }
    164164
    165     return hasTimelineValues;
     165    return hasSampleAccurateValues;
    166166}
    167167
     
    169169{
    170170    AudioBus* outputBus = output(0)->bus();
    171 
    172     outputBus->zero();
    173171
    174172    if (!isInitialized() || !outputBus->numberOfChannels()) {
     
    207205    float rateScale = m_waveTable->rateScale();
    208206    float invRateScale = 1 / rateScale;
    209     bool hasTimelineValues = calculateSampleAccuratePhaseIncrements(framesToProcess);
     207    bool hasSampleAccurateValues = calculateSampleAccuratePhaseIncrements(framesToProcess);
    210208
    211209    float frequency = 0;
     
    214212    float tableInterpolationFactor;
    215213
    216     if (!hasTimelineValues) {
     214    if (!hasSampleAccurateValues) {
    217215        frequency = m_frequency->smoothedValue();
    218216        float detune = m_detune->smoothedValue();
     
    235233        readIndex2 = readIndex2 & readIndexMask;
    236234
    237         if (hasTimelineValues) {
     235        if (hasSampleAccurateValues) {
    238236            incr = *phaseIncrements++;
    239237
Note: See TracChangeset for help on using the changeset viewer.