erik-kallen/SaltarelleWeb — pull request #5 by drysart (2013-04-04 09:12:32+00:00)
Title: Add Web Audio API support

This pull adds support for the Web Audio API (http://www.w3.org/TR/webaudio/) into the System.Html.Media.Audio namespace.

Some key things to note:

* There's some browser detection in the [AudioContext](https://github.com/drysart/SaltarelleWeb/blob/879a260f9905b692d73b0a56b42c2f0edf2cd2b2/Web/Html/Media/Audio/AudioContext.cs) constructor. Can't be avoided as the API is currently vendor-prefixed.

* There's a small correctness compromise with regards to the existing System.Html.AudioElement class not having a MediaElement parent class (as opposed to Element, as it currently has). In the Web Audio specs there are a couple places where an HTMLMediaElement should be passed as an argument, and due to there being no HTMLMediaElement counterpart in System.Html, I simply defined the methods to accept System.Html.Element. If/when a System.Html.VideoElement class (which also should have a MediaElement parent class) is added, this should be revisited.

* The TypedArrays previously defined under System.Html.Media.Graphics.WebGL were all buffed up to fully cover their specification. There is one breaking change against the old version: [Int8Array](https://github.com/drysart/SaltarelleWeb/blob/842ed78eedeb63f5c02cdf88979dd0094cac19e6/Web/Html/Media/Graphics/WebGL/Int8Array.cs) was previously declared as having a constructor that takes byte[], but per the specs the constructor takes an sbyte[]. (The previously-missing [Uint8Array](https://github.com/drysart/SaltarelleWeb/blob/842ed78eedeb63f5c02cdf88979dd0094cac19e6/Web/Html/Media/Graphics/WebGL/Uint8Array.cs) class that correctly uses byte[] was added.)

* Some missing functionality on [XmlHttpRequest](https://github.com/drysart/SaltarelleWeb/commit/8d5ace331a2ed8fef8d81e7eff38d48fe30b9df5#Web/Net/XmlHttpRequest.cs) was added -- particularly the .ReponseType and .Response properties to allow XHR to retrieve ArrayBuffers and Blobs from a remote server.

* These changes don't address it, but there's a pretty strong argument to be made that the TypedArrays stuff doesn't belong in the System.Html.Media.Graphics.WebGL namespace, and should go into a namespace where it's not mixed in with the WebGL stuff since it exists as its own standards specification, like say System.Collections.TypedArrays for instance.