| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 String::number(imagLength) + ") must match."); | 74 String::number(imagLength) + ") must match."); |
| 75 return nullptr; | 75 return nullptr; |
| 76 } | 76 } |
| 77 | 77 |
| 78 PeriodicWave* periodicWave = new PeriodicWave(context.sampleRate()); | 78 PeriodicWave* periodicWave = new PeriodicWave(context.sampleRate()); |
| 79 periodicWave->createBandLimitedTables(real, imag, realLength, | 79 periodicWave->createBandLimitedTables(real, imag, realLength, |
| 80 disableNormalization); | 80 disableNormalization); |
| 81 return periodicWave; | 81 return periodicWave; |
| 82 } | 82 } |
| 83 | 83 |
| 84 PeriodicWave* PeriodicWave::create(BaseAudioContext& context, | 84 PeriodicWave* PeriodicWave::create( |
| 85 DOMFloat32Array* real, | 85 BaseAudioContext& context, |
| 86 DOMFloat32Array* imag, | 86 const MaybeShared<DOMFloat32Array>& realMaybeShared, |
| 87 bool disableNormalization, | 87 const MaybeShared<DOMFloat32Array>& imagMaybeShared, |
| 88 ExceptionState& exceptionState) { | 88 bool disableNormalization, |
| 89 ExceptionState& exceptionState) { |
| 89 DCHECK(isMainThread()); | 90 DCHECK(isMainThread()); |
| 90 | 91 |
| 92 if (realMaybeShared.isShared() || imagMaybeShared.isShared()) { |
| 93 exceptionState.throwTypeError( |
| 94 "real and imag should not be backed by a SharedArrayBuffer."); |
| 95 return nullptr; |
| 96 } |
| 97 DOMFloat32Array* real = realMaybeShared.viewNotShared(); |
| 98 DOMFloat32Array* imag = imagMaybeShared.viewNotShared(); |
| 99 |
| 91 return create(context, real->length(), real->data(), imag->length(), | 100 return create(context, real->length(), real->data(), imag->length(), |
| 92 imag->data(), disableNormalization, exceptionState); | 101 imag->data(), disableNormalization, exceptionState); |
| 93 } | 102 } |
| 94 | 103 |
| 95 PeriodicWave* PeriodicWave::create(BaseAudioContext* context, | 104 PeriodicWave* PeriodicWave::create(BaseAudioContext* context, |
| 96 const PeriodicWaveOptions& options, | 105 const PeriodicWaveOptions& options, |
| 97 ExceptionState& exceptionState) { | 106 ExceptionState& exceptionState) { |
| 98 bool normalize = options.hasDisableNormalization() | 107 bool normalize = options.hasDisableNormalization() |
| 99 ? options.disableNormalization() | 108 ? options.disableNormalization() |
| 100 : false; | 109 : false; |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 } | 406 } |
| 398 | 407 |
| 399 realP[n] = 0; | 408 realP[n] = 0; |
| 400 imagP[n] = b; | 409 imagP[n] = b; |
| 401 } | 410 } |
| 402 | 411 |
| 403 createBandLimitedTables(realP, imagP, halfSize, false); | 412 createBandLimitedTables(realP, imagP, halfSize, false); |
| 404 } | 413 } |
| 405 | 414 |
| 406 } // namespace blink | 415 } // namespace blink |
| OLD | NEW |