Changeset 176311 in webkit
- Timestamp:
- Nov 18, 2014, 11:49:29 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/Modules/webaudio/AudioBufferSourceNode.cpp (modified) (3 diffs)
-
Source/WebCore/Modules/webaudio/AudioBufferSourceNode.h (modified) (2 diffs)
-
Source/WebCore/Modules/webaudio/AudioBufferSourceNode.idl (modified) (1 diff)
-
Source/WebCore/Modules/webaudio/AudioScheduledSourceNode.cpp (modified) (3 diffs)
-
Source/WebCore/Modules/webaudio/AudioScheduledSourceNode.h (modified) (1 diff)
-
Source/WebCore/Modules/webaudio/OscillatorNode.idl (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r176310 r176311 1 2014-11-18 Philippe Normand <pnormand@igalia.com> 2 3 start/stop method for AudioBufferSourceNodes and OscillatorNodes can take no args 4 https://bugs.webkit.org/show_bug.cgi?id=138739 5 6 Reviewed by Darin Adler. 7 8 * webaudio/dom-exceptions-expected.txt: Added. 9 * webaudio/dom-exceptions.html: Added. 10 1 11 2014-11-18 Ryosuke Niwa <rniwa@webkit.org> 2 12 -
trunk/Source/WebCore/ChangeLog
r176307 r176311 1 2014-11-18 Philippe Normand <pnormand@igalia.com> 2 3 start/stop method for AudioBufferSourceNodes and OscillatorNodes can take no args 4 https://bugs.webkit.org/show_bug.cgi?id=138739 5 6 Reviewed by Darin Adler. 7 8 The patch is inspired by the following Blink revision by 9 <rtoy@google.com>: 10 <https://src.chromium.org/viewvc/blink?view=rev&revision=160845> 11 12 Test: webaudio/dom-exceptions.html 13 14 * Modules/webaudio/AudioBufferSourceNode.cpp: 15 (WebCore::AudioBufferSourceNode::start): 16 (WebCore::AudioBufferSourceNode::startPlaying): 17 (WebCore::AudioBufferSourceNode::noteGrainOn): 18 (WebCore::AudioBufferSourceNode::startGrain): Deleted. 19 * Modules/webaudio/AudioBufferSourceNode.h: 20 * Modules/webaudio/AudioBufferSourceNode.idl: 21 * Modules/webaudio/AudioScheduledSourceNode.cpp: 22 (WebCore::AudioScheduledSourceNode::start): 23 (WebCore::AudioScheduledSourceNode::stop): 24 * Modules/webaudio/AudioScheduledSourceNode.h: 25 * Modules/webaudio/OscillatorNode.idl: 26 1 27 2014-11-18 Benjamin Poulain <benjamin@webkit.org> 2 28 -
trunk/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.cpp
r163568 r176311 371 371 } 372 372 373 void AudioBufferSourceNode::startGrain(double when, double grainOffset, ExceptionCode& ec) 374 { 375 // Duration of 0 has special value, meaning calculate based on the entire buffer's duration. 376 startGrain(when, grainOffset, 0, ec); 377 } 378 379 void AudioBufferSourceNode::startGrain(double when, double grainOffset, double grainDuration, ExceptionCode& ec) 373 void AudioBufferSourceNode::start(ExceptionCode& ec) 374 { 375 startPlaying(Entire, 0, 0, buffer() ? buffer()->duration() : 0, ec); 376 } 377 378 void AudioBufferSourceNode::start(double when, ExceptionCode& ec) 379 { 380 startPlaying(Entire, when, 0, buffer() ? buffer()->duration() : 0, ec); 381 } 382 383 void AudioBufferSourceNode::start(double when, double grainOffset, ExceptionCode& ec) 384 { 385 startPlaying(Partial, when, grainOffset, 0, ec); 386 } 387 388 void AudioBufferSourceNode::start(double when, double grainOffset, double grainDuration, ExceptionCode& ec) 389 { 390 startPlaying(Partial, when, grainOffset, grainDuration, ec); 391 } 392 393 void AudioBufferSourceNode::startPlaying(BufferPlaybackMode playbackMode, double when, double grainOffset, double grainDuration, ExceptionCode& ec) 380 394 { 381 395 ASSERT(isMainThread()); … … 389 403 } 390 404 405 if (!std::isfinite(when) || (when < 0)) { 406 ec = INVALID_STATE_ERR; 407 return; 408 } 409 410 if (!std::isfinite(grainOffset) || (grainOffset < 0)) { 411 ec = INVALID_STATE_ERR; 412 return; 413 } 414 415 if (!std::isfinite(grainDuration) || (grainDuration < 0)) { 416 ec = INVALID_STATE_ERR; 417 return; 418 } 419 391 420 if (!buffer()) 392 421 return; 393 394 // Do sanity checking of grain parameters versus buffer size. 395 double bufferDuration = buffer()->duration(); 396 397 grainOffset = std::max(0.0, grainOffset); 398 grainOffset = std::min(bufferDuration, grainOffset); 399 m_grainOffset = grainOffset; 400 401 // Handle default/unspecified duration. 402 double maxDuration = bufferDuration - grainOffset; 403 if (!grainDuration) 404 grainDuration = maxDuration; 405 406 grainDuration = std::max(0.0, grainDuration); 407 grainDuration = std::min(maxDuration, grainDuration); 408 m_grainDuration = grainDuration; 409 410 m_isGrain = true; 422 423 m_isGrain = playbackMode == Partial; 424 if (m_isGrain) { 425 // Do sanity checking of grain parameters versus buffer size. 426 double bufferDuration = buffer()->duration(); 427 428 m_grainOffset = std::min(bufferDuration, grainOffset); 429 430 double maxDuration = bufferDuration - m_grainOffset; 431 m_grainDuration = std::min(maxDuration, grainDuration); 432 } else { 433 m_grainOffset = 0.0; 434 m_grainDuration = DefaultGrainDuration; 435 } 436 411 437 m_startTime = when; 412 438 … … 423 449 void AudioBufferSourceNode::noteGrainOn(double when, double grainOffset, double grainDuration, ExceptionCode& ec) 424 450 { 425 startGrain(when, grainOffset, grainDuration, ec); 451 // Handle unspecified duration where 0 means the rest of the buffer. 452 if (!grainDuration) 453 grainDuration = buffer()->duration(); 454 startPlaying(Partial, when, grainOffset, grainDuration, ec); 426 455 } 427 456 #endif -
trunk/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.h
r162296 r176311 64 64 65 65 // Play-state 66 void startGrain(double when, double grainOffset, ExceptionCode&); 67 void startGrain(double when, double grainOffset, double grainDuration, ExceptionCode&); 66 void start(ExceptionCode&); 67 void start(double when, ExceptionCode&); 68 void start(double when, double grainOffset, ExceptionCode&); 69 void start(double when, double grainOffset, double grainDuration, ExceptionCode&); 68 70 69 71 #if ENABLE(LEGACY_WEB_AUDIO) … … 105 107 virtual double tailTime() const override { return 0; } 106 108 virtual double latencyTime() const override { return 0; } 109 110 enum BufferPlaybackMode { 111 Entire, 112 Partial 113 }; 114 115 void startPlaying(BufferPlaybackMode, double when, double grainOffset, double grainDuration, ExceptionCode&); 107 116 108 117 // Returns true on success. -
trunk/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.idl
r168302 r176311 45 45 attribute unrestricted double loopEnd; 46 46 47 [RaisesException] void start(unrestricted double when); 48 [ImplementedAs=startGrain, RaisesException] void start(unrestricted double when, unrestricted double grainOffset); 49 [ImplementedAs=startGrain, RaisesException] void start(unrestricted double when, unrestricted double grainOffset, unrestricted double grainDuration); 50 [RaisesException] void stop(unrestricted double when); 47 [RaisesException] void start(optional unrestricted double when, optional unrestricted double grainOffset, optional unrestricted double grainDuration); 48 [RaisesException] void stop(optional unrestricted double when); 51 49 52 50 [Conditional=LEGACY_WEB_AUDIO] attribute boolean looping; // This is an alias for the .loop attribute for backwards compatibility. -
trunk/Source/WebCore/Modules/webaudio/AudioScheduledSourceNode.cpp
r165716 r176311 138 138 } 139 139 140 void AudioScheduledSourceNode::start(ExceptionCode& ec) 141 { 142 start(0, ec); 143 } 144 140 145 void AudioScheduledSourceNode::start(double when, ExceptionCode& ec) 141 146 { … … 150 155 } 151 156 157 if (!std::isfinite(when) || (when < 0)) { 158 ec = INVALID_STATE_ERR; 159 return; 160 } 161 152 162 m_startTime = when; 153 163 m_playbackState = SCHEDULED_STATE; 154 164 } 155 165 166 void AudioScheduledSourceNode::stop(ExceptionCode& ec) 167 { 168 stop(0, ec); 169 } 170 156 171 void AudioScheduledSourceNode::stop(double when, ExceptionCode& ec) 157 172 { … … 161 176 return; 162 177 } 163 164 when = std::max<double>(0, when); 178 179 if (!std::isfinite(when) || (when < 0)) { 180 ec = INVALID_STATE_ERR; 181 return; 182 } 183 165 184 m_endTime = when; 166 185 } -
trunk/Source/WebCore/Modules/webaudio/AudioScheduledSourceNode.h
r165676 r176311 59 59 60 60 // Scheduling. 61 void start(ExceptionCode&); 62 void stop(ExceptionCode&); 61 63 void start(double when, ExceptionCode&); 62 64 void stop(double when, ExceptionCode&); -
trunk/Source/WebCore/Modules/webaudio/OscillatorNode.idl
r168302 r176311 49 49 readonly attribute AudioParam detune; // in Cents 50 50 51 [RaisesException] void start( unrestricted double when);52 [RaisesException] void stop( unrestricted double when);51 [RaisesException] void start(optional unrestricted double when); 52 [RaisesException] void stop(optional unrestricted double when); 53 53 54 54 [Conditional=LEGACY_WEB_AUDIO, RaisesException] void noteOn(unrestricted double when);
Note:
See TracChangeset
for help on using the changeset viewer.