X-Git-Url: https://git.r.bdr.sh/rbdr/r.bdr.sh/blobdiff_plain/e6aee9be6b70daf4d3b4e0b1f0f41ce0626adaf0..7b4e0bf11236cc88a9d7fdf7cc120af2d2ce346b:/jekyll/js/unlimited_pizza/pepperoni.js?ds=sidebyside diff --git a/jekyll/js/unlimited_pizza/pepperoni.js b/jekyll/js/unlimited_pizza/pepperoni.js index 58bcc5f..12dca9d 100644 --- a/jekyll/js/unlimited_pizza/pepperoni.js +++ b/jekyll/js/unlimited_pizza/pepperoni.js @@ -1,24 +1,27 @@ +'use strict'; + Class(UnlimitedPizza, "Pepperoni").inherits(Widget)({ INNER_HTML : ' \ - \ +Record. \
\
\
\
\
\ - X \ + Clear recording. \
\ \
\ \ \ \ + \ \
\
\ ', - PAUSE : '▐▐', - RECORD : '⬤', + PAUSE : 'Pause.', + RECORD : 'Record.', prototype : { maxSize : 1048576, recording : false, @@ -34,6 +37,8 @@ Class(UnlimitedPizza, "Pepperoni").inherits(Widget)({ _activatedNodes : null, workerPath : '/js/vendor/recorderjs/recorderWorker.js', init : function init(config) { + var channels, frameCount, reverbBuffer, request, requestHandler; + Widget.prototype.init.call(this, config); if (!this.context) { @@ -67,6 +72,21 @@ Class(UnlimitedPizza, "Pepperoni").inherits(Widget)({ this._bandPassFilterNode.frequency.value = 2000; this._bandPassFilterNode.gain.value = 25; + requestHandler = function bufferFile(ev) { + var request = ev.target; + console.log("Reverb loading"); + this.context.decodeAudioData(request.response, function(buffer){ + console.log("Reverb loaded"); + this._convolverNode.buffer = buffer; + }.bind(this)); + }.bind(this); + + request = new XMLHttpRequest(); + request.open('GET', '/reverb.ogg', true); + request.responseType = 'arraybuffer'; + request.addEventListener('load', requestHandler, false); + request.send(); + if (!this.source) { this._getUserMedia({ audio : true