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

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

Issue 1328963003: setValueCurve can start at the end of other automations (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 3 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 | « LayoutTests/webaudio/audioparam-setValueCurve-exceptions-expected.txt ('k') | no next file » | 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) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 if (!isValid) 186 if (!isValid)
187 return; 187 return;
188 188
189 MutexLocker locker(m_eventsLock); 189 MutexLocker locker(m_eventsLock);
190 190
191 unsigned i = 0; 191 unsigned i = 0;
192 double insertTime = event.time(); 192 double insertTime = event.time();
193 193
194 for (i = 0; i < m_events.size(); ++i) { 194 for (i = 0; i < m_events.size(); ++i) {
195 if (event.type() == ParamEvent::SetValueCurve) { 195 if (event.type() == ParamEvent::SetValueCurve) {
196 // If this event is a SetValueCurve, make sure it doesn't overlap an y existing event. 196 // If this event is a SetValueCurve, make sure it doesn't overlap an y existing
197 // event. It's ok if the SetValueCurve starts at the same time as th e end of some other
198 // duration.
197 double endTime = event.time() + event.duration(); 199 double endTime = event.time() + event.duration();
198 if (m_events[i].time() >= event.time() && m_events[i].time() < endTi me) { 200 if (m_events[i].time() > event.time() && m_events[i].time() < endTim e) {
199 exceptionState.throwDOMException( 201 exceptionState.throwDOMException(
200 NotSupportedError, 202 NotSupportedError,
201 eventToString(event) + " overlaps " + eventToString(m_events [i])); 203 eventToString(event) + " overlaps " + eventToString(m_events [i]));
202 return; 204 return;
203 } 205 }
204 } else { 206 } else {
205 // Otherwise, make sure this event doesn't overlap any existing SetV alueCurve event. 207 // Otherwise, make sure this event doesn't overlap any existing SetV alueCurve event.
206 if (m_events[i].type() == ParamEvent::SetValueCurve) { 208 if (m_events[i].type() == ParamEvent::SetValueCurve) {
207 double endTime = m_events[i].time() + m_events[i].duration(); 209 double endTime = m_events[i].time() + m_events[i].duration();
208 if (event.time() >= m_events[i].time() && event.time() < endTime ) { 210 if (event.time() >= m_events[i].time() && event.time() < endTime ) {
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 // to the end of the values buffer. 563 // to the end of the values buffer.
562 for (; writeIndex < numberOfValues; ++writeIndex) 564 for (; writeIndex < numberOfValues; ++writeIndex)
563 values[writeIndex] = value; 565 values[writeIndex] = value;
564 566
565 return value; 567 return value;
566 } 568 }
567 569
568 } // namespace blink 570 } // namespace blink
569 571
570 #endif // ENABLE(WEB_AUDIO) 572 #endif // ENABLE(WEB_AUDIO)
OLDNEW
« no previous file with comments | « LayoutTests/webaudio/audioparam-setValueCurve-exceptions-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698