Tone.js/Tone/effects/FeedbackEffect.js

30 lines
740 B
JavaScript
Raw Normal View History

2014-03-15 05:02:33 +00:00
///////////////////////////////////////////////////////////////////////////////
//
// FEEDBACK EFFECTS
//
// an effect with feedback
///////////////////////////////////////////////////////////////////////////////
2014-04-06 20:51:30 +00:00
define(["Tone/core/Tone", "Tone/effects/Effect"], function(Tone){
2014-03-15 05:02:33 +00:00
Tone.FeedbackEffect = function(){
//extends Unit
Tone.Effect.call(this);
2014-03-15 05:02:33 +00:00
this.feedback = this.context.createGain();
//feedback loop
this.chain(this.effectReturn, this.feedback, this.effectSend);
2014-03-15 05:02:33 +00:00
//some initial values
2014-04-07 00:12:40 +00:00
this.setFeedback(0);
}
2014-03-15 05:02:33 +00:00
Tone.extend(Tone.FeedbackEffect, Tone.Effect);
2014-03-15 05:02:33 +00:00
Tone.FeedbackEffect.prototype.setFeedback = function(fback){
this.rampToValueNow(this.feedback.gain, fback);
}
2014-03-15 05:02:33 +00:00
return Tone.FeedbackEffect;
});