-
Notifications
You must be signed in to change notification settings - Fork 167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
It makes no sense to use EventListener for onaudioprocess if ScriptProcessorNode isn't EventTarget #116
Comments
Bug 17493 comment 1 [1] is relevant. ScriptProcessorNode should have its own type of callback for onaudioprocess. |
That works too, as long as it's not an event target. |
Also, in that case, we should rename onaudioprocess for consistency as well. |
(In reply to comment #3)
This would be a breaking API change for shipping versions, so we'd have to be careful to move it to the "deprecated" and recommended section if we thought it important to change. Personally, I don't think there's any reason it can't still be called onaudioprocess even though it has nothing to do with EventListener |
(In reply to comment #4)
webkit can still support the old API I guess, but the onXXX naming convention is used throughout the web platform for things using event targets, and using such a naming scheme will be very surprising to all web developers, so I think that is a really bad idea. Also the usage of callbacks can enable us clean up the API by accepting the callback as an argument to the createScriptProcessor function, which makes it unnecessary to expose it on ScriptProcessorNode at all. Speaking of which, I don't think exposing bufferSize on that node type makes much sense either. |
(In reply to comment #5)
It is useful to be able to change the callback after creating the script node. Please lets not change that. Exposing buffer size is also useful. The script node currently shares CPU with the main thread. Given this architecture, the amount of time available for audio can be different for different kinds of applications. A graphics rich application may not be able to guarantee enough callbacks just in time, in which case longer buffers would be desirable. An application that spends most of its time doing audio or being idle can use smaller buffer sizes to get lower latency. It is unnecessary to mandate an implementation to automatically determine the required buffering. |
(In reply to comment #6)
The problem with the author choosing the buffer size is that they almost certainly won't be able to choose a size that will work on all kinds of platforms and devices. The UA is best placed to do that. Anyway, there has been discussion about this on the list, and further discussion should take place there, definitely not in this bug :-) |
At the 2013-03-14 teleconference, we agreed that the best solution was probably the one suggested by Dominic in http://lists.w3.org/Archives/Public/public-audio/2013JanMar/0387.html Ehsan, would you be able to fill in the blanks and make the change? |
I feel like the change proposed here is not in line with recent discussion on public-audio ("The issue of ScriptProcessorNode not being an EventTarget.") http://lists.w3.org/Archives/Public/public-audio/2013JanMar/0216.html |
Please disregard Comment 9--I did not see Comment 8. |
OK, I edited the spec accordingly: https://dvcs.w3.org/hg/audio/rev/c68c2551f6c8 Please let me know if it looks good. Now's the time to talk about AudioProcessingEvent.node. I don't think that it makes sense for that attribute to exist, since it will be the same as AudioProcessingEvent.target. Do I need to file another bug on that? |
"This interface is a type of Event which is passed to the onaudioprocess event handler used by ScriptProcessorNode. " And there is also The spec also doesn't mention when audioprocess event is dispatched, only |
Where is EventHandler defined? In the [DOM] reference, only EventListener is defined. I think the spec might be missing a reference. |
(In reply to comment #12)
I cleared up the wording in https://dvcs.w3.org/hg/audio/rev/e26b49247d95.
That is a good question. I'll leave that part to crogers. (In reply to comment #13)
The HTML spec. I added a reference in https://dvcs.w3.org/hg/audio/rev/2056740735fd. |
Is the only remaining part of this bug more detail on when the audioprocess event is dispatched? I'm not even sure that can be detailed in great depth. |
I think this can be closed as no longer relevant. |
First, EventListener should not be used for onfoo handlers.
EventHandler is the right type (or in very special legacy cases OnErrorEventHandler).
But more importantly, if ScriptProcessorNode isn't EventTarget dispatching
event to it isn't really possible, and the event wouldn't have any
.target.
So, either ScriptProcessorNode needs to become EventTarget somehow, and
get normal event handling, or the callback needs to not use Event objects.
The text was updated successfully, but these errors were encountered: