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 * 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 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
333 m_virtualReadIndex = virtualReadIndex; | 333 m_virtualReadIndex = virtualReadIndex; |
334 | 334 |
335 return true; | 335 return true; |
336 } | 336 } |
337 | 337 |
338 | 338 |
339 void AudioBufferSourceNode::setBuffer(AudioBuffer* buffer, ExceptionState& excep tionState) | 339 void AudioBufferSourceNode::setBuffer(AudioBuffer* buffer, ExceptionState& excep tionState) |
340 { | 340 { |
341 ASSERT(isMainThread()); | 341 ASSERT(isMainThread()); |
342 | 342 |
343 if (m_buffer) { | |
344 exceptionState.throwDOMException( | |
345 InvalidStateError, | |
346 "buffer can only be set once."); | |
hongchan
2015/01/16 23:42:09
Perhaps the first word should be capitalized? Othe
Raymond Toy
2015/01/17 00:03:16
Will do. And get rid of the trailing period.
Raymond Toy
2015/01/20 18:06:00
Done.
| |
347 return; | |
348 } | |
349 | |
343 // The context must be locked since changing the buffer can re-configure the number of channels that are output. | 350 // The context must be locked since changing the buffer can re-configure the number of channels that are output. |
344 AudioContext::AutoLocker contextLocker(context()); | 351 AudioContext::AutoLocker contextLocker(context()); |
345 | 352 |
346 // This synchronizes with process(). | 353 // This synchronizes with process(). |
347 MutexLocker processLocker(m_processLock); | 354 MutexLocker processLocker(m_processLock); |
348 | 355 |
349 if (buffer) { | 356 if (buffer) { |
350 // Do any necesssary re-configuration to the buffer's number of channels . | 357 // Do any necesssary re-configuration to the buffer's number of channels . |
351 unsigned numberOfChannels = buffer->numberOfChannels(); | 358 unsigned numberOfChannels = buffer->numberOfChannels(); |
352 | 359 |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
511 { | 518 { |
512 visitor->trace(m_buffer); | 519 visitor->trace(m_buffer); |
513 visitor->trace(m_playbackRate); | 520 visitor->trace(m_playbackRate); |
514 visitor->trace(m_pannerNode); | 521 visitor->trace(m_pannerNode); |
515 AudioScheduledSourceNode::trace(visitor); | 522 AudioScheduledSourceNode::trace(visitor); |
516 } | 523 } |
517 | 524 |
518 } // namespace blink | 525 } // namespace blink |
519 | 526 |
520 #endif // ENABLE(WEB_AUDIO) | 527 #endif // ENABLE(WEB_AUDIO) |
OLD | NEW |