bbcrd/waveform-data.js — pull request #24 by bitwit (2014-09-15 16:44:52+00:00)
Title: preventing duplication of audio context

This is related to discussion occurring in https://github.com/bbcrd/peaks.js/issues/69#issuecomment-55575226

When reusing the audio context in a single page application, new audio contexts are getting created over and over (actually 2 per load inside of peaks.js right now)

After a few loads an error like this appears:
` Error: Failed to construct 'AudioContext': number of hardware contexts reached maximum (6).
at Error (native)
at Function.fromAudioObjectBuilder.getAudioContext (http://127.0.0.1:8081/dist/peaks.min.js:19:811)
at Object.getRemoteData (http://127.0.0.1:8081/dist/peaks.min.js:46:804)
at Object.init (http://127.0.0.1:8081/dist/peaks.min.js:46:403)
at Function.Peaks.init (http://127.0.0.1:8081/dist/peaks.min.js:34:2471)
etc...
`

Also, see this SO discussion of the error: http://stackoverflow.com/questions/25046470/failed-to-construct-audiocontext-number-of-hardware-contexts-reached-maximum