| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011, Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 return new WaveShaperNode(context); | 52 return new WaveShaperNode(context); |
| 53 } | 53 } |
| 54 | 54 |
| 55 WaveShaperProcessor* WaveShaperNode::getWaveShaperProcessor() const | 55 WaveShaperProcessor* WaveShaperNode::getWaveShaperProcessor() const |
| 56 { | 56 { |
| 57 return static_cast<WaveShaperProcessor*>(static_cast<AudioBasicProcessorHand
ler&>(handler()).processor()); | 57 return static_cast<WaveShaperProcessor*>(static_cast<AudioBasicProcessorHand
ler&>(handler()).processor()); |
| 58 } | 58 } |
| 59 | 59 |
| 60 void WaveShaperNode::setCurve(DOMFloat32Array* curve, ExceptionState& exceptionS
tate) | 60 void WaveShaperNode::setCurve(DOMFloat32Array* curve, ExceptionState& exceptionS
tate) |
| 61 { | 61 { |
| 62 ASSERT(isMainThread()); | 62 DCHECK(isMainThread()); |
| 63 | 63 |
| 64 if (curve && curve->length() < 2) { | 64 if (curve && curve->length() < 2) { |
| 65 exceptionState.throwDOMException( | 65 exceptionState.throwDOMException( |
| 66 InvalidAccessError, | 66 InvalidAccessError, |
| 67 ExceptionMessages::indexExceedsMinimumBound<unsigned>( | 67 ExceptionMessages::indexExceedsMinimumBound<unsigned>( |
| 68 "curve length", | 68 "curve length", |
| 69 curve->length(), | 69 curve->length(), |
| 70 2)); | 70 2)); |
| 71 return; | 71 return; |
| 72 } | 72 } |
| 73 | 73 |
| 74 getWaveShaperProcessor()->setCurve(curve); | 74 getWaveShaperProcessor()->setCurve(curve); |
| 75 } | 75 } |
| 76 | 76 |
| 77 DOMFloat32Array* WaveShaperNode::curve() | 77 DOMFloat32Array* WaveShaperNode::curve() |
| 78 { | 78 { |
| 79 return getWaveShaperProcessor()->curve(); | 79 return getWaveShaperProcessor()->curve(); |
| 80 } | 80 } |
| 81 | 81 |
| 82 void WaveShaperNode::setOversample(const String& type) | 82 void WaveShaperNode::setOversample(const String& type) |
| 83 { | 83 { |
| 84 ASSERT(isMainThread()); | 84 DCHECK(isMainThread()); |
| 85 | 85 |
| 86 // This is to synchronize with the changes made in | 86 // This is to synchronize with the changes made in |
| 87 // AudioBasicProcessorNode::checkNumberOfChannelsForInput() where we can | 87 // AudioBasicProcessorNode::checkNumberOfChannelsForInput() where we can |
| 88 // initialize() and uninitialize(). | 88 // initialize() and uninitialize(). |
| 89 BaseAudioContext::AutoLocker contextLocker(context()); | 89 BaseAudioContext::AutoLocker contextLocker(context()); |
| 90 | 90 |
| 91 if (type == "none") { | 91 if (type == "none") { |
| 92 getWaveShaperProcessor()->setOversample(WaveShaperProcessor::OverSampleN
one); | 92 getWaveShaperProcessor()->setOversample(WaveShaperProcessor::OverSampleN
one); |
| 93 } else if (type == "2x") { | 93 } else if (type == "2x") { |
| 94 getWaveShaperProcessor()->setOversample(WaveShaperProcessor::OverSample2
x); | 94 getWaveShaperProcessor()->setOversample(WaveShaperProcessor::OverSample2
x); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 109 case WaveShaperProcessor::OverSample4x: | 109 case WaveShaperProcessor::OverSample4x: |
| 110 return "4x"; | 110 return "4x"; |
| 111 default: | 111 default: |
| 112 ASSERT_NOT_REACHED(); | 112 ASSERT_NOT_REACHED(); |
| 113 return "none"; | 113 return "none"; |
| 114 } | 114 } |
| 115 } | 115 } |
| 116 | 116 |
| 117 } // namespace blink | 117 } // namespace blink |
| 118 | 118 |
| OLD | NEW |