Audio-ISSUE-53 (NoteOnOffInteraction): noteOn and noteOff interaction [Web Audio API]
Raised by: Philip Jägenstedt
On product: Web Audio API
What happens if noteOff is called before noteOn?
What happens if noteOn or noteOff is called twice with different values after each other?
[admin] Assigning items currently being worked on by editor.
Change set from the editor:
More feedback from Philip in http://lists.w3.org/Archives/Public/public-audio/2012AprJun/0432.html
We'd prefer if the conditions were defined strictly in terms of
Suggested phrasing for noteOn: "If playbackState is not UNSCHEDULED_STATE,
then the user agent must throw an InvalidStateError exception. Set
playbackState to SCHEDULED_STATE."
Suggested phrasing for noteOff: "If playbackState is UNSCHEDULED_STATE,
then the user agent must throw an InvalidStateError exception." followed
by the steps to schedule a playback stop.
As you can tell, we don't think there's any point in disallowing multiple
calls to noteOff. If we want to disallow it, a new playbackState will be
needed. One can of course implement a hidden state, but it seems simpler
and better to make readyState match reality.
Actually, my suggestion is still not good enough. Quoting <http://wiki.whatwg.org/wiki/Howto_spec#Dealing_with_exceptions>:
"It is important to state whether the algorithm should be terminate when the exception is thrown or not; in some cases, an algorithm will continue even after an exception is thrown (e.g. to do some cleanup)."
In other words, "and terminate these steps" is missing.
(That wiki page is a great read, we should take its advice on many issues.)
Updating issue title to reflect (proposed) name changes from noteOn/noteOff to start/stop.
Web Audio API issues have been migrated to Github.
Closing. See https://github.com/WebAudio/web-audio-api/issues for up to date list of issues for the Web Audio API.