コード例 #1
0
ファイル: OscillatorNode.cpp プロジェクト: mirror/chromium
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()));
}
コード例 #2
0
TEST_F(BaseAudioContextTest, AutoplayMetrics_NodeStartNoGesture) {
  HistogramTester histogramTester;
  createChildFrame();
  childDocument().settings()->setMediaPlaybackRequiresUserGesture(true);

  BaseAudioContext* audioContext =
      BaseAudioContext::create(childDocument(), ASSERT_NO_EXCEPTION);
  audioContext->maybeRecordStartAttempt();
  recordAutoplayStatus(audioContext);

  histogramTester.expectBucketCount(kCrossOriginMetric,
                                    AutoplayStatus::AutoplayStatusFailed, 1);
  histogramTester.expectTotalCount(kCrossOriginMetric, 1);
}
コード例 #3
0
ファイル: IIRFilterNode.cpp プロジェクト: mirror/chromium
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);
}
コード例 #4
0
TEST_F(BaseAudioContextTest, AutoplayMetrics_CallResumeNoGesture) {
  HistogramTester histogramTester;
  createChildFrame();
  childDocument().settings()->setMediaPlaybackRequiresUserGesture(true);

  ScriptState::Scope scope(getScriptStateFrom(childDocument()));

  BaseAudioContext* audioContext =
      BaseAudioContext::create(childDocument(), ASSERT_NO_EXCEPTION);
  audioContext->resumeContext(getScriptStateFrom(childDocument()));
  rejectPendingResolvers(audioContext);
  recordAutoplayStatus(audioContext);

  histogramTester.expectBucketCount(kCrossOriginMetric,
                                    AutoplayStatus::AutoplayStatusFailed, 1);
  histogramTester.expectTotalCount(kCrossOriginMetric, 1);
}
コード例 #5
0
TEST_F(BaseAudioContextTest, AutoplayMetrics_NodeStartGestureThenSucces) {
  HistogramTester histogramTester;
  createChildFrame();
  childDocument().settings()->setMediaPlaybackRequiresUserGesture(true);

  ScriptState::Scope scope(getScriptStateFrom(childDocument()));

  BaseAudioContext* audioContext =
      BaseAudioContext::create(childDocument(), ASSERT_NO_EXCEPTION);

  UserGestureIndicator userGestureScope(DocumentUserGestureToken::create(
      &childDocument(), UserGestureToken::NewGesture));
  audioContext->maybeRecordStartAttempt();
  audioContext->resumeContext(getScriptStateFrom(childDocument()));
  rejectPendingResolvers(audioContext);
  recordAutoplayStatus(audioContext);

  histogramTester.expectBucketCount(kCrossOriginMetric,
                                    AutoplayStatus::AutoplayStatusSucceeded, 1);
  histogramTester.expectTotalCount(kCrossOriginMetric, 1);
}
コード例 #6
0
ファイル: ChannelMergerNode.cpp プロジェクト: mirror/chromium
ChannelMergerNode::ChannelMergerNode(BaseAudioContext& context,
                                     unsigned numberOfInputs)
    : AudioNode(context) {
  setHandler(ChannelMergerHandler::create(*this, context.sampleRate(),
                                          numberOfInputs));
}
コード例 #7
0
ファイル: StereoPannerNode.cpp プロジェクト: mirror/chromium
StereoPannerNode::StereoPannerNode(BaseAudioContext& context)
    : AudioNode(context),
      m_pan(AudioParam::create(context, ParamTypeStereoPannerPan, 0, -1, 1)) {
  setHandler(StereoPannerHandler::create(*this, context.sampleRate(),
                                         m_pan->handler()));
}
コード例 #8
0
ファイル: ConvolverNode.cpp プロジェクト: ollie314/chromium
ConvolverNode::ConvolverNode(BaseAudioContext& context) : AudioNode(context) {
  setHandler(ConvolverHandler::create(*this, context.sampleRate()));
}