", {"id" : "Title"})
.appendTo(this.element)
.text(title);
this.attack = this.makeSlider("attack", 0.01, 0.3, "A");
this.decay = this.makeSlider("decay", 0.01, 0.4, "D");
this.sustain = this.makeSlider("sustain", 0, 1, "S");
this.release = this.makeSlider("release", 0.2, 2, "R");
};
GUI.Envelope.prototype.makeSlider = function(attr, min, max, name){
var self = this;
var startVal = this.envelope[attr]*1000;
var slider = $("
", {"class" : "Slider"})
.slider({
orientation: "vertical",
range: "min",
min: min * 1000,
max: max * 1000,
value: startVal,
slide: function(event, ui) {
var settings = {};
settings[attr] = ui.value / 1000;
self.envelope.set(settings);
label.text(settings[attr].toFixed(3));
}
})
.appendTo(this.element);
var label = $("
", {"class" : "Label Bottom"})
.text(startVal / 1000)
.appendTo(slider);
$("
", {"class" : "Label Top"})
.text(name)
.appendTo(slider);
return slider;
};