OLD | NEW |
---|---|
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 13 matching lines...) Expand all Loading... | |
24 | 24 |
25 #include "modules/webaudio/PannerNode.h" | 25 #include "modules/webaudio/PannerNode.h" |
26 #include "bindings/core/v8/ExceptionMessages.h" | 26 #include "bindings/core/v8/ExceptionMessages.h" |
27 #include "bindings/core/v8/ExceptionState.h" | 27 #include "bindings/core/v8/ExceptionState.h" |
28 #include "core/dom/ExceptionCode.h" | 28 #include "core/dom/ExceptionCode.h" |
29 #include "core/dom/ExecutionContext.h" | 29 #include "core/dom/ExecutionContext.h" |
30 #include "modules/webaudio/AudioBufferSourceNode.h" | 30 #include "modules/webaudio/AudioBufferSourceNode.h" |
31 #include "modules/webaudio/AudioNodeInput.h" | 31 #include "modules/webaudio/AudioNodeInput.h" |
32 #include "modules/webaudio/AudioNodeOutput.h" | 32 #include "modules/webaudio/AudioNodeOutput.h" |
33 #include "modules/webaudio/BaseAudioContext.h" | 33 #include "modules/webaudio/BaseAudioContext.h" |
34 #include "modules/webaudio/PannerOptions.h" | |
34 #include "platform/Histogram.h" | 35 #include "platform/Histogram.h" |
35 #include "platform/audio/HRTFPanner.h" | 36 #include "platform/audio/HRTFPanner.h" |
36 #include "wtf/MathExtras.h" | 37 #include "wtf/MathExtras.h" |
37 | 38 |
38 namespace blink { | 39 namespace blink { |
39 | 40 |
40 static void fixNANs(double& x) | 41 static void fixNANs(double& x) |
41 { | 42 { |
42 if (std::isnan(x) || std::isinf(x)) | 43 if (std::isnan(x) || std::isinf(x)) |
43 x = 0.0; | 44 x = 0.0; |
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
661 DCHECK(isMainThread()); | 662 DCHECK(isMainThread()); |
662 | 663 |
663 if (context.isContextClosed()) { | 664 if (context.isContextClosed()) { |
664 context.throwExceptionForClosedState(exceptionState); | 665 context.throwExceptionForClosedState(exceptionState); |
665 return nullptr; | 666 return nullptr; |
666 } | 667 } |
667 | 668 |
668 return new PannerNode(context); | 669 return new PannerNode(context); |
669 } | 670 } |
670 | 671 |
672 PannerNode* PannerNode::create(BaseAudioContext* context, const PannerOptions& o ptions, ExceptionState& exceptionState) | |
673 { | |
674 PannerNode* node = create(*context, exceptionState); | |
675 | |
676 if (!node) | |
677 return node; | |
hongchan
2016/09/12 18:56:32
return nullptr;
| |
678 | |
679 node->handleChannelOptions(options, exceptionState); | |
680 | |
681 if (options.hasPanningModel()) | |
682 node->setPanningModel(options.panningModel()); | |
683 if (options.hasDistanceModel()) | |
684 node->setDistanceModel(options.distanceModel()); | |
685 | |
686 if (options.hasPositionX()) | |
687 node->positionX()->setValue(options.positionX()); | |
688 if (options.hasPositionY()) | |
689 node->positionY()->setValue(options.positionY()); | |
690 if (options.hasPositionZ()) | |
691 node->positionZ()->setValue(options.positionZ()); | |
692 | |
693 if (options.hasOrientationX()) | |
694 node->orientationX()->setValue(options.orientationX()); | |
695 if (options.hasOrientationY()) | |
696 node->orientationY()->setValue(options.orientationY()); | |
697 if (options.hasOrientationZ()) | |
698 node->orientationZ()->setValue(options.orientationZ()); | |
699 | |
700 if (options.hasRefDistance()) | |
701 node->setRefDistance(options.refDistance()); | |
702 if (options.hasMaxDistance()) | |
703 node->setMaxDistance(options.maxDistance()); | |
704 if (options.hasRolloffFactor()) | |
705 node->setRolloffFactor(options.rolloffFactor()); | |
706 if (options.hasConeInnerAngle()) | |
707 node->setConeInnerAngle(options.coneInnerAngle()); | |
708 if (options.hasConeOuterAngle()) | |
709 node->setConeOuterAngle(options.coneOuterAngle()); | |
710 if (options.hasConeOuterGain()) | |
711 node->setConeOuterGain(options.coneOuterGain()); | |
712 | |
713 return node; | |
714 } | |
715 | |
671 PannerHandler& PannerNode::pannerHandler() const | 716 PannerHandler& PannerNode::pannerHandler() const |
672 { | 717 { |
673 return static_cast<PannerHandler&>(handler()); | 718 return static_cast<PannerHandler&>(handler()); |
674 } | 719 } |
675 | 720 |
676 String PannerNode::panningModel() const | 721 String PannerNode::panningModel() const |
677 { | 722 { |
678 return pannerHandler().panningModel(); | 723 return pannerHandler().panningModel(); |
679 } | 724 } |
680 | 725 |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
776 visitor->trace(m_positionZ); | 821 visitor->trace(m_positionZ); |
777 | 822 |
778 visitor->trace(m_orientationX); | 823 visitor->trace(m_orientationX); |
779 visitor->trace(m_orientationY); | 824 visitor->trace(m_orientationY); |
780 visitor->trace(m_orientationZ); | 825 visitor->trace(m_orientationZ); |
781 | 826 |
782 AudioNode::trace(visitor); | 827 AudioNode::trace(visitor); |
783 } | 828 } |
784 | 829 |
785 } // namespace blink | 830 } // namespace blink |
OLD | NEW |