| 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 * 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 : AbstractAudioContext(document, numberOfChannels, numberOfFrames, sampleRat
e) | 97 : AbstractAudioContext(document, numberOfChannels, numberOfFrames, sampleRat
e) |
| 98 , m_isRenderingStarted(false) | 98 , m_isRenderingStarted(false) |
| 99 , m_totalRenderFrames(numberOfFrames) | 99 , m_totalRenderFrames(numberOfFrames) |
| 100 { | 100 { |
| 101 // Create a new destination for offline rendering. | 101 // Create a new destination for offline rendering. |
| 102 m_renderTarget = AudioBuffer::create(numberOfChannels, numberOfFrames, sampl
eRate); | 102 m_renderTarget = AudioBuffer::create(numberOfChannels, numberOfFrames, sampl
eRate); |
| 103 | 103 |
| 104 // Throw an exception if the render target is not ready. | 104 // Throw an exception if the render target is not ready. |
| 105 if (m_renderTarget) { | 105 if (m_renderTarget) { |
| 106 m_destinationNode = OfflineAudioDestinationNode::create(this, m_renderTa
rget.get()); | 106 m_destinationNode = OfflineAudioDestinationNode::create(this, m_renderTa
rget.get()); |
| 107 initialize(); |
| 107 } else { | 108 } else { |
| 108 exceptionState.throwRangeError(ExceptionMessages::failedToConstruct( | 109 exceptionState.throwRangeError(ExceptionMessages::failedToConstruct( |
| 109 "OfflineAudioContext", | 110 "OfflineAudioContext", |
| 110 "failed to create OfflineAudioContext(" + | 111 "failed to create OfflineAudioContext(" + |
| 111 String::number(numberOfChannels) + ", " + | 112 String::number(numberOfChannels) + ", " + |
| 112 String::number(numberOfFrames) + ", " + | 113 String::number(numberOfFrames) + ", " + |
| 113 String::number(sampleRate) + ")")); | 114 String::number(sampleRate) + ")")); |
| 114 } | 115 } |
| 115 | |
| 116 initialize(); | |
| 117 } | 116 } |
| 118 | 117 |
| 119 OfflineAudioContext::~OfflineAudioContext() | 118 OfflineAudioContext::~OfflineAudioContext() |
| 120 { | 119 { |
| 121 } | 120 } |
| 122 | 121 |
| 123 DEFINE_TRACE(OfflineAudioContext) | 122 DEFINE_TRACE(OfflineAudioContext) |
| 124 { | 123 { |
| 125 visitor->trace(m_renderTarget); | 124 visitor->trace(m_renderTarget); |
| 126 visitor->trace(m_completeResolver); | 125 visitor->trace(m_completeResolver); |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 // Note that the GraphLock is required before this check. Since this needs | 412 // Note that the GraphLock is required before this check. Since this needs |
| 414 // to run on the audio thread, OfflineGraphAutoLocker must be used. | 413 // to run on the audio thread, OfflineGraphAutoLocker must be used. |
| 415 if (m_scheduledSuspends.contains(currentSampleFrame())) | 414 if (m_scheduledSuspends.contains(currentSampleFrame())) |
| 416 return true; | 415 return true; |
| 417 | 416 |
| 418 return false; | 417 return false; |
| 419 } | 418 } |
| 420 | 419 |
| 421 } // namespace blink | 420 } // namespace blink |
| 422 | 421 |
| OLD | NEW |