Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(322)

Side by Side Diff: Source/modules/webaudio/AudioContext.cpp

Issue 225093020: Remove 2-arg createBuffer from WebAudio (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove unused var Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/modules/webaudio/AudioContext.h ('k') | Source/modules/webaudio/AudioContext.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 * 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 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 "unable to create buffer of " + String::number(numberOfChannels) 300 "unable to create buffer of " + String::number(numberOfChannels)
301 + " channel(s) of " + String::number(numberOfFrames) 301 + " channel(s) of " + String::number(numberOfFrames)
302 + " frames each."); 302 + " frames each.");
303 } 303 }
304 return nullptr; 304 return nullptr;
305 } 305 }
306 306
307 return audioBuffer; 307 return audioBuffer;
308 } 308 }
309 309
310 PassRefPtr<AudioBuffer> AudioContext::createBuffer(ArrayBuffer* arrayBuffer, boo l mixToMono, ExceptionState& exceptionState)
311 {
312 ASSERT(arrayBuffer);
313 if (!arrayBuffer) {
314 exceptionState.throwDOMException(
315 SyntaxError,
316 "invalid ArrayBuffer.");
317 return nullptr;
318 }
319
320 RefPtr<AudioBuffer> audioBuffer = AudioBuffer::createFromAudioFileData(array Buffer->data(), arrayBuffer->byteLength(), mixToMono, sampleRate());
321 if (!audioBuffer.get()) {
322 exceptionState.throwDOMException(
323 SyntaxError,
324 "invalid audio data in ArrayBuffer.");
325 return nullptr;
326 }
327
328 return audioBuffer;
329 }
330
331 void AudioContext::decodeAudioData(ArrayBuffer* audioData, PassOwnPtr<AudioBuffe rCallback> successCallback, PassOwnPtr<AudioBufferCallback> errorCallback, Excep tionState& exceptionState) 310 void AudioContext::decodeAudioData(ArrayBuffer* audioData, PassOwnPtr<AudioBuffe rCallback> successCallback, PassOwnPtr<AudioBufferCallback> errorCallback, Excep tionState& exceptionState)
332 { 311 {
333 if (!audioData) { 312 if (!audioData) {
334 exceptionState.throwDOMException( 313 exceptionState.throwDOMException(
335 SyntaxError, 314 SyntaxError,
336 "invalid ArrayBuffer for audioData."); 315 "invalid ArrayBuffer for audioData.");
337 return; 316 return;
338 } 317 }
339 m_audioDecoder.decodeAsync(audioData, sampleRate(), successCallback, errorCa llback); 318 m_audioDecoder.decodeAsync(audioData, sampleRate(), successCallback, errorCa llback);
340 } 319 }
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after
1013 } 992 }
1014 993
1015 void AudioContext::decrementActiveSourceCount() 994 void AudioContext::decrementActiveSourceCount()
1016 { 995 {
1017 atomicDecrement(&m_activeSourceCount); 996 atomicDecrement(&m_activeSourceCount);
1018 } 997 }
1019 998
1020 } // namespace WebCore 999 } // namespace WebCore
1021 1000
1022 #endif // ENABLE(WEB_AUDIO) 1001 #endif // ENABLE(WEB_AUDIO)
OLDNEW
« no previous file with comments | « Source/modules/webaudio/AudioContext.h ('k') | Source/modules/webaudio/AudioContext.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698