| 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 21 matching lines...) Expand all Loading... |
| 32 namespace blink { | 32 namespace blink { |
| 33 | 33 |
| 34 WaveShaperNode::WaveShaperNode(AbstractAudioContext& context) | 34 WaveShaperNode::WaveShaperNode(AbstractAudioContext& context) |
| 35 : AudioNode(context) | 35 : AudioNode(context) |
| 36 { | 36 { |
| 37 setHandler(AudioBasicProcessorHandler::create(AudioHandler::NodeTypeWaveShap
er, *this, context.sampleRate(), adoptPtr(new WaveShaperProcessor(context.sample
Rate(), 1)))); | 37 setHandler(AudioBasicProcessorHandler::create(AudioHandler::NodeTypeWaveShap
er, *this, context.sampleRate(), adoptPtr(new WaveShaperProcessor(context.sample
Rate(), 1)))); |
| 38 | 38 |
| 39 handler().initialize(); | 39 handler().initialize(); |
| 40 } | 40 } |
| 41 | 41 |
| 42 WaveShaperNode* WaveShaperNode::create(AbstractAudioContext& context, ExceptionS
tate& exceptionState) |
| 43 { |
| 44 DCHECK(isMainThread()); |
| 45 |
| 46 if (context.isContextClosed()) { |
| 47 context.throwExceptionForClosedState(exceptionState); |
| 48 return nullptr; |
| 49 } |
| 50 |
| 51 return new WaveShaperNode(context); |
| 52 } |
| 53 |
| 42 WaveShaperProcessor* WaveShaperNode::getWaveShaperProcessor() const | 54 WaveShaperProcessor* WaveShaperNode::getWaveShaperProcessor() const |
| 43 { | 55 { |
| 44 return static_cast<WaveShaperProcessor*>(static_cast<AudioBasicProcessorHand
ler&>(handler()).processor()); | 56 return static_cast<WaveShaperProcessor*>(static_cast<AudioBasicProcessorHand
ler&>(handler()).processor()); |
| 45 } | 57 } |
| 46 | 58 |
| 47 void WaveShaperNode::setCurve(DOMFloat32Array* curve, ExceptionState& exceptionS
tate) | 59 void WaveShaperNode::setCurve(DOMFloat32Array* curve, ExceptionState& exceptionS
tate) |
| 48 { | 60 { |
| 49 ASSERT(isMainThread()); | 61 ASSERT(isMainThread()); |
| 50 | 62 |
| 51 if (curve && curve->length() < 2) { | 63 if (curve && curve->length() < 2) { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 case WaveShaperProcessor::OverSample4x: | 108 case WaveShaperProcessor::OverSample4x: |
| 97 return "4x"; | 109 return "4x"; |
| 98 default: | 110 default: |
| 99 ASSERT_NOT_REACHED(); | 111 ASSERT_NOT_REACHED(); |
| 100 return "none"; | 112 return "none"; |
| 101 } | 113 } |
| 102 } | 114 } |
| 103 | 115 |
| 104 } // namespace blink | 116 } // namespace blink |
| 105 | 117 |
| OLD | NEW |