| 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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 memset(outputBus->channel(i)->mutableData() + zeroStartFrame, 0,
sizeof(float) * framesToZero); | 132 memset(outputBus->channel(i)->mutableData() + zeroStartFrame, 0,
sizeof(float) * framesToZero); |
| 133 } | 133 } |
| 134 | 134 |
| 135 finish(); | 135 finish(); |
| 136 } | 136 } |
| 137 | 137 |
| 138 return; | 138 return; |
| 139 } | 139 } |
| 140 | 140 |
| 141 | 141 |
| 142 void AudioScheduledSourceNode::start(double when, ExceptionState& es) | 142 void AudioScheduledSourceNode::start(double when, ExceptionState& exceptionState
) |
| 143 { | 143 { |
| 144 ASSERT(isMainThread()); | 144 ASSERT(isMainThread()); |
| 145 | 145 |
| 146 if (m_playbackState != UNSCHEDULED_STATE) { | 146 if (m_playbackState != UNSCHEDULED_STATE) { |
| 147 es.throwDOMException( | 147 exceptionState.throwDOMException( |
| 148 InvalidStateError, | 148 InvalidStateError, |
| 149 ExceptionMessages::failedToExecute( | 149 ExceptionMessages::failedToExecute( |
| 150 "start", | 150 "start", |
| 151 "OscillatorNode", | 151 "OscillatorNode", |
| 152 "cannot call start more than once.")); | 152 "cannot call start more than once.")); |
| 153 return; | 153 return; |
| 154 } | 154 } |
| 155 | 155 |
| 156 m_startTime = when; | 156 m_startTime = when; |
| 157 m_playbackState = SCHEDULED_STATE; | 157 m_playbackState = SCHEDULED_STATE; |
| 158 } | 158 } |
| 159 | 159 |
| 160 void AudioScheduledSourceNode::stop(double when, ExceptionState& es) | 160 void AudioScheduledSourceNode::stop(double when, ExceptionState& exceptionState) |
| 161 { | 161 { |
| 162 ASSERT(isMainThread()); | 162 ASSERT(isMainThread()); |
| 163 | 163 |
| 164 if (m_stopCalled) { | 164 if (m_stopCalled) { |
| 165 es.throwDOMException( | 165 exceptionState.throwDOMException( |
| 166 InvalidStateError, | 166 InvalidStateError, |
| 167 ExceptionMessages::failedToExecute( | 167 ExceptionMessages::failedToExecute( |
| 168 "stop", | 168 "stop", |
| 169 "OscillatorNode", | 169 "OscillatorNode", |
| 170 "cannot call stop more than once.")); | 170 "cannot call stop more than once.")); |
| 171 } else if (m_playbackState == UNSCHEDULED_STATE) { | 171 } else if (m_playbackState == UNSCHEDULED_STATE) { |
| 172 es.throwDOMException( | 172 exceptionState.throwDOMException( |
| 173 InvalidStateError, | 173 InvalidStateError, |
| 174 ExceptionMessages::failedToExecute( | 174 ExceptionMessages::failedToExecute( |
| 175 "stop", | 175 "stop", |
| 176 "OscillatorNode", | 176 "OscillatorNode", |
| 177 "cannot call stop without calling start first.")); | 177 "cannot call stop without calling start first.")); |
| 178 } else { | 178 } else { |
| 179 // This can only happen from the SCHEDULED_STATE or PLAYING_STATE. The U
NSCHEDULED_STATE is | 179 // This can only happen from the SCHEDULED_STATE or PLAYING_STATE. The U
NSCHEDULED_STATE is |
| 180 // handled above, and the FINISHED_STATE is only reachable after stop()
has been called, and | 180 // handled above, and the FINISHED_STATE is only reachable after stop()
has been called, and |
| 181 // hence m_stopCalled is true. But that case is handled above. | 181 // hence m_stopCalled is true. But that case is handled above. |
| 182 when = max(0.0, when); | 182 when = max(0.0, when); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 void AudioScheduledSourceNode::NotifyEndedTask::notifyEnded() | 222 void AudioScheduledSourceNode::NotifyEndedTask::notifyEnded() |
| 223 { | 223 { |
| 224 RefPtr<Event> event = Event::create(EventTypeNames::ended); | 224 RefPtr<Event> event = Event::create(EventTypeNames::ended); |
| 225 event->setTarget(m_scheduledNode); | 225 event->setTarget(m_scheduledNode); |
| 226 m_scheduledNode->dispatchEvent(event.get()); | 226 m_scheduledNode->dispatchEvent(event.get()); |
| 227 } | 227 } |
| 228 | 228 |
| 229 } // namespace WebCore | 229 } // namespace WebCore |
| 230 | 230 |
| 231 #endif // ENABLE(WEB_AUDIO) | 231 #endif // ENABLE(WEB_AUDIO) |
| OLD | NEW |