RESOLVED FIXED 100170
Implement AudioBufferSourceNode .loopStart and .loopEnd attributes
https://bugs.webkit.org/show_bug.cgi?id=100170
Summary Implement AudioBufferSourceNode .loopStart and .loopEnd attributes
Chris Rogers
Reported 2012-10-23 15:57:33 PDT
Implement AudioBufferSourceNode .loopStart and .loopEnd attributes
Attachments
Patch (1.34 MB, patch)
2012-10-23 16:05 PDT, Chris Rogers
no flags
Patch (1.35 MB, patch)
2012-10-26 16:38 PDT, Chris Rogers
no flags
Chris Rogers
Comment 1 2012-10-23 16:05:32 PDT
Kenneth Russell
Comment 2 2012-10-23 19:05:42 PDT
Comment on attachment 170261 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=170261&action=review One question and one comment. Not touching the r? bit yet. > Source/WebCore/Modules/webaudio/AudioBufferSourceNode.cpp:227 > + double loopStartFrame = m_loopStart * buffer()->sampleRate(); Does m_virtualReadIndex need to be clamped to m_loopStart? How does this code avoid sampling the buffer before m_loopStart? > LayoutTests/webaudio/audiobuffersource-loop-points.html:68 > + source.loopEnd = buffer.duration; I think it would be a good idea to add two more tests: (1) loopStart is at the beginning of the buffer but loopEnd is before the end of the buffer; and (2) both loopStart and loopEnd are somewhere inside the buffer. Negative tests might be a good idea too.
Chris Rogers
Comment 3 2012-10-26 16:38:27 PDT
Chris Rogers
Comment 4 2012-10-26 16:42:58 PDT
(In reply to comment #2) > (From update of attachment 170261 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=170261&action=review > > One question and one comment. Not touching the r? bit yet. > > > Source/WebCore/Modules/webaudio/AudioBufferSourceNode.cpp:227 > > + double loopStartFrame = m_loopStart * buffer()->sampleRate(); > > Does m_virtualReadIndex need to be clamped to m_loopStart? How does this code avoid sampling the buffer before m_loopStart? The idea is that playback normally starts before the loop, and that the loop-points are somewhere in the middle of the sample data, and are usually well-chosen to blend seamlessly at the loop transition (sample editors have tools to create these loop points). > > > LayoutTests/webaudio/audiobuffersource-loop-points.html:68 > > + source.loopEnd = buffer.duration; > > I think it would be a good idea to add two more tests: (1) loopStart is at the beginning of the buffer but loopEnd is before the end of the buffer; and (2) both loopStart and loopEnd are somewhere inside the buffer. Negative tests might be a good idea too. In the latest patch, I've added a bunch of new tests including the ones you suggest in: webaudio/audiobuffersource-loop-comprehensive.html Thanks for having a look!
Kenneth Russell
Comment 5 2012-10-26 18:52:21 PDT
Comment on attachment 171048 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=171048&action=review Very nice. r=me > LayoutTests/webaudio/audiobuffersource-loop-comprehensive.html:112 > + if (expected[j] != renderedData[offsetFrame + j]) { No epsilon needed in these comparisons?
Chris Rogers
Comment 6 2012-10-26 18:54:37 PDT
(In reply to comment #5) > (From update of attachment 171048 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=171048&action=review > > Very nice. r=me > > > LayoutTests/webaudio/audiobuffersource-loop-comprehensive.html:112 > > + if (expected[j] != renderedData[offsetFrame + j]) { > > No epsilon needed in these comparisons? Doesn't seem to be necessary.
WebKit Review Bot
Comment 7 2012-10-26 19:11:35 PDT
Comment on attachment 171048 [details] Patch Clearing flags on attachment: 171048 Committed r132720: <http://trac.webkit.org/changeset/132720>
WebKit Review Bot
Comment 8 2012-10-26 19:11:38 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.