]> git.r.bdr.sh - rbdr/r.bdr.sh/blobdiff - jekyll/js/unlimited_pizza/pepperoni.js
re-style to use times
[rbdr/r.bdr.sh] / jekyll / js / unlimited_pizza / pepperoni.js
index 58bcc5f29cfc7d77024f5c6893792264454f79b2..12dca9dd007cd1a245342c28452248a4d9c7b587 100644 (file)
@@ -1,24 +1,27 @@
+'use strict';
+
 Class(UnlimitedPizza, "Pepperoni").inherits(Widget)({
   INNER_HTML : ' \
-<a class="record-button">&#11044</a> \
+<a class="record-button">Record.</a> \
 <div class="record-info"> \
   <div class="record-progress"> \
     <div class="record-progress-bar-container"> \
       <div class="record-progress-bar"></div> \
     </div> \
-    <a class="record-clear">X</a> \
+    <a class="record-clear">Clear recording.</a> \
   </div> \
   <audio class="record-preview" controls></audio> \
   <div class="filter-switches"> \
     <input class="filter-switch" name="bandpass-filter" type="checkbox" /> <label for="bandpass-filter">Band Pass</label> \
     <input class="filter-switch" name="hipass-filter" type="checkbox" /> <label for="hipass-filter">Hi Pass</label> \
     <input class="filter-switch" name="lopass-filter" type="checkbox" /> <label for="lopass-filter">Lo Pass</label> \
+    <input class="filter-switch" name="reverb-filter" type="checkbox" /> <label for="reverb-filter">Reverb</label> \
     <input class="filter-switch" name="distort-filter" type="checkbox" /> <label for="distort-filter">Distort</label> \
   </div> \
 </div> \
   ',
-  PAUSE : '&#9616;&#9616;',
-  RECORD : '&#11044;',
+  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