| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 { | 49 { |
| 50 ASSERT(isMainThread()); | 50 ASSERT(isMainThread()); |
| 51 waveShaperProcessor()->setCurve(curve); | 51 waveShaperProcessor()->setCurve(curve); |
| 52 } | 52 } |
| 53 | 53 |
| 54 Float32Array* WaveShaperNode::curve() | 54 Float32Array* WaveShaperNode::curve() |
| 55 { | 55 { |
| 56 return waveShaperProcessor()->curve(); | 56 return waveShaperProcessor()->curve(); |
| 57 } | 57 } |
| 58 | 58 |
| 59 void WaveShaperNode::setOversample(const String& type, ExceptionState& es) | 59 void WaveShaperNode::setOversample(const String& type, ExceptionState& exception
State) |
| 60 { | 60 { |
| 61 ASSERT(isMainThread()); | 61 ASSERT(isMainThread()); |
| 62 | 62 |
| 63 // This is to synchronize with the changes made in | 63 // This is to synchronize with the changes made in |
| 64 // AudioBasicProcessorNode::checkNumberOfChannelsForInput() where we can | 64 // AudioBasicProcessorNode::checkNumberOfChannelsForInput() where we can |
| 65 // initialize() and uninitialize(). | 65 // initialize() and uninitialize(). |
| 66 AudioContext::AutoLocker contextLocker(context()); | 66 AudioContext::AutoLocker contextLocker(context()); |
| 67 | 67 |
| 68 if (type == "none") { | 68 if (type == "none") { |
| 69 waveShaperProcessor()->setOversample(WaveShaperProcessor::OverSampleNone
); | 69 waveShaperProcessor()->setOversample(WaveShaperProcessor::OverSampleNone
); |
| 70 } else if (type == "2x") { | 70 } else if (type == "2x") { |
| 71 waveShaperProcessor()->setOversample(WaveShaperProcessor::OverSample2x); | 71 waveShaperProcessor()->setOversample(WaveShaperProcessor::OverSample2x); |
| 72 } else if (type == "4x") { | 72 } else if (type == "4x") { |
| 73 waveShaperProcessor()->setOversample(WaveShaperProcessor::OverSample4x); | 73 waveShaperProcessor()->setOversample(WaveShaperProcessor::OverSample4x); |
| 74 } else { | 74 } else { |
| 75 es.throwDOMException( | 75 exceptionState.throwDOMException( |
| 76 InvalidStateError, | 76 InvalidStateError, |
| 77 ExceptionMessages::failedToSet( | 77 ExceptionMessages::failedToSet( |
| 78 "oversample", | 78 "oversample", |
| 79 "WaveShaperNode", | 79 "WaveShaperNode", |
| 80 "invalid oversample '" + type + "': must be 'none', '2x', or '4x
'.")); | 80 "invalid oversample '" + type + "': must be 'none', '2x', or '4x
'.")); |
| 81 } | 81 } |
| 82 } | 82 } |
| 83 | 83 |
| 84 String WaveShaperNode::oversample() const | 84 String WaveShaperNode::oversample() const |
| 85 { | 85 { |
| 86 switch (const_cast<WaveShaperNode*>(this)->waveShaperProcessor()->oversample
()) { | 86 switch (const_cast<WaveShaperNode*>(this)->waveShaperProcessor()->oversample
()) { |
| 87 case WaveShaperProcessor::OverSampleNone: | 87 case WaveShaperProcessor::OverSampleNone: |
| 88 return "none"; | 88 return "none"; |
| 89 case WaveShaperProcessor::OverSample2x: | 89 case WaveShaperProcessor::OverSample2x: |
| 90 return "2x"; | 90 return "2x"; |
| 91 case WaveShaperProcessor::OverSample4x: | 91 case WaveShaperProcessor::OverSample4x: |
| 92 return "4x"; | 92 return "4x"; |
| 93 default: | 93 default: |
| 94 ASSERT_NOT_REACHED(); | 94 ASSERT_NOT_REACHED(); |
| 95 return "none"; | 95 return "none"; |
| 96 } | 96 } |
| 97 } | 97 } |
| 98 | 98 |
| 99 } // namespace WebCore | 99 } // namespace WebCore |
| 100 | 100 |
| 101 #endif // ENABLE(WEB_AUDIO) | 101 #endif // ENABLE(WEB_AUDIO) |
| OLD | NEW |