Re-factor scheduling logic from AudioBufferSourceNode into AudioScheduledSourceNode
Created attachment 138434 [details] Patch
Comment on attachment 138434 [details] Patch Attachment 138434 [details] did not pass mac-ews (mac): Output: http://queues.webkit.org/results/12530041
Created attachment 138453 [details] Patch
Fixed simple compile error from first patch caused by last minute cleanup.
Hi Eric and Jer, would one of you be able to look over this patch? It's not as bad as it looks since it's essentially just cutting some code from AudioBufferSourceNode and putting it into a new base-class. Thanks!
Comment on attachment 138453 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=138453&action=review > Source/WebCore/Modules/webaudio/AudioBufferSourceNode.h:-85 > - void noteOn(double when); > void noteGrainOn(double when, double grainOffset, double grainDuration); > - void noteOff(double when); Why wasn't noteGrainOn() included in this patch? It appears that updateSchedulingInfo() does much of the same calculations as noteGrainOn(). Is there additional refactoring which could be done here? It seems that it's concepts (i.e. mucking around with the m_playbackState variable) belong in AudioScheduledSourceNode and not in AudioBufferSourceNode. I would suggest adding a pure virtual "double maxGrainDuration() const = 0;" function in AudioScheduledSourceNode.h, overridden by AudioBufferSourceNode as "buffer()->duration()", and use the result of that function to do the necessary calculations in noteGrainOn().
(In reply to comment #6) > (From update of attachment 138453 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=138453&action=review > > > Source/WebCore/Modules/webaudio/AudioBufferSourceNode.h:-85 > > - void noteOn(double when); > > void noteGrainOn(double when, double grainOffset, double grainDuration); > > - void noteOff(double when); > > Why wasn't noteGrainOn() included in this patch? It appears that updateSchedulingInfo() does much of the same calculations as noteGrainOn(). Is there additional refactoring which could be done here? It seems that it's concepts (i.e. mucking around with the m_playbackState variable) belong in AudioScheduledSourceNode and not in AudioBufferSourceNode. > > I would suggest adding a pure virtual "double maxGrainDuration() const = 0;" function in AudioScheduledSourceNode.h, overridden by AudioBufferSourceNode as "buffer()->duration()", and use the result of that function to do the necessary calculations in noteGrainOn(). Hi Jer, the reason is because noteGrainOn() is a concept specific to AudioBufferSourceNodes, since it accesses parts of an AudioBuffer. The Oscillator AudioSourceNode does not have this concept of noteGrainOn(), but only noteOn() and noteOff() for basic starting/stopping playback, and going through specific playback states.
Committed r115485: <http://trac.webkit.org/changeset/115485>
Thanks Eric!