| OLD | NEW |
| 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 * | 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 18 matching lines...) Expand all Loading... |
| 29 #include "modules/webaudio/AudioBuffer.h" | 29 #include "modules/webaudio/AudioBuffer.h" |
| 30 | 30 |
| 31 #include "bindings/core/v8/ExceptionMessages.h" | 31 #include "bindings/core/v8/ExceptionMessages.h" |
| 32 #include "bindings/core/v8/ExceptionState.h" | 32 #include "bindings/core/v8/ExceptionState.h" |
| 33 #include "core/dom/ExceptionCode.h" | 33 #include "core/dom/ExceptionCode.h" |
| 34 #include "modules/webaudio/AudioBufferOptions.h" | 34 #include "modules/webaudio/AudioBufferOptions.h" |
| 35 #include "modules/webaudio/BaseAudioContext.h" | 35 #include "modules/webaudio/BaseAudioContext.h" |
| 36 #include "platform/audio/AudioBus.h" | 36 #include "platform/audio/AudioBus.h" |
| 37 #include "platform/audio/AudioFileReader.h" | 37 #include "platform/audio/AudioFileReader.h" |
| 38 #include "platform/audio/AudioUtilities.h" | 38 #include "platform/audio/AudioUtilities.h" |
| 39 #include "wtf/typed_arrays/Float32Array.h" | 39 #include "platform/wtf/typed_arrays/Float32Array.h" |
| 40 | 40 |
| 41 namespace blink { | 41 namespace blink { |
| 42 | 42 |
| 43 AudioBuffer* AudioBuffer::Create(unsigned number_of_channels, | 43 AudioBuffer* AudioBuffer::Create(unsigned number_of_channels, |
| 44 size_t number_of_frames, | 44 size_t number_of_frames, |
| 45 float sample_rate) { | 45 float sample_rate) { |
| 46 if (!AudioUtilities::IsValidAudioBufferSampleRate(sample_rate) || | 46 if (!AudioUtilities::IsValidAudioBufferSampleRate(sample_rate) || |
| 47 number_of_channels > BaseAudioContext::MaxNumberOfChannels() || | 47 number_of_channels > BaseAudioContext::MaxNumberOfChannels() || |
| 48 !number_of_channels || !number_of_frames) | 48 !number_of_channels || !number_of_frames) |
| 49 return nullptr; | 49 return nullptr; |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 void AudioBuffer::Zero() { | 300 void AudioBuffer::Zero() { |
| 301 for (unsigned i = 0; i < channels_.size(); ++i) { | 301 for (unsigned i = 0; i < channels_.size(); ++i) { |
| 302 if (DOMFloat32Array* array = getChannelData(i)) { | 302 if (DOMFloat32Array* array = getChannelData(i)) { |
| 303 float* data = array->Data(); | 303 float* data = array->Data(); |
| 304 memset(data, 0, length() * sizeof(*data)); | 304 memset(data, 0, length() * sizeof(*data)); |
| 305 } | 305 } |
| 306 } | 306 } |
| 307 } | 307 } |
| 308 | 308 |
| 309 } // namespace blink | 309 } // namespace blink |
| OLD | NEW |