Exemplo n.º 1
0
OscillatorNode::OscillatorNode(BaseAudioContext& context)
    : AudioScheduledSourceNode(context),
      // Use musical pitch standard A440 as a default.
      m_frequency(AudioParam::create(context,
                                     ParamTypeOscillatorFrequency,
                                     440,
                                     -context.sampleRate() / 2,
                                     context.sampleRate() / 2)),
      // Default to no detuning.
      m_detune(AudioParam::create(context, ParamTypeOscillatorDetune, 0)) {
  setHandler(OscillatorHandler::create(*this, context.sampleRate(),
                                       m_frequency->handler(),
                                       m_detune->handler()));
}
Exemplo n.º 2
0
IIRFilterNode::IIRFilterNode(BaseAudioContext& context,
                             const Vector<double> feedforwardCoef,
                             const Vector<double> feedbackCoef)
    : AudioNode(context) {
  setHandler(AudioBasicProcessorHandler::create(
      AudioHandler::NodeTypeIIRFilter, *this, context.sampleRate(),
      wrapUnique(new IIRProcessor(context.sampleRate(), 1, feedforwardCoef,
                                  feedbackCoef))));

  // Histogram of the IIRFilter order.  createIIRFilter ensures that the length
  // of |feedbackCoef| is in the range [1, IIRFilter::kMaxOrder + 1].  The order
  // is one less than the length of this vector.
  DEFINE_STATIC_LOCAL(SparseHistogram, filterOrderHistogram,
                      ("WebAudio.IIRFilterNode.Order"));

  filterOrderHistogram.sample(feedbackCoef.size() - 1);
}
Exemplo n.º 3
0
ChannelMergerNode::ChannelMergerNode(BaseAudioContext& context,
                                     unsigned numberOfInputs)
    : AudioNode(context) {
  setHandler(ChannelMergerHandler::create(*this, context.sampleRate(),
                                          numberOfInputs));
}
Exemplo n.º 4
0
StereoPannerNode::StereoPannerNode(BaseAudioContext& context)
    : AudioNode(context),
      m_pan(AudioParam::create(context, ParamTypeStereoPannerPan, 0, -1, 1)) {
  setHandler(StereoPannerHandler::create(*this, context.sampleRate(),
                                         m_pan->handler()));
}
Exemplo n.º 5
0
ConvolverNode::ConvolverNode(BaseAudioContext& context) : AudioNode(context) {
  setHandler(ConvolverHandler::create(*this, context.sampleRate()));
}