Commit 8284d44e authored by Xiaowu Zhang's avatar Xiaowu Zhang

add equalizer saved

parent 8da0e138
...@@ -39,6 +39,17 @@ ...@@ -39,6 +39,17 @@
// Hey, I want to display this page // Hey, I want to display this page
return this.aq_pleasePublishMyState(param_list[0]); return this.aq_pleasePublishMyState(param_list[0]);
}) })
.allowPublicAcquisition("plSave", function (param_list) {
this.save = this.save || [];
var key = Object.keys(param_list[0]);
this.save[key[0]] = param_list[0][key[0]];
})
.allowPublicAcquisition("plGive", function (param_list) {
if (this.save === undefined) {
return 0;
}
return this.save[param_list[0]];
})
.allowPublicAcquisition("allDocs", function (param_list) { .allowPublicAcquisition("allDocs", function (param_list) {
return this.getDeclaredGadget("jio") return this.getDeclaredGadget("jio")
.push(function (jio_gadget) { .push(function (jio_gadget) {
......
...@@ -155,6 +155,8 @@ ...@@ -155,6 +155,8 @@
} }
gk.declareAcquiredMethod("jio_getAttachment", "jio_getAttachment") gk.declareAcquiredMethod("jio_getAttachment", "jio_getAttachment")
.declareAcquiredMethod("jio_get", "jio_get") .declareAcquiredMethod("jio_get", "jio_get")
.declareAcquiredMethod("plSave", "plSave")
.declareAcquiredMethod("plGive", "plGive")
.declareAcquiredMethod("displayThisPage", "displayThisPage") .declareAcquiredMethod("displayThisPage", "displayThisPage")
.declareAcquiredMethod("displayThisTitle", "displayThisTitle") .declareAcquiredMethod("displayThisTitle", "displayThisTitle")
.declareAcquiredMethod("allDocs", "allDocs") .declareAcquiredMethod("allDocs", "allDocs")
...@@ -164,6 +166,16 @@ ...@@ -164,6 +166,16 @@
var g = this; var g = this;
if (options.id) { if (options.id) {
return new RSVP.Queue() return new RSVP.Queue()
.push(function () {
return g.plGive("type");
})
.push(function (value) {
g.filter.type = value;
return g.plGive("value");
})
.push(function (value) {
g.filter.frequency = value;
})
.push(function () { .push(function () {
g.currentId = options.id; g.currentId = options.id;
return g.jio_get({"_id" : options.id}); return g.jio_get({"_id" : options.id});
...@@ -258,9 +270,12 @@ ...@@ -258,9 +270,12 @@
myLoopEventListener($(filter_context), "change", function () { myLoopEventListener($(filter_context), "change", function () {
g.filter.frequency.value = filter_context.value; g.filter.frequency.value = filter_context.value;
return g.plSave({"value": filter_context.value});
}), }),
myLoopEventListener(filter_type, "change", function () { myLoopEventListener(filter_type, "change", function () {
g.filter.type = parseInt(filter_type.val(), 10); var type = parseInt(filter_type.val(), 10);
g.filter.type = type;
return g.plSave({"type": type});
}) })
]); ]);
}); });
...@@ -272,8 +287,6 @@ ...@@ -272,8 +287,6 @@
g.analyser = audioCtx.createAnalyser(); g.analyser = audioCtx.createAnalyser();
g.gain = audioCtx.createGain(); g.gain = audioCtx.createGain();
g.filter = audioCtx.createBiquadFilter(); g.filter = audioCtx.createBiquadFilter();
g.filter.type = 0;
g.filter.frequency.value = 5000;
g.canvas = g.__element.getElementsByTagName('canvas')[0]; g.canvas = g.__element.getElementsByTagName('canvas')[0];
}); });
}(window, rJS, RSVP, loopEventListener, jQuery, promiseEventListener)); }(window, rJS, RSVP, loopEventListener, jQuery, promiseEventListener));
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment