Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1025)

Side by Side Diff: third_party/WebKit/Source/modules/webaudio/PannerNode.cpp

Issue 2839063003: Implement tail processing for AudioNodes (Closed)
Patch Set: Make declaration order consistent Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010, Google Inc. All rights reserved. 2 * Copyright (C) 2010, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 orientation_z)); 96 orientation_z));
97 } 97 }
98 98
99 PannerHandler::~PannerHandler() { 99 PannerHandler::~PannerHandler() {
100 Uninitialize(); 100 Uninitialize();
101 } 101 }
102 102
103 void PannerHandler::Process(size_t frames_to_process) { 103 void PannerHandler::Process(size_t frames_to_process) {
104 AudioBus* destination = Output(0).Bus(); 104 AudioBus* destination = Output(0).Bus();
105 105
106 if (!IsInitialized() || !Input(0).IsConnected() || !panner_.get()) { 106 if (!IsInitialized() || !panner_.get()) {
107 destination->Zero(); 107 destination->Zero();
108 return; 108 return;
109 } 109 }
110 110
111 AudioBus* source = Input(0).Bus(); 111 AudioBus* source = Input(0).Bus();
112 if (!source) { 112 if (!source) {
113 destination->Zero(); 113 destination->Zero();
114 return; 114 return;
115 } 115 }
116 116
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 current_orientation != last_orientation_; 631 current_orientation != last_orientation_;
632 632
633 if (has_moved) { 633 if (has_moved) {
634 last_position_ = current_position; 634 last_position_ = current_position;
635 last_orientation_ = current_orientation; 635 last_orientation_ = current_orientation;
636 636
637 MarkPannerAsDirty(PannerHandler::kAzimuthElevationDirty | 637 MarkPannerAsDirty(PannerHandler::kAzimuthElevationDirty |
638 PannerHandler::kDistanceConeGainDirty); 638 PannerHandler::kDistanceConeGainDirty);
639 } 639 }
640 } 640 }
641
642 bool PannerHandler::RequiresTailProcessing() const {
643 // If there's no panner set up yet, assume we require tail
644 // processing in case the HRTF panner is set later, which does
645 // require tail processing.
646 return panner_ ? panner_->RequiresTailProcessing() : true;
647 }
648
641 // ---------------------------------------------------------------- 649 // ----------------------------------------------------------------
642 650
643 PannerNode::PannerNode(BaseAudioContext& context) 651 PannerNode::PannerNode(BaseAudioContext& context)
644 : AudioNode(context), 652 : AudioNode(context),
645 position_x_(AudioParam::Create(context, kParamTypePannerPositionX, 0.0)), 653 position_x_(AudioParam::Create(context, kParamTypePannerPositionX, 0.0)),
646 position_y_(AudioParam::Create(context, kParamTypePannerPositionY, 0.0)), 654 position_y_(AudioParam::Create(context, kParamTypePannerPositionY, 0.0)),
647 position_z_(AudioParam::Create(context, kParamTypePannerPositionZ, 0.0)), 655 position_z_(AudioParam::Create(context, kParamTypePannerPositionZ, 0.0)),
648 orientation_x_( 656 orientation_x_(
649 AudioParam::Create(context, kParamTypePannerOrientationX, 1.0)), 657 AudioParam::Create(context, kParamTypePannerOrientationX, 1.0)),
650 orientation_y_( 658 orientation_y_(
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 visitor->Trace(position_z_); 806 visitor->Trace(position_z_);
799 807
800 visitor->Trace(orientation_x_); 808 visitor->Trace(orientation_x_);
801 visitor->Trace(orientation_y_); 809 visitor->Trace(orientation_y_);
802 visitor->Trace(orientation_z_); 810 visitor->Trace(orientation_z_);
803 811
804 AudioNode::Trace(visitor); 812 AudioNode::Trace(visitor);
805 } 813 }
806 814
807 } // namespace blink 815 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698