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

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

Issue 2276973002: Revert CL 2242573002 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 3 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 , m_positionZ(positionZ) 65 , m_positionZ(positionZ)
66 , m_orientationX(orientationX) 66 , m_orientationX(orientationX)
67 , m_orientationY(orientationY) 67 , m_orientationY(orientationY)
68 , m_orientationZ(orientationZ) 68 , m_orientationZ(orientationZ)
69 { 69 {
70 addInput(); 70 addInput();
71 addOutput(2); 71 addOutput(2);
72 72
73 // Node-specific default mixing rules. 73 // Node-specific default mixing rules.
74 m_channelCount = 2; 74 m_channelCount = 2;
75 setInternalChannelCountMode(ClampedMax); 75 m_channelCountMode = ClampedMax;
76 setInternalChannelInterpretation(AudioBus::Speakers); 76 m_channelInterpretation = AudioBus::Speakers;
77 77
78 // Explicitly set the default panning model here so that the histograms 78 // Explicitly set the default panning model here so that the histograms
79 // include the default value. 79 // include the default value.
80 setPanningModel("equalpower"); 80 setPanningModel("equalpower");
81 81
82 initialize(); 82 initialize();
83 } 83 }
84 84
85 PassRefPtr<PannerHandler> PannerHandler::create( 85 PassRefPtr<PannerHandler> PannerHandler::create(
86 AudioNode& node, float sampleRate, 86 AudioNode& node, float sampleRate,
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 558
559 void PannerHandler::setChannelCount(unsigned long channelCount, ExceptionState& exceptionState) 559 void PannerHandler::setChannelCount(unsigned long channelCount, ExceptionState& exceptionState)
560 { 560 {
561 DCHECK(isMainThread()); 561 DCHECK(isMainThread());
562 BaseAudioContext::AutoLocker locker(context()); 562 BaseAudioContext::AutoLocker locker(context());
563 563
564 // A PannerNode only supports 1 or 2 channels 564 // A PannerNode only supports 1 or 2 channels
565 if (channelCount > 0 && channelCount <= 2) { 565 if (channelCount > 0 && channelCount <= 2) {
566 if (m_channelCount != channelCount) { 566 if (m_channelCount != channelCount) {
567 m_channelCount = channelCount; 567 m_channelCount = channelCount;
568 if (internalChannelCountMode() != Max) 568 if (m_channelCountMode != Max)
569 updateChannelsForInputs(); 569 updateChannelsForInputs();
570 } 570 }
571 } else { 571 } else {
572 exceptionState.throwDOMException( 572 exceptionState.throwDOMException(
573 NotSupportedError, 573 NotSupportedError,
574 ExceptionMessages::indexOutsideRange<unsigned long>( 574 ExceptionMessages::indexOutsideRange<unsigned long>(
575 "channelCount", 575 "channelCount",
576 channelCount, 576 channelCount,
577 1, 577 1,
578 ExceptionMessages::InclusiveBound, 578 ExceptionMessages::InclusiveBound,
579 2, 579 2,
580 ExceptionMessages::InclusiveBound)); 580 ExceptionMessages::InclusiveBound));
581 } 581 }
582 } 582 }
583 583
584 void PannerHandler::setChannelCountMode(const String& mode, ExceptionState& exce ptionState) 584 void PannerHandler::setChannelCountMode(const String& mode, ExceptionState& exce ptionState)
585 { 585 {
586 DCHECK(isMainThread()); 586 DCHECK(isMainThread());
587 BaseAudioContext::AutoLocker locker(context()); 587 BaseAudioContext::AutoLocker locker(context());
588 588
589 ChannelCountMode oldMode = m_channelCountMode;
590
589 if (mode == "clamped-max") { 591 if (mode == "clamped-max") {
590 setInternalChannelCountMode(ClampedMax); 592 m_newChannelCountMode = ClampedMax;
591 } else if (mode == "explicit") { 593 } else if (mode == "explicit") {
592 setInternalChannelCountMode(Explicit); 594 m_newChannelCountMode = Explicit;
593 } else if (mode == "max") { 595 } else if (mode == "max") {
594 // This is not supported for a PannerNode, which can only handle 1 or 2 channels. 596 // This is not supported for a PannerNode, which can only handle 1 or 2 channels.
595 exceptionState.throwDOMException( 597 exceptionState.throwDOMException(
596 NotSupportedError, 598 NotSupportedError,
597 "Panner: 'max' is not allowed"); 599 "Panner: 'max' is not allowed");
600 m_newChannelCountMode = oldMode;
601 } else {
602 // Do nothing for other invalid values.
603 m_newChannelCountMode = oldMode;
598 } 604 }
605
606 if (m_newChannelCountMode != oldMode)
607 context()->deferredTaskHandler().addChangedChannelCountMode(this);
599 } 608 }
600 609
601 bool PannerHandler::hasSampleAccurateValues() const 610 bool PannerHandler::hasSampleAccurateValues() const
602 { 611 {
603 return m_positionX->hasSampleAccurateValues() 612 return m_positionX->hasSampleAccurateValues()
604 || m_positionY->hasSampleAccurateValues() 613 || m_positionY->hasSampleAccurateValues()
605 || m_positionZ->hasSampleAccurateValues() 614 || m_positionZ->hasSampleAccurateValues()
606 || m_orientationX->hasSampleAccurateValues() 615 || m_orientationX->hasSampleAccurateValues()
607 || m_orientationY->hasSampleAccurateValues() 616 || m_orientationY->hasSampleAccurateValues()
608 || m_orientationZ->hasSampleAccurateValues(); 617 || m_orientationZ->hasSampleAccurateValues();
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
767 visitor->trace(m_positionZ); 776 visitor->trace(m_positionZ);
768 777
769 visitor->trace(m_orientationX); 778 visitor->trace(m_orientationX);
770 visitor->trace(m_orientationY); 779 visitor->trace(m_orientationY);
771 visitor->trace(m_orientationZ); 780 visitor->trace(m_orientationZ);
772 781
773 AudioNode::trace(visitor); 782 AudioNode::trace(visitor);
774 } 783 }
775 784
776 } // namespace blink 785 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698