2019-01-27 18:05:20 +00:00
|
|
|
import Vibrato from "Tone/effect/Vibrato";
|
|
|
|
import Basic from "helper/Basic";
|
|
|
|
import EffectTests from "helper/EffectTests";
|
|
|
|
describe("Effect", function(){
|
|
|
|
Basic(Vibrato);
|
|
|
|
EffectTests(Vibrato);
|
2015-08-26 14:29:35 +00:00
|
|
|
|
2019-01-27 18:05:20 +00:00
|
|
|
context("API", function(){
|
2015-08-26 14:29:35 +00:00
|
|
|
|
2019-01-27 18:05:20 +00:00
|
|
|
it("can pass in options in the constructor", function(){
|
|
|
|
var vibrato = new Vibrato({
|
|
|
|
"maxDelay" : 0.02,
|
|
|
|
"depth" : 0.25,
|
|
|
|
"type" : "sawtooth"
|
2015-08-26 14:29:35 +00:00
|
|
|
});
|
2019-01-27 18:05:20 +00:00
|
|
|
expect(vibrato.depth.value).to.be.closeTo(0.25, 0.001);
|
|
|
|
expect(vibrato.type).to.equal("sawtooth");
|
|
|
|
vibrato.dispose();
|
|
|
|
});
|
|
|
|
|
|
|
|
it("can get/set the options", function(){
|
|
|
|
var vibrato = new Vibrato();
|
|
|
|
vibrato.set({
|
|
|
|
"frequency" : 2.4,
|
|
|
|
"type" : "triangle"
|
2015-08-26 14:29:35 +00:00
|
|
|
});
|
2019-01-27 18:05:20 +00:00
|
|
|
expect(vibrato.get().frequency).to.be.closeTo(2.4, 0.01);
|
|
|
|
expect(vibrato.get().type).to.equal("triangle");
|
|
|
|
vibrato.dispose();
|
|
|
|
});
|
2015-08-26 14:29:35 +00:00
|
|
|
|
2019-01-27 18:05:20 +00:00
|
|
|
it("can set the frequency and depth", function(){
|
|
|
|
var vibrato = new Vibrato();
|
|
|
|
vibrato.depth.value = 0.4;
|
|
|
|
vibrato.frequency.value = 0.4;
|
|
|
|
expect(vibrato.depth.value).to.be.closeTo(0.4, 0.01);
|
|
|
|
expect(vibrato.frequency.value).to.be.closeTo(0.4, 0.01);
|
|
|
|
vibrato.dispose();
|
2015-08-26 14:29:35 +00:00
|
|
|
});
|
|
|
|
});
|
2017-12-30 16:26:29 +00:00
|
|
|
});
|
2019-01-27 18:05:20 +00:00
|
|
|
|