Tone.js/src/effects/FeedbackEffect.js

30 lines
723 B
JavaScript
Raw Normal View History

2014-03-15 05:02:33 +00:00
///////////////////////////////////////////////////////////////////////////////
//
// FEEDBACK EFFECTS
//
// an effect with feedback
///////////////////////////////////////////////////////////////////////////////
define(["core/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
this.setDry(.5);
}
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.rampToValue(this.feedback.gain, fback);
}
2014-03-15 05:02:33 +00:00
return Tone.FeedbackEffect;
});